mirror of https://gitee.com/bigwinds/arangodb
avoid lookup plus sequent insert/emplace for the fast path (#9904)
* avoid lookup plus sequent insert/emplace for the fast path additionally add transaction id and more location information to error messages which were previously undistinguishable * Revert "avoid lookup plus sequent insert/emplace for the fast path" This reverts commit 11b27c338940a9fc203dbdb35713845c407a902d. * revert most stuff, only leave improved logging there
This commit is contained in:
parent
0fc5ee1454
commit
7eb000fe98
|
@ -240,19 +240,20 @@ void Manager::registerAQLTrx(TransactionState* state) {
|
|||
}
|
||||
|
||||
TRI_ASSERT(state != nullptr);
|
||||
const size_t bucket = getBucket(state->id());
|
||||
auto const tid = state->id();
|
||||
size_t const bucket = getBucket(tid);
|
||||
{
|
||||
READ_LOCKER(allTransactionsLocker, _allTransactionsLock);
|
||||
WRITE_LOCKER(writeLocker, _transactions[bucket]._lock);
|
||||
|
||||
auto& buck = _transactions[bucket];
|
||||
auto it = buck._managed.find(state->id());
|
||||
auto it = buck._managed.find(tid);
|
||||
if (it != buck._managed.end()) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_TRANSACTION_INTERNAL,
|
||||
"transaction ID already used");
|
||||
std::string("transaction ID '") + std::to_string(tid) + "' already used in registerAQLTrx");
|
||||
}
|
||||
|
||||
buck._managed.emplace(std::piecewise_construct, std::forward_as_tuple(state->id()),
|
||||
buck._managed.emplace(std::piecewise_construct, std::forward_as_tuple(tid),
|
||||
std::forward_as_tuple(MetaType::StandaloneAQL, state));
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ Result Manager::createManagedTrx(TRI_vocbase_t& vocbase, TRI_voc_tid_t tid,
|
|||
auto it = buck._managed.find(tid);
|
||||
if (it != buck._managed.end()) {
|
||||
return res.reset(TRI_ERROR_TRANSACTION_INTERNAL,
|
||||
"transaction ID already used");
|
||||
std::string("transaction ID '") + std::to_string(tid) + "' already used in createManagedTrx lookup");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,7 +428,7 @@ Result Manager::createManagedTrx(TRI_vocbase_t& vocbase, TRI_voc_tid_t tid,
|
|||
auto it = _transactions[bucket]._managed.find(tid);
|
||||
if (it != _transactions[bucket]._managed.end()) {
|
||||
return res.reset(TRI_ERROR_TRANSACTION_INTERNAL,
|
||||
"transaction ID already used");
|
||||
std::string("transaction ID '") + std::to_string(tid) + "' already used in createManagedTrx insert");
|
||||
}
|
||||
TRI_ASSERT(state->id() == tid);
|
||||
_transactions[bucket]._managed.emplace(std::piecewise_construct,
|
||||
|
|
Loading…
Reference in New Issue