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