mirror of https://gitee.com/bigwinds/arangodb
Trigger compaction on drop and truncate
This commit is contained in:
parent
1c82d4448c
commit
40b8eb2824
|
@ -546,6 +546,9 @@ bool RocksDBCollection::dropIndex(TRI_idx_iid_t iid) {
|
|||
int rv = cindex->drop();
|
||||
|
||||
if (rv == TRI_ERROR_NO_ERROR) {
|
||||
// trigger compaction before deleting the object
|
||||
cindex->compact();
|
||||
|
||||
_indexes.erase(_indexes.begin() + i);
|
||||
events::DropIndex("", std::to_string(iid), TRI_ERROR_NO_ERROR);
|
||||
|
||||
|
@ -687,6 +690,10 @@ void RocksDBCollection::truncate(transaction::Methods* trx,
|
|||
iter->Next();
|
||||
}
|
||||
}
|
||||
|
||||
// we want to trigger compaction here, because rocksdb
|
||||
// does not appear to do it automatically
|
||||
this->compact();
|
||||
}
|
||||
|
||||
DocumentIdentifierToken RocksDBCollection::lookupKey(transaction::Methods* trx,
|
||||
|
@ -1235,12 +1242,10 @@ arangodb::Result RocksDBCollection::fillIndexes(
|
|||
bool hasMore = true;
|
||||
while (hasMore) {
|
||||
hasMore = iter->next(cb, 5000);
|
||||
if (_logicalCollection->deleted()) {
|
||||
if (_logicalCollection->status() == TRI_VOC_COL_STATUS_DELETED
|
||||
|| _logicalCollection->deleted()) {
|
||||
res = TRI_ERROR_INTERNAL;
|
||||
}
|
||||
TRI_IF_FAILURE("RocksDBCollection::over9000") {
|
||||
if (numDocsWritten > 9000) res = TRI_ERROR_DEBUG; // its over 9000!
|
||||
}
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
r = Result(res);
|
||||
break;
|
||||
|
|
|
@ -739,6 +739,7 @@ arangodb::Result RocksDBEngine::dropCollection(
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
}
|
||||
coll->compact();
|
||||
|
||||
// if we get here all documents / indexes are gone.
|
||||
// We have no data garbage left.
|
||||
|
|
|
@ -2021,7 +2021,7 @@ static void JS_PregelStart(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
// TRI_V8_THROW_EXCEPTION_USAGE(
|
||||
// "Vertex collection needs to be shared after '_key'");
|
||||
//}
|
||||
if (coll->deleted()) {
|
||||
if (coll->status() == TRI_VOC_COL_STATUS_DELETED || coll->deleted()) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, name);
|
||||
}
|
||||
} catch (...) {
|
||||
|
@ -2029,7 +2029,8 @@ static void JS_PregelStart(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
}
|
||||
} else if (ss->getRole() == ServerState::ROLE_SINGLE) {
|
||||
LogicalCollection *coll = vocbase->lookupCollection(name);
|
||||
if (coll == nullptr || coll->deleted()) {
|
||||
if (coll == nullptr || coll->status() == TRI_VOC_COL_STATUS_DELETED
|
||||
|| coll->deleted()) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, name);
|
||||
}
|
||||
} else {
|
||||
|
@ -2056,7 +2057,7 @@ static void JS_PregelStart(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
"smart graphs");
|
||||
}
|
||||
}
|
||||
if (coll->deleted()) {
|
||||
if (coll->status() == TRI_VOC_COL_STATUS_DELETED || coll->deleted()) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, name);
|
||||
}
|
||||
// smart edge collections contain multiple actual collections
|
||||
|
|
Loading…
Reference in New Issue