1
0
Fork 0

more cleanup

This commit is contained in:
Jan Steemann 2014-10-18 01:39:47 +02:00
parent 40ddb93eee
commit e6f10b374b
3 changed files with 26 additions and 1 deletions

View File

@ -98,6 +98,7 @@ static void CleanupDocumentCollection (TRI_vocbase_col_t* collection,
container->_numBarrierElements > 0) {
// 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
TRI_UnlockSpin(&container->_lock);
return;
}
@ -131,12 +132,18 @@ static void CleanupDocumentCollection (TRI_vocbase_col_t* collection,
if (! TRI_IsFullyCollectedDocumentCollection(document)) {
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)) {
isDeleted = (collection->_status == TRI_VOC_COL_STATUS_DELETED);
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) {
// collection is not fully collected and still undeleted - postpone the unload
return;

View File

@ -2336,6 +2336,18 @@ void TRI_ReleaseCollectionVocBase (TRI_vocbase_t* vocbase,
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
////////////////////////////////////////////////////////////////////////////////

View File

@ -600,6 +600,12 @@ TRI_vocbase_col_t* TRI_UseCollectionByNameVocBase (TRI_vocbase_t*,
void TRI_ReleaseCollectionVocBase (TRI_vocbase_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
////////////////////////////////////////////////////////////////////////////////