mirror of https://gitee.com/bigwinds/arangodb
hand over fail information for transactions
This commit is contained in:
parent
e39e39b524
commit
3c4f986fc2
|
@ -576,7 +576,7 @@ TRI_transaction_t* TRI_CreateTransaction (TRI_vocbase_t* vocbase,
|
|||
/// @brief free a transaction container
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_FreeTransaction (TRI_transaction_t* const trx) {
|
||||
void TRI_FreeTransaction (TRI_transaction_t* trx) {
|
||||
assert(trx != nullptr);
|
||||
|
||||
if (trx->_status == TRI_TRANSACTION_RUNNING) {
|
||||
|
@ -584,7 +584,8 @@ void TRI_FreeTransaction (TRI_transaction_t* const trx) {
|
|||
}
|
||||
|
||||
// release the marker protector
|
||||
triagens::wal::LogfileManager::instance()->unregisterMarkerProtector(trx->_id);
|
||||
bool const hasFailedOperations = (trx->_hasOperations && (trx->_status == TRI_TRANSACTION_FAILED || trx->_status == TRI_TRANSACTION_ABORTED));
|
||||
triagens::wal::LogfileManager::instance()->unregisterTransaction(trx->_id, hasFailedOperations);
|
||||
|
||||
// free all collections
|
||||
size_t i = trx->_collections._length;
|
||||
|
@ -660,7 +661,7 @@ TRI_transaction_collection_t* TRI_GetCollectionTransaction (TRI_transaction_t co
|
|||
/// @brief add a collection to a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_AddCollectionTransaction (TRI_transaction_t* const trx,
|
||||
int TRI_AddCollectionTransaction (TRI_transaction_t* trx,
|
||||
const TRI_voc_cid_t cid,
|
||||
const TRI_transaction_type_e accessType,
|
||||
const int nestingLevel) {
|
||||
|
@ -926,7 +927,7 @@ int TRI_BeginTransaction (TRI_transaction_t* trx,
|
|||
trx->_hints = hints;
|
||||
|
||||
// register a protector
|
||||
triagens::wal::LogfileManager::instance()->registerMarkerProtector(trx->_id);
|
||||
triagens::wal::LogfileManager::instance()->registerTransaction(trx->_id);
|
||||
}
|
||||
else {
|
||||
assert(trx->_status == TRI_TRANSACTION_RUNNING);
|
||||
|
|
|
@ -188,7 +188,7 @@ TRI_transaction_t* TRI_CreateTransaction (struct TRI_vocbase_s*,
|
|||
/// @brief free a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_FreeTransaction (TRI_transaction_t* const);
|
||||
void TRI_FreeTransaction (TRI_transaction_t*);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
|
@ -220,7 +220,7 @@ TRI_transaction_collection_t* TRI_GetCollectionTransaction (TRI_transaction_t co
|
|||
/// @brief add a collection to a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_AddCollectionTransaction (TRI_transaction_t* const,
|
||||
int TRI_AddCollectionTransaction (TRI_transaction_t*,
|
||||
const TRI_voc_cid_t,
|
||||
const TRI_transaction_type_e,
|
||||
const int);
|
||||
|
|
|
@ -327,10 +327,10 @@ void LogfileManager::stop () {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief registers a WAL marker protector
|
||||
/// @brief registers a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool LogfileManager::registerMarkerProtector (TRI_voc_tid_t id) {
|
||||
bool LogfileManager::registerTransaction (TRI_voc_tid_t id) {
|
||||
{
|
||||
WRITE_LOCKER(_logfilesLock);
|
||||
|
||||
|
@ -344,13 +344,15 @@ std::cout << "ACQUIRED PROTECTOR FOR TRANSACTION " << id << "\n";
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief unregisters a WAL marker protector
|
||||
/// @brief unregisters a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LogfileManager::unregisterMarkerProtector (TRI_voc_tid_t id) {
|
||||
void LogfileManager::unregisterTransaction (TRI_voc_tid_t id,
|
||||
bool markAsFailed) {
|
||||
WRITE_LOCKER(_logfilesLock);
|
||||
_transactions.erase(id);
|
||||
|
||||
// TODO: handle markAsFailed
|
||||
std::cout << "RELEASED PROTECTOR FOR TRANSACTION " << id << "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -187,16 +187,17 @@ namespace triagens {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief registers a WAL marker protector
|
||||
/// @brief registers a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool registerMarkerProtector (TRI_voc_tid_t);
|
||||
bool registerTransaction (TRI_voc_tid_t);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief unregisters a WAL marker protector
|
||||
/// @brief unregisters a transaction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void unregisterMarkerProtector (TRI_voc_tid_t);
|
||||
void unregisterTransaction (TRI_voc_tid_t,
|
||||
bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not it is currently allowed to create an additional
|
||||
|
|
Loading…
Reference in New Issue