mirror of https://gitee.com/bigwinds/arangodb
more cleanup
This commit is contained in:
parent
40ddb93eee
commit
e6f10b374b
|
@ -98,6 +98,7 @@ static void CleanupDocumentCollection (TRI_vocbase_col_t* collection,
|
||||||
container->_numBarrierElements > 0) {
|
container->_numBarrierElements > 0) {
|
||||||
// did not find anything at the head of the barrier list or found an element marker
|
// did not find anything at the head of the barrier list or found an element marker
|
||||||
// this means we must exit and cannot throw away datafiles and can unload collections
|
// this means we must exit and cannot throw away datafiles and can unload collections
|
||||||
|
|
||||||
TRI_UnlockSpin(&container->_lock);
|
TRI_UnlockSpin(&container->_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -131,12 +132,18 @@ static void CleanupDocumentCollection (TRI_vocbase_col_t* collection,
|
||||||
if (! TRI_IsFullyCollectedDocumentCollection(document)) {
|
if (! TRI_IsFullyCollectedDocumentCollection(document)) {
|
||||||
bool isDeleted = false;
|
bool isDeleted = false;
|
||||||
|
|
||||||
// if there is still some collection to perform, check if the collection was deleted already
|
// if there is still some garbage collection to perform,
|
||||||
|
// check if the collection was deleted already
|
||||||
if (TRI_TRY_READ_LOCK_STATUS_VOCBASE_COL(collection)) {
|
if (TRI_TRY_READ_LOCK_STATUS_VOCBASE_COL(collection)) {
|
||||||
isDeleted = (collection->_status == TRI_VOC_COL_STATUS_DELETED);
|
isDeleted = (collection->_status == TRI_VOC_COL_STATUS_DELETED);
|
||||||
TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection);
|
TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! isDeleted && TRI_IsDeletedVocBase(collection->_vocbase)) {
|
||||||
|
// the collection was not marked as deleted, but the database was
|
||||||
|
isDeleted = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (! isDeleted) {
|
if (! isDeleted) {
|
||||||
// collection is not fully collected and still undeleted - postpone the unload
|
// collection is not fully collected and still undeleted - postpone the unload
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2336,6 +2336,18 @@ void TRI_ReleaseCollectionVocBase (TRI_vocbase_t* vocbase,
|
||||||
TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection);
|
TRI_READ_UNLOCK_STATUS_VOCBASE_COL(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief whether or not the vocbase has been marked as deleted
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool TRI_IsDeletedVocBase (TRI_vocbase_t* vocbase) {
|
||||||
|
TRI_LockSpin(&vocbase->_usage._lock);
|
||||||
|
bool isDeleted = vocbase->_usage._isDeleted;
|
||||||
|
TRI_UnlockSpin(&vocbase->_usage._lock);
|
||||||
|
|
||||||
|
return isDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief increase the reference counter for a database
|
/// @brief increase the reference counter for a database
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -600,6 +600,12 @@ TRI_vocbase_col_t* TRI_UseCollectionByNameVocBase (TRI_vocbase_t*,
|
||||||
void TRI_ReleaseCollectionVocBase (TRI_vocbase_t*,
|
void TRI_ReleaseCollectionVocBase (TRI_vocbase_t*,
|
||||||
TRI_vocbase_col_t*);
|
TRI_vocbase_col_t*);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief whether or not the vocbase has been marked as deleted
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool TRI_IsDeletedVocBase (TRI_vocbase_t*);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief increase the reference counter for a database
|
/// @brief increase the reference counter for a database
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue