mirror of https://gitee.com/bigwinds/arangodb
remove ditches from interface. the ditches concept needs fixing!!
This commit is contained in:
parent
fe1ed3aa4a
commit
6e1f77be24
|
@ -164,7 +164,8 @@ void MMFilesCleanupThread::cleanupCollection(arangodb::LogicalCollection* collec
|
|||
// loop until done
|
||||
|
||||
while (true) {
|
||||
auto ditches = collection->ditches();
|
||||
auto mmfiles = toMMFilesCollection(collection);
|
||||
auto ditches = mmfiles->ditches();
|
||||
|
||||
TRI_ASSERT(ditches != nullptr);
|
||||
|
||||
|
|
|
@ -197,8 +197,7 @@ class MMFilesCollection final : public PhysicalCollection {
|
|||
double lastCompactionStamp() const { return _lastCompactionStamp; }
|
||||
void lastCompactionStamp(double value) { _lastCompactionStamp = value; }
|
||||
|
||||
|
||||
Ditches* ditches() const override { return &_ditches; }
|
||||
Ditches* ditches() const { return &_ditches; }
|
||||
|
||||
void open(bool ignoreErrors) override;
|
||||
|
||||
|
|
|
@ -547,7 +547,7 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
removeDatafile(collection, compaction._datafile);
|
||||
|
||||
// add a deletion ditch to the collection
|
||||
auto b = collection->ditches()->createDropDatafileDitch(
|
||||
auto b = toMMFilesCollection(collection)->ditches()->createDropDatafileDitch(
|
||||
compaction._datafile, collection, DropDatafileCallback, __FILE__,
|
||||
__LINE__);
|
||||
|
||||
|
@ -576,7 +576,7 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
|
||||
if (i == 0) {
|
||||
// add a rename marker
|
||||
auto b = collection->ditches()->createRenameDatafileDitch(
|
||||
auto b = toMMFilesCollection(collection)->ditches()->createRenameDatafileDitch(
|
||||
compaction._datafile, context->_compactor, context->_collection, RenameDatafileCallback, __FILE__,
|
||||
__LINE__);
|
||||
|
||||
|
@ -591,7 +591,7 @@ void MMFilesCompactorThread::compactDatafiles(LogicalCollection* collection,
|
|||
removeDatafile(collection, compaction._datafile);
|
||||
|
||||
// add a drop datafile marker
|
||||
auto b = collection->ditches()->createDropDatafileDitch(
|
||||
auto b = toMMFilesCollection(collection)->ditches()->createDropDatafileDitch(
|
||||
compaction._datafile, collection, DropDatafileCallback, __FILE__,
|
||||
__LINE__);
|
||||
|
||||
|
@ -891,7 +891,7 @@ void MMFilesCompactorThread::run() {
|
|||
try {
|
||||
double const now = TRI_microtime();
|
||||
if (physical->lastCompactionStamp() + compactionCollectionInterval() <= now) {
|
||||
auto ce = collection->ditches()->createCompactionDitch(__FILE__,
|
||||
auto ce = toMMFilesCollection(collection)->ditches()->createCompactionDitch(__FILE__,
|
||||
__LINE__);
|
||||
|
||||
if (ce == nullptr) {
|
||||
|
@ -913,7 +913,7 @@ void MMFilesCompactorThread::run() {
|
|||
// in case an error occurs, we must still free this ditch
|
||||
}
|
||||
|
||||
collection->ditches()->freeDitch(ce);
|
||||
toMMFilesCollection(collection)->ditches()->freeDitch(ce);
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
|
|
|
@ -2219,7 +2219,7 @@ char* MMFilesEngine::nextFreeMarkerPosition(
|
|||
// we only need the ditches when we are outside the recovery
|
||||
// the compactor will not run during recovery
|
||||
auto ditch =
|
||||
collection->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
toMMFilesCollection(collection)->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
|
||||
if (ditch == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||
#include "Utils/CollectionGuard.h"
|
||||
#include "MMFiles/MMFilesCollection.h"
|
||||
#include "MMFiles/MMFilesDatafileHelper.h"
|
||||
#include "MMFiles/MMFilesIndexElement.h"
|
||||
#include "MMFiles/MMFilesPrimaryIndex.h"
|
||||
|
@ -1049,7 +1050,7 @@ int InitialSyncer::handleSyncKeys(arangodb::LogicalCollection* col,
|
|||
return res;
|
||||
}
|
||||
|
||||
ditch = col->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
ditch = toMMFilesCollection(col)->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
|
||||
if (ditch == nullptr) {
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1058,7 +1059,7 @@ int InitialSyncer::handleSyncKeys(arangodb::LogicalCollection* col,
|
|||
|
||||
TRI_ASSERT(ditch != nullptr);
|
||||
|
||||
TRI_DEFER(col->ditches()->freeDitch(ditch));
|
||||
TRI_DEFER(toMMFilesCollection(col)->ditches()->freeDitch(ditch));
|
||||
|
||||
{
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase), col->cid(), AccessMode::Type::READ);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "VocBase/LogicalCollection.h"
|
||||
#include "VocBase/PhysicalCollection.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
#include "MMFiles/MMFilesCollection.h" //TODO -- REMOVE
|
||||
|
||||
using namespace arangodb;
|
||||
|
||||
|
@ -64,7 +65,7 @@ void CollectionExport::run(uint64_t maxWaitTime, size_t limit) {
|
|||
// try to acquire the exclusive lock on the compaction
|
||||
engine->preventCompaction(_collection->vocbase(), [this](TRI_vocbase_t* vocbase) {
|
||||
// create a ditch under the compaction lock
|
||||
_ditch = _collection->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
_ditch = toMMFilesCollection(_collection)->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
});
|
||||
|
||||
// now we either have a ditch or not
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "Basics/StringRef.h"
|
||||
#include "MMFiles/MMFilesDatafileHelper.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/MMFilesCollection.h" //TODO -- REMOVE
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "StorageEngine/StorageEngine.h"
|
||||
#include "Transaction/Helpers.h"
|
||||
|
@ -89,7 +90,7 @@ void CollectionKeys::create(TRI_voc_tick_t maxTick) {
|
|||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
engine->preventCompaction(_collection->vocbase(), [this](TRI_vocbase_t* vocbase) {
|
||||
// create a ditch under the compaction lock
|
||||
_ditch = _collection->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
_ditch = toMMFilesCollection(_collection)->ditches()->createDocumentDitch(false, __FILE__, __LINE__);
|
||||
});
|
||||
|
||||
// now we either have a ditch or not
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "RestServer/TransactionManagerFeature.h"
|
||||
#include "MMFiles/MMFilesDatafileHelper.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/MMFilesCollection.h" //TODO -- REMOVE
|
||||
#include "Transaction/Helpers.h"
|
||||
#include "Transaction/Methods.h"
|
||||
#include "Utils/CollectionNameResolver.h"
|
||||
|
@ -127,7 +128,7 @@ DocumentDitch* TransactionContext::orderDitch(LogicalCollection* collection) {
|
|||
}
|
||||
|
||||
// this method will not throw, but may return a nullptr
|
||||
auto ditch = collection->ditches()->createDocumentDitch(true, __FILE__, __LINE__);
|
||||
auto ditch = toMMFilesCollection(collection)->ditches()->createDocumentDitch(true, __FILE__, __LINE__);
|
||||
|
||||
if (ditch != nullptr) {
|
||||
try {
|
||||
|
|
|
@ -643,10 +643,6 @@ std::unique_ptr<FollowerInfo> const& LogicalCollection::followers() const {
|
|||
|
||||
void LogicalCollection::setDeleted(bool newValue) { _isDeleted = newValue; }
|
||||
|
||||
Ditches* LogicalCollection::ditches() const {
|
||||
return getPhysical()->ditches();
|
||||
}
|
||||
|
||||
// SECTION: Key Options
|
||||
VPackSlice LogicalCollection::keyOptions() const {
|
||||
if (_keyOptions == nullptr) {
|
||||
|
|
|
@ -171,8 +171,6 @@ class LogicalCollection {
|
|||
|
||||
void setDeleted(bool);
|
||||
|
||||
Ditches* ditches() const;
|
||||
|
||||
// SECTION: Key Options
|
||||
velocypack::Slice keyOptions() const;
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace transaction {
|
|||
class Methods;
|
||||
}
|
||||
|
||||
class Ditches;
|
||||
struct DocumentIdentifierToken;
|
||||
class Index;
|
||||
class LogicalCollection;
|
||||
|
@ -51,8 +50,6 @@ class PhysicalCollection {
|
|||
public:
|
||||
virtual ~PhysicalCollection() = default;
|
||||
|
||||
virtual Ditches* ditches() const = 0;
|
||||
|
||||
//path to logical collection
|
||||
virtual std::string const& path() const = 0;
|
||||
virtual void setPath(std::string const&) = 0; // should be set during collection creation
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/MMFilesWalLogfile.h"
|
||||
#include "MMFiles/MMFilesWalMarker.h"
|
||||
#include "MMFiles/MMFilesCollection.h" //TODO -- REMOVE
|
||||
#include "VocBase/CompactionLocker.h"
|
||||
#include "VocBase/Ditch.h"
|
||||
#include "VocBase/LogicalCollection.h"
|
||||
|
@ -611,8 +612,9 @@ int TRI_DumpCollectionReplication(TRI_replication_dump_t* dump,
|
|||
auto customTypeHandler = dump->_transactionContext->orderCustomTypeHandler();
|
||||
dump->_vpackOptions.customTypeHandler = customTypeHandler.get();
|
||||
|
||||
auto mmfiles = toMMFilesCollection(collection);
|
||||
// create a barrier so the underlying collection is not unloaded
|
||||
auto b = collection->ditches()->createReplicationDitch(__FILE__, __LINE__);
|
||||
auto b = mmfiles->ditches()->createReplicationDitch(__FILE__, __LINE__);
|
||||
|
||||
if (b == nullptr) {
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -634,7 +636,7 @@ int TRI_DumpCollectionReplication(TRI_replication_dump_t* dump,
|
|||
}
|
||||
|
||||
// always execute this
|
||||
collection->ditches()->freeDitch(b);
|
||||
mmfiles->ditches()->freeDitch(b);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "Basics/tri-strings.h"
|
||||
#include "Logger/Logger.h"
|
||||
#include "MMFiles/MMFilesLogfileManager.h"
|
||||
#include "MMFiles/MMFilesCollection.h" // TODO - REMOVE
|
||||
#include "RestServer/DatabaseFeature.h"
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "StorageEngine/StorageEngine.h"
|
||||
|
@ -199,7 +200,7 @@ bool TRI_vocbase_t::UnloadCollectionCallback(LogicalCollection* collection) {
|
|||
return false;
|
||||
}
|
||||
|
||||
auto ditches = collection->ditches();
|
||||
auto ditches = toMMFilesCollection(collection)->ditches();
|
||||
|
||||
if (ditches->contains(arangodb::Ditch::TRI_DITCH_DOCUMENT) ||
|
||||
ditches->contains(arangodb::Ditch::TRI_DITCH_REPLICATION) ||
|
||||
|
@ -363,7 +364,7 @@ int TRI_vocbase_t::loadCollection(arangodb::LogicalCollection* collection,
|
|||
// release the WRITE lock and try again
|
||||
if (collection->status() == TRI_VOC_COL_STATUS_UNLOADING) {
|
||||
// check if there is a deferred drop action going on for this collection
|
||||
if (collection->ditches()->contains(
|
||||
if (toMMFilesCollection(collection)->ditches()->contains(
|
||||
arangodb::Ditch::TRI_DITCH_COLLECTION_DROP)) {
|
||||
// drop call going on, we must abort
|
||||
locker.unlock();
|
||||
|
@ -899,7 +900,7 @@ int TRI_vocbase_t::unloadCollection(arangodb::LogicalCollection* collection, boo
|
|||
collection->setStatus(TRI_VOC_COL_STATUS_UNLOADING);
|
||||
|
||||
// add callback for unload
|
||||
collection->ditches()->createUnloadCollectionDitch(
|
||||
toMMFilesCollection(collection)->ditches()->createUnloadCollectionDitch(
|
||||
collection, UnloadCollectionCallback, __FILE__,
|
||||
__LINE__);
|
||||
} // release locks
|
||||
|
@ -938,7 +939,7 @@ int TRI_vocbase_t::dropCollection(arangodb::LogicalCollection* collection, bool
|
|||
DropCollectionCallback(collection);
|
||||
} else {
|
||||
// add callback for dropping
|
||||
collection->ditches()->createDropCollectionDitch(
|
||||
toMMFilesCollection(collection)->ditches()->createDropCollectionDitch(
|
||||
collection, DropCollectionCallback,
|
||||
__FILE__, __LINE__);
|
||||
|
||||
|
|
Loading…
Reference in New Issue