mirror of https://gitee.com/bigwinds/arangodb
issue 427.2: ensure the underlying error is properly propagated up (#6100)
This commit is contained in:
parent
6e64c8ec9a
commit
a46122efde
|
@ -207,7 +207,14 @@ int MMFilesTransactionCollection::use(int nestingLevel) {
|
||||||
TRI_vocbase_col_status_e status;
|
TRI_vocbase_col_status_e status;
|
||||||
|
|
||||||
LOG_TRX(_transaction, nestingLevel) << "using collection " << _cid;
|
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);
|
_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 {
|
} else {
|
||||||
// use without usage-lock (lock already set externally)
|
// use without usage-lock (lock already set externally)
|
||||||
_collection = _transaction->vocbase().lookupCollection(_cid).get();
|
_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
|
// store the waitForSync property
|
||||||
_waitForSync = _collection->waitForSync();
|
_waitForSync = _collection->waitForSync();
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,11 +182,16 @@ int RocksDBTransactionCollection::use(int nestingLevel) {
|
||||||
TRI_vocbase_col_status_e status;
|
TRI_vocbase_col_status_e status;
|
||||||
|
|
||||||
LOG_TRX(_transaction, nestingLevel) << "using collection " << _cid;
|
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);
|
_collection = _transaction->vocbase().useCollection(_cid, status);
|
||||||
|
|
||||||
if (_collection != nullptr) {
|
if (!_collection) {
|
||||||
_usageLocked = true;
|
// must return an error
|
||||||
|
return TRI_ERROR_NO_ERROR == TRI_errno()
|
||||||
|
? TRI_ERROR_INTERNAL : TRI_errno();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_usageLocked = true;
|
||||||
} else {
|
} else {
|
||||||
// use without usage-lock (lock already set externally)
|
// use without usage-lock (lock already set externally)
|
||||||
_collection = _transaction->vocbase().lookupCollection(_cid).get();
|
_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;
|
doSetup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue