1
0
Fork 0

issue 427.2: ensure the underlying error is properly propagated up (#6100)

This commit is contained in:
Vasiliy 2018-08-07 16:22:04 +03:00 committed by Jan
parent 6e64c8ec9a
commit a46122efde
2 changed files with 14 additions and 23 deletions

View File

@ -207,7 +207,14 @@ int MMFilesTransactionCollection::use(int nestingLevel) {
TRI_vocbase_col_status_e status;
LOG_TRX(_transaction, nestingLevel) << "using collection " << _cid;
TRI_set_errno(TRI_ERROR_NO_ERROR); // clear error state so can get valid error below
_collection = _transaction->vocbase().useCollection(_cid, status);
if (!_collection) {
// must return an error
return TRI_ERROR_NO_ERROR == TRI_errno()
? TRI_ERROR_INTERNAL : TRI_errno();
}
} else {
// use without usage-lock (lock already set externally)
_collection = _transaction->vocbase().lookupCollection(_cid).get();
@ -217,17 +224,6 @@ int MMFilesTransactionCollection::use(int nestingLevel) {
}
}
if (_collection == nullptr) {
// something went wrong
int res = TRI_errno();
if (res == TRI_ERROR_NO_ERROR) {
// must return an error
res = TRI_ERROR_INTERNAL;
}
return res;
}
// store the waitForSync property
_waitForSync = _collection->waitForSync();
}

View File

@ -182,11 +182,16 @@ int RocksDBTransactionCollection::use(int nestingLevel) {
TRI_vocbase_col_status_e status;
LOG_TRX(_transaction, nestingLevel) << "using collection " << _cid;
TRI_set_errno(TRI_ERROR_NO_ERROR); // clear error state so can get valid error below
_collection = _transaction->vocbase().useCollection(_cid, status);
if (_collection != nullptr) {
_usageLocked = true;
if (!_collection) {
// must return an error
return TRI_ERROR_NO_ERROR == TRI_errno()
? TRI_ERROR_INTERNAL : TRI_errno();
}
_usageLocked = true;
} else {
// use without usage-lock (lock already set externally)
_collection = _transaction->vocbase().lookupCollection(_cid).get();
@ -196,16 +201,6 @@ int RocksDBTransactionCollection::use(int nestingLevel) {
}
}
if (_collection == nullptr) {
int res = TRI_errno();
if (res == TRI_ERROR_ARANGO_COLLECTION_NOT_LOADED) {
return res;
}
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
}
doSetup = true;
}