mirror of https://gitee.com/bigwinds/arangodb
don't mask errors with fake OOM messages (#2872)
This commit is contained in:
parent
589ffd5c59
commit
634574ed9f
|
@ -381,7 +381,7 @@ static std::shared_ptr<Index> findIndex(
|
|||
|
||||
if (!value.isString()) {
|
||||
// Compatibility with old v8-vocindex.
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid index type definition");
|
||||
}
|
||||
|
||||
std::string tmp = value.copyString();
|
||||
|
@ -1369,7 +1369,7 @@ RocksDBOperationResult RocksDBCollection::insertDocument(
|
|||
for (std::shared_ptr<Index> const& idx : _indexes) {
|
||||
innerRes.reset(idx->insert(trx, revisionId, doc, false));
|
||||
|
||||
// in case of no-memory, return immediately
|
||||
// in case of OOM return immediately
|
||||
if (innerRes.is(TRI_ERROR_OUT_OF_MEMORY)) {
|
||||
return innerRes;
|
||||
}
|
||||
|
@ -1433,7 +1433,7 @@ RocksDBOperationResult RocksDBCollection::removeDocument(
|
|||
Result tmpres = idx->remove(trx, revisionId, doc, false);
|
||||
resInner.reset(tmpres);
|
||||
|
||||
// in case of no-memory, return immediately
|
||||
// in case of OOM return immediately
|
||||
if (resInner.is(TRI_ERROR_OUT_OF_MEMORY)) {
|
||||
return resInner;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ static int ProcessIndexFields(VPackSlice const definition,
|
|||
TRI_ASSERT(builder.isOpenObject());
|
||||
std::unordered_set<StringRef> fields;
|
||||
|
||||
try {
|
||||
VPackSlice fieldsSlice = definition.get("fields");
|
||||
builder.add(VPackValue("fields"));
|
||||
builder.openArray();
|
||||
|
@ -90,9 +89,6 @@ static int ProcessIndexFields(VPackSlice const definition,
|
|||
}
|
||||
|
||||
builder.close();
|
||||
} catch (...) {
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -293,9 +289,7 @@ int RocksDBIndexFactory::enhanceIndexDefinition(VPackSlice const definition,
|
|||
}
|
||||
|
||||
TRI_ASSERT(enhanced.isEmpty());
|
||||
int res = TRI_ERROR_INTERNAL;
|
||||
|
||||
try {
|
||||
VPackObjectBuilder b(&enhanced);
|
||||
current = definition.get("id");
|
||||
uint64_t id = 0;
|
||||
|
@ -314,16 +308,11 @@ int RocksDBIndexFactory::enhanceIndexDefinition(VPackSlice const definition,
|
|||
VPackValue(std::to_string(TRI_NewTickServer())));
|
||||
}
|
||||
}
|
||||
// breaks lookupIndex()
|
||||
/*else {
|
||||
if (!definition.hasKey("objectId")) {
|
||||
// objectId missing, but must be present
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
}*/
|
||||
|
||||
enhanced.add("type", VPackValue(Index::oldtypeName(type)));
|
||||
|
||||
int res = TRI_ERROR_INTERNAL;
|
||||
|
||||
switch (type) {
|
||||
case Index::TRI_IDX_TYPE_PRIMARY_INDEX:
|
||||
case Index::TRI_IDX_TYPE_EDGE_INDEX: {
|
||||
|
@ -361,11 +350,6 @@ int RocksDBIndexFactory::enhanceIndexDefinition(VPackSlice const definition,
|
|||
}
|
||||
}
|
||||
|
||||
} catch (...) {
|
||||
// TODO Check for different type of Errors
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -532,13 +532,10 @@ Result RocksDBVPackIndex::insertInternal(transaction::Methods* trx,
|
|||
std::vector<RocksDBKey> elements;
|
||||
std::vector<uint64_t> hashes;
|
||||
int res;
|
||||
try {
|
||||
{
|
||||
// rethrow all types of exceptions from here...
|
||||
transaction::BuilderLeaser leased(trx);
|
||||
res = fillElement(*(leased.get()), revisionId, doc, elements, hashes);
|
||||
} catch (basics::Exception const& ex) {
|
||||
res = ex.code();
|
||||
} catch (...) {
|
||||
res = TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -604,13 +601,10 @@ Result RocksDBVPackIndex::removeInternal(transaction::Methods* trx,
|
|||
std::vector<uint64_t> hashes;
|
||||
|
||||
int res;
|
||||
try {
|
||||
{
|
||||
// rethrow all types of exceptions from here...
|
||||
transaction::BuilderLeaser leased(trx);
|
||||
res = fillElement(*(leased.get()), revisionId, doc, elements, hashes);
|
||||
} catch (basics::Exception const& ex) {
|
||||
res = ex.code();
|
||||
} catch (...) {
|
||||
res = TRI_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
|
Loading…
Reference in New Issue