diff --git a/arangod/Cluster/ClusterInfo.cpp b/arangod/Cluster/ClusterInfo.cpp index b9c12951da..a37a1be503 100644 --- a/arangod/Cluster/ClusterInfo.cpp +++ b/arangod/Cluster/ClusterInfo.cpp @@ -1422,7 +1422,7 @@ int ClusterInfo::setCollectionPropertiesCoordinator( copy.add(key, entry.value); } } - copy.add("doCompact", VPackValue(info->doCompact())); + copy.add("doCompact", VPackValue(info->getPhysical()->doCompact())); copy.add("journalSize", VPackValue(info->getPhysical()->journalSize())); copy.add("waitForSync", VPackValue(info->waitForSync())); copy.add("indexBuckets", VPackValue(info->indexBuckets())); diff --git a/arangod/Cluster/v8-cluster.cpp b/arangod/Cluster/v8-cluster.cpp index d058423f31..633550d6f4 100644 --- a/arangod/Cluster/v8-cluster.cpp +++ b/arangod/Cluster/v8-cluster.cpp @@ -599,7 +599,7 @@ static void JS_GetCollectionInfoClusterInfo( result->Set(TRI_V8_ASCII_STRING("deleted"), v8::Boolean::New(isolate, ci->deleted())); result->Set(TRI_V8_ASCII_STRING("doCompact"), - v8::Boolean::New(isolate, ci->doCompact())); + v8::Boolean::New(isolate, ci->getPhysical()->doCompact())); result->Set(TRI_V8_ASCII_STRING("isSystem"), v8::Boolean::New(isolate, ci->isSystem())); result->Set(TRI_V8_ASCII_STRING("isVolatile"), diff --git a/arangod/MMFiles/MMFilesCollection.cpp b/arangod/MMFiles/MMFilesCollection.cpp index 56f287c545..afd29378ff 100644 --- a/arangod/MMFiles/MMFilesCollection.cpp +++ b/arangod/MMFiles/MMFilesCollection.cpp @@ -118,6 +118,7 @@ int MMFilesCollection::updateProperties(VPackSlice const& slice, bool doSync){ _journalSize = Helper::getNumericValue(slice, "maximalSize", _journalSize); } + _doCompact = Helper::getBooleanValue(slice, "doCompact", _doCompact); return TRI_ERROR_NO_ERROR; } @@ -372,7 +373,9 @@ MMFilesCollection::MMFilesCollection(LogicalCollection* collection, VPackSlice c // journalSize. paramters.json uses maximalSize Helper::readNumericValue(info, "journalSize", TRI_JOURNAL_DEFAULT_SIZE))), - _useSecondaryIndexes(true) { + _useSecondaryIndexes(true), + _doCompact(Helper::readBooleanValue(info, "doCompact", true)) +{ setCompactionStatus("compaction not yet started"); } @@ -389,6 +392,7 @@ MMFilesCollection::MMFilesCollection(LogicalCollection* logical, PhysicalCollect _lastCompactionStamp = mmfiles._lastCompactionStamp; _journalSize = mmfiles._journalSize; _path = mmfiles._path; + _doCompact = mmfiles._doCompact; setCompactionStatus("compaction not yet started"); // not copied diff --git a/arangod/MMFiles/MMFilesCollection.h b/arangod/MMFiles/MMFilesCollection.h index 2f52992087..5fc796e23c 100644 --- a/arangod/MMFiles/MMFilesCollection.h +++ b/arangod/MMFiles/MMFilesCollection.h @@ -204,6 +204,9 @@ class MMFilesCollection final : public PhysicalCollection { int iterateMarkersOnLoad(arangodb::transaction::Methods* trx) override; bool isFullyCollected() const override; + + bool doCompact() const override { return _doCompact; } + int64_t uncollectedLogfileEntries() const { return _uncollectedLogfileEntries.load(); @@ -461,6 +464,7 @@ class MMFilesCollection final : public PhysicalCollection { // whether or not secondary indexes should be filled bool _useSecondaryIndexes; + bool _doCompact; }; diff --git a/arangod/MMFiles/MMFilesCompactorThread.cpp b/arangod/MMFiles/MMFilesCompactorThread.cpp index 2a3caa8e29..c85fcd1753 100644 --- a/arangod/MMFiles/MMFilesCompactorThread.cpp +++ b/arangod/MMFiles/MMFilesCompactorThread.cpp @@ -871,7 +871,7 @@ void MMFilesCompactorThread::run() { return; } - bool doCompact = collection->doCompact(); + bool doCompact = collection->getPhysical()->doCompact(); // for document collection, compactify datafiles if (collection->status() == TRI_VOC_COL_STATUS_LOADED && doCompact) { diff --git a/arangod/RestHandler/RestReplicationHandler.cpp b/arangod/RestHandler/RestReplicationHandler.cpp index 51b6b43abf..e10b4eded8 100644 --- a/arangod/RestHandler/RestReplicationHandler.cpp +++ b/arangod/RestHandler/RestReplicationHandler.cpp @@ -1258,7 +1258,7 @@ int RestReplicationHandler::createCollection(VPackSlice const& slice, TRI_ASSERT(col != nullptr); /* Temporary ASSERTS to prove correctness of new constructor */ - TRI_ASSERT(col->doCompact() == + TRI_ASSERT(col->getPhysical()->doCompact() == arangodb::basics::VelocyPackHelper::getBooleanValue( slice, "doCompact", true)); TRI_ASSERT( diff --git a/arangod/V8Server/v8-collection.cpp b/arangod/V8Server/v8-collection.cpp index 996d03f03b..70b821e4dd 100644 --- a/arangod/V8Server/v8-collection.cpp +++ b/arangod/V8Server/v8-collection.cpp @@ -1328,7 +1328,7 @@ static void JS_PropertiesVocbaseCol( TRI_GET_GLOBAL_STRING(IsVolatileKey); TRI_GET_GLOBAL_STRING(JournalSizeKey); TRI_GET_GLOBAL_STRING(WaitForSyncKey); - result->Set(DoCompactKey, v8::Boolean::New(isolate, info->doCompact())); + result->Set(DoCompactKey, v8::Boolean::New(isolate, info->getPhysical()->doCompact())); result->Set(IsSystemKey, v8::Boolean::New(isolate, info->isSystem())); result->Set(IsVolatileKey, v8::Boolean::New(isolate, info->isVolatile())); result->Set(JournalSizeKey, v8::Number::New(isolate, static_cast(info->getPhysical()->journalSize()))); @@ -1457,7 +1457,7 @@ static void JS_PropertiesVocbaseCol( TRI_GET_GLOBAL_STRING(IsSystemKey); TRI_GET_GLOBAL_STRING(IsVolatileKey); TRI_GET_GLOBAL_STRING(JournalSizeKey); - result->Set(DoCompactKey, v8::Boolean::New(isolate, collection->doCompact())); + result->Set(DoCompactKey, v8::Boolean::New(isolate, collection->getPhysical()->doCompact())); result->Set(IsSystemKey, v8::Boolean::New(isolate, collection->isSystem())); result->Set(IsVolatileKey, v8::Boolean::New(isolate, collection->isVolatile())); diff --git a/arangod/VocBase/LogicalCollection.cpp b/arangod/VocBase/LogicalCollection.cpp index 150c681545..0d5d55ed34 100644 --- a/arangod/VocBase/LogicalCollection.cpp +++ b/arangod/VocBase/LogicalCollection.cpp @@ -153,7 +153,6 @@ LogicalCollection::LogicalCollection(LogicalCollection const& other) _status(other.status()), _isLocal(false), _isDeleted(other._isDeleted), - _doCompact(other.doCompact()), _isSystem(other.isSystem()), _isVolatile(other.isVolatile()), _waitForSync(other.waitForSync()), @@ -203,7 +202,6 @@ LogicalCollection::LogicalCollection(TRI_vocbase_t* vocbase, info, "status", TRI_VOC_COL_STATUS_CORRUPTED)), _isLocal(!ServerState::instance()->isCoordinator()), _isDeleted(Helper::readBooleanValue(info, "deleted", false)), - _doCompact(Helper::readBooleanValue(info, "doCompact", true)), _isSystem(IsSystemName(_name) && Helper::readBooleanValue(info, "isSystem", false)), _isVolatile(Helper::readBooleanValue(info, "isVolatile", false)), @@ -633,8 +631,6 @@ bool LogicalCollection::isLocal() const { return _isLocal; } bool LogicalCollection::deleted() const { return _isDeleted; } -bool LogicalCollection::doCompact() const { return _doCompact; } - bool LogicalCollection::isSystem() const { return _isSystem; } bool LogicalCollection::isVolatile() const { return _isVolatile; } @@ -709,7 +705,7 @@ void LogicalCollection::getPropertiesVPack(VPackBuilder& result, bool translateC result.add("type", VPackValue(static_cast(_type))); result.add("status", VPackValue(_status)); result.add("deleted", VPackValue(_isDeleted)); - result.add("doCompact", VPackValue(_doCompact)); + result.add("doCompact", VPackValue(getPhysical()->doCompact())); result.add("isSystem", VPackValue(_isSystem)); result.add("isVolatile", VPackValue(_isVolatile)); result.add("waitForSync", VPackValue(_waitForSync)); @@ -1047,7 +1043,6 @@ int LogicalCollection::updateProperties(VPackSlice const& slice, bool doSync) { } // end of validation - _doCompact = Helper::getBooleanValue(slice, "doCompact", _doCompact); _waitForSync = Helper::getBooleanValue(slice, "waitForSync", _waitForSync); getPhysical()->updateProperties(slice,doSync); _indexBuckets = diff --git a/arangod/VocBase/LogicalCollection.h b/arangod/VocBase/LogicalCollection.h index af11867af7..a625945c43 100644 --- a/arangod/VocBase/LogicalCollection.h +++ b/arangod/VocBase/LogicalCollection.h @@ -162,7 +162,6 @@ class LogicalCollection { TRI_voc_rid_t revision() const; bool isLocal() const; bool deleted() const; - bool doCompact() const; bool isSystem() const; bool isVolatile() const; bool waitForSync() const; @@ -385,7 +384,6 @@ private: // SECTION: Properties bool _isLocal; bool _isDeleted; - bool _doCompact; bool const _isSystem; bool const _isVolatile; bool _waitForSync; diff --git a/arangod/VocBase/PhysicalCollection.h b/arangod/VocBase/PhysicalCollection.h index 41ee6aea6e..ebc1074b1c 100644 --- a/arangod/VocBase/PhysicalCollection.h +++ b/arangod/VocBase/PhysicalCollection.h @@ -95,6 +95,7 @@ class PhysicalCollection { virtual uint8_t const* lookupRevisionVPackConditional(TRI_voc_rid_t revisionId, TRI_voc_tick_t maxTick, bool excludeWal) const = 0; virtual bool isFullyCollected() const = 0; + virtual bool doCompact() const = 0; //////////////////////////////////// // -- SECTION Indexes --