mirror of https://gitee.com/bigwinds/arangodb
class renaming
This commit is contained in:
parent
3e0969da37
commit
6b882ca8a2
|
@ -71,9 +71,9 @@ using Helper = arangodb::basics::VelocyPackHelper;
|
|||
namespace {
|
||||
|
||||
/// @brief helper class for filling indexes
|
||||
class IndexFillerTask : public basics::LocalTask {
|
||||
class MMFilesIndexFillerTask : public basics::LocalTask {
|
||||
public:
|
||||
IndexFillerTask(
|
||||
MMFilesIndexFillerTask(
|
||||
basics::LocalTaskQueue* queue, transaction::Methods* trx,
|
||||
Index* idx,
|
||||
std::vector<std::pair<TRI_voc_rid_t, VPackSlice>> const& documents)
|
||||
|
@ -1426,8 +1426,8 @@ void MMFilesCollection::fillIndex(
|
|||
|
||||
try {
|
||||
// move task into thread pool
|
||||
std::shared_ptr<::IndexFillerTask> worker;
|
||||
worker.reset(new ::IndexFillerTask(queue, trx, idx, documents));
|
||||
std::shared_ptr<::MMFilesIndexFillerTask> worker;
|
||||
worker.reset(new ::MMFilesIndexFillerTask(queue, trx, idx, documents));
|
||||
queue->enqueue(worker);
|
||||
} catch (...) {
|
||||
// set error code
|
||||
|
|
|
@ -398,7 +398,7 @@ int MMFilesCollectorThread::collectLogfiles(bool& worked) {
|
|||
// reset collector status
|
||||
broadcastCollectorResult(res);
|
||||
|
||||
PersistentIndexFeature::syncWal();
|
||||
MMFilesPersistentIndexFeature::syncWal();
|
||||
|
||||
_logfileManager->setCollectionDone(logfile);
|
||||
} else {
|
||||
|
|
|
@ -130,19 +130,16 @@ std::string const MMFilesEngine::FeatureName("MMFilesEngine");
|
|||
MMFilesEngine::MMFilesEngine(application_features::ApplicationServer* server)
|
||||
: StorageEngine(server, EngineName, FeatureName, new MMFilesIndexFactory())
|
||||
, _isUpgrade(false)
|
||||
, _maxTick(0)
|
||||
{
|
||||
startsAfter("PersistentIndex");
|
||||
}
|
||||
|
||||
MMFilesEngine::~MMFilesEngine() {
|
||||
, _maxTick(0) {
|
||||
startsAfter("MMFilesPersistentIndex");
|
||||
}
|
||||
|
||||
MMFilesEngine::~MMFilesEngine() {}
|
||||
|
||||
// perform a physical deletion of the database
|
||||
void MMFilesEngine::dropDatabase(Database* database, int& status) {
|
||||
// delete persistent indexes for this database
|
||||
PersistentIndexFeature::dropDatabase(database->id());
|
||||
MMFilesPersistentIndexFeature::dropDatabase(database->id());
|
||||
|
||||
// To shutdown the database (which destroys all LogicalCollection
|
||||
// objects of all collections) we need to make sure that the
|
||||
|
@ -382,7 +379,7 @@ void MMFilesEngine::getDatabases(arangodb::velocypack::Builder& result) {
|
|||
// delete persistent indexes for this database
|
||||
TRI_voc_tick_t id = static_cast<TRI_voc_tick_t>(
|
||||
basics::StringUtils::uint64(idSlice.copyString()));
|
||||
PersistentIndexFeature::dropDatabase(id);
|
||||
MMFilesPersistentIndexFeature::dropDatabase(id);
|
||||
|
||||
dropDatabaseDirectory(directory);
|
||||
continue;
|
||||
|
@ -737,7 +734,7 @@ void MMFilesEngine::dropCollection(TRI_vocbase_t* vocbase, arangodb::LogicalColl
|
|||
unregisterCollectionPath(vocbase->id(), collection->cid());
|
||||
|
||||
// delete persistent indexes
|
||||
PersistentIndexFeature::dropCollection(vocbase->id(), collection->cid());
|
||||
MMFilesPersistentIndexFeature::dropCollection(vocbase->id(), collection->cid());
|
||||
|
||||
// rename collection directory
|
||||
if (physical->path().empty()) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
using namespace arangodb;
|
||||
|
||||
LookupBuilder::LookupBuilder(
|
||||
MMFilesHashIndexLookupBuilder::MMFilesHashIndexLookupBuilder(
|
||||
transaction::Methods* trx, arangodb::aql::AstNode const* node,
|
||||
arangodb::aql::Variable const* reference,
|
||||
std::vector<std::vector<arangodb::basics::AttributeName>> const& fields)
|
||||
|
@ -138,9 +138,9 @@ LookupBuilder::LookupBuilder(
|
|||
buildNextSearchValue();
|
||||
}
|
||||
|
||||
VPackSlice LookupBuilder::lookup() { return _builder->slice(); }
|
||||
VPackSlice MMFilesHashIndexLookupBuilder::lookup() { return _builder->slice(); }
|
||||
|
||||
bool LookupBuilder::hasAndGetNext() {
|
||||
bool MMFilesHashIndexLookupBuilder::hasAndGetNext() {
|
||||
_builder->clear();
|
||||
if (!_usesIn || _isEmpty) {
|
||||
return false;
|
||||
|
@ -152,7 +152,7 @@ bool LookupBuilder::hasAndGetNext() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void LookupBuilder::reset() {
|
||||
void MMFilesHashIndexLookupBuilder::reset() {
|
||||
if (_isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void LookupBuilder::reset() {
|
|||
buildNextSearchValue();
|
||||
}
|
||||
|
||||
bool LookupBuilder::incrementInPosition() {
|
||||
bool MMFilesHashIndexLookupBuilder::incrementInPosition() {
|
||||
size_t i = _coveredFields - 1;
|
||||
while (true) {
|
||||
auto it = _inPosition.find(i);
|
||||
|
@ -185,7 +185,7 @@ bool LookupBuilder::incrementInPosition() {
|
|||
}
|
||||
}
|
||||
|
||||
void LookupBuilder::buildNextSearchValue() {
|
||||
void MMFilesHashIndexLookupBuilder::buildNextSearchValue() {
|
||||
if (_isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class LocalTaskQueue;
|
|||
class MMFilesHashIndex;
|
||||
|
||||
/// @brief Class to build Slice lookups out of AST Conditions
|
||||
class LookupBuilder {
|
||||
class MMFilesHashIndexLookupBuilder {
|
||||
private:
|
||||
transaction::BuilderLeaser _builder;
|
||||
bool _usesIn;
|
||||
|
@ -64,7 +64,7 @@ class LookupBuilder {
|
|||
transaction::BuilderLeaser _inStorage;
|
||||
|
||||
public:
|
||||
LookupBuilder(
|
||||
MMFilesHashIndexLookupBuilder(
|
||||
transaction::Methods*, arangodb::aql::AstNode const*,
|
||||
arangodb::aql::Variable const*,
|
||||
std::vector<std::vector<arangodb::basics::AttributeName>> const&);
|
||||
|
@ -100,7 +100,7 @@ class MMFilesHashIndexIterator final : public IndexIterator {
|
|||
|
||||
private:
|
||||
MMFilesHashIndex const* _index;
|
||||
LookupBuilder _lookups;
|
||||
MMFilesHashIndexLookupBuilder _lookups;
|
||||
std::vector<MMFilesHashIndexElement*> _buffer;
|
||||
size_t _posInBuffer;
|
||||
};
|
||||
|
|
|
@ -421,7 +421,7 @@ std::shared_ptr<Index> MMFilesIndexFactory::prepareIndexFromSlice(
|
|||
break;
|
||||
}
|
||||
case arangodb::Index::TRI_IDX_TYPE_ROCKSDB_INDEX: {
|
||||
newIdx.reset(new arangodb::PersistentIndex(iid, col, info));
|
||||
newIdx.reset(new arangodb::MMFilesPersistentIndex(iid, col, info));
|
||||
break;
|
||||
}
|
||||
case arangodb::Index::TRI_IDX_TYPE_FULLTEXT_INDEX: {
|
||||
|
|
|
@ -86,10 +86,10 @@ static size_t sortWeight(arangodb::aql::AstNode const* node) {
|
|||
// lists: lexicographically and within each slot according to these rules.
|
||||
// ...........................................................................
|
||||
|
||||
PersistentIndexIterator::PersistentIndexIterator(LogicalCollection* collection,
|
||||
MMFilesPersistentIndexIterator::MMFilesPersistentIndexIterator(LogicalCollection* collection,
|
||||
transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
arangodb::PersistentIndex const* index,
|
||||
arangodb::MMFilesPersistentIndex const* index,
|
||||
arangodb::MMFilesPrimaryIndex* primaryIndex,
|
||||
rocksdb::OptimisticTransactionDB* db,
|
||||
bool reverse,
|
||||
|
@ -102,17 +102,17 @@ PersistentIndexIterator::PersistentIndexIterator(LogicalCollection* collection,
|
|||
_probe(false) {
|
||||
|
||||
TRI_idx_iid_t const id = index->id();
|
||||
std::string const prefix = PersistentIndex::buildPrefix(
|
||||
std::string const prefix = MMFilesPersistentIndex::buildPrefix(
|
||||
trx->vocbase()->id(), _primaryIndex->collection()->cid(), id);
|
||||
TRI_ASSERT(prefix.size() == PersistentIndex::keyPrefixSize());
|
||||
TRI_ASSERT(prefix.size() == MMFilesPersistentIndex::keyPrefixSize());
|
||||
|
||||
_leftEndpoint.reset(new arangodb::velocypack::Buffer<char>());
|
||||
_leftEndpoint->reserve(PersistentIndex::keyPrefixSize() + left.byteSize());
|
||||
_leftEndpoint->reserve(MMFilesPersistentIndex::keyPrefixSize() + left.byteSize());
|
||||
_leftEndpoint->append(prefix.c_str(), prefix.size());
|
||||
_leftEndpoint->append(left.startAs<char const>(), left.byteSize());
|
||||
|
||||
_rightEndpoint.reset(new arangodb::velocypack::Buffer<char>());
|
||||
_rightEndpoint->reserve(PersistentIndex::keyPrefixSize() + right.byteSize());
|
||||
_rightEndpoint->reserve(MMFilesPersistentIndex::keyPrefixSize() + right.byteSize());
|
||||
_rightEndpoint->append(prefix.c_str(), prefix.size());
|
||||
_rightEndpoint->append(right.startAs<char const>(), right.byteSize());
|
||||
|
||||
|
@ -129,7 +129,7 @@ PersistentIndexIterator::PersistentIndexIterator(LogicalCollection* collection,
|
|||
}
|
||||
|
||||
/// @brief Reset the cursor
|
||||
void PersistentIndexIterator::reset() {
|
||||
void MMFilesPersistentIndexIterator::reset() {
|
||||
if (_reverse) {
|
||||
_probe = true;
|
||||
_cursor->Seek(rocksdb::Slice(_rightEndpoint->data(), _rightEndpoint->size()));
|
||||
|
@ -141,8 +141,8 @@ void PersistentIndexIterator::reset() {
|
|||
}
|
||||
}
|
||||
|
||||
bool PersistentIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
||||
auto comparator = PersistentIndexFeature::instance()->comparator();
|
||||
bool MMFilesPersistentIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
||||
auto comparator = MMFilesPersistentIndexFeature::instance()->comparator();
|
||||
while (limit > 0) {
|
||||
if (!_cursor->Valid()) {
|
||||
// We are exhausted already, sorry
|
||||
|
@ -150,10 +150,10 @@ bool PersistentIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
|||
}
|
||||
|
||||
rocksdb::Slice key = _cursor->key();
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "cursor key: " << VPackSlice(key.data() + PersistentIndex::keyPrefixSize()).toJson();
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "cursor key: " << VPackSlice(key.data() + MMFilesPersistentIndex::keyPrefixSize()).toJson();
|
||||
|
||||
int res = comparator->Compare(key, rocksdb::Slice(_leftEndpoint->data(), _leftEndpoint->size()));
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "comparing: " << VPackSlice(key.data() + PersistentIndex::keyPrefixSize()).toJson() << " with " << VPackSlice((char const*) _leftEndpoint->data() + PersistentIndex::keyPrefixSize()).toJson() << " - res: " << res;
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "comparing: " << VPackSlice(key.data() + MMFilesPersistentIndex::keyPrefixSize()).toJson() << " with " << VPackSlice((char const*) _leftEndpoint->data() + MMFilesPersistentIndex::keyPrefixSize()).toJson() << " - res: " << res;
|
||||
|
||||
if (res < 0) {
|
||||
if (_reverse) {
|
||||
|
@ -166,7 +166,7 @@ bool PersistentIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
|||
}
|
||||
|
||||
res = comparator->Compare(key, rocksdb::Slice(_rightEndpoint->data(), _rightEndpoint->size()));
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "comparing: " << VPackSlice(key.data() + PersistentIndex::keyPrefixSize()).toJson() << " with " << VPackSlice((char const*) _rightEndpoint->data() + PersistentIndex::keyPrefixSize()).toJson() << " - res: " << res;
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "comparing: " << VPackSlice(key.data() + MMFilesPersistentIndex::keyPrefixSize()).toJson() << " with " << VPackSlice((char const*) _rightEndpoint->data() + MMFilesPersistentIndex::keyPrefixSize()).toJson() << " - res: " << res;
|
||||
|
||||
|
||||
if (res <= 0) {
|
||||
|
@ -207,21 +207,21 @@ bool PersistentIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
|||
}
|
||||
|
||||
/// @brief create the index
|
||||
PersistentIndex::PersistentIndex(TRI_idx_iid_t iid,
|
||||
MMFilesPersistentIndex::MMFilesPersistentIndex(TRI_idx_iid_t iid,
|
||||
arangodb::LogicalCollection* collection,
|
||||
arangodb::velocypack::Slice const& info)
|
||||
: MMFilesPathBasedIndex(iid, collection, info, 0, true),
|
||||
_db(PersistentIndexFeature::instance()->db()) {}
|
||||
_db(MMFilesPersistentIndexFeature::instance()->db()) {}
|
||||
|
||||
/// @brief destroy the index
|
||||
PersistentIndex::~PersistentIndex() {}
|
||||
MMFilesPersistentIndex::~MMFilesPersistentIndex() {}
|
||||
|
||||
size_t PersistentIndex::memory() const {
|
||||
size_t MMFilesPersistentIndex::memory() const {
|
||||
return 0; // TODO
|
||||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void PersistentIndex::toVelocyPack(VPackBuilder& builder,
|
||||
void MMFilesPersistentIndex::toVelocyPack(VPackBuilder& builder,
|
||||
bool withFigures) const {
|
||||
Index::toVelocyPack(builder, withFigures);
|
||||
builder.add("unique", VPackValue(_unique));
|
||||
|
@ -229,15 +229,15 @@ void PersistentIndex::toVelocyPack(VPackBuilder& builder,
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index figures
|
||||
void PersistentIndex::toVelocyPackFigures(VPackBuilder& builder) const {
|
||||
void MMFilesPersistentIndex::toVelocyPackFigures(VPackBuilder& builder) const {
|
||||
TRI_ASSERT(builder.isOpenObject());
|
||||
builder.add("memory", VPackValue(memory()));
|
||||
}
|
||||
|
||||
/// @brief inserts a document into the index
|
||||
int PersistentIndex::insert(transaction::Methods* trx, TRI_voc_rid_t revisionId,
|
||||
int MMFilesPersistentIndex::insert(transaction::Methods* trx, TRI_voc_rid_t revisionId,
|
||||
VPackSlice const& doc, bool isRollback) {
|
||||
auto comparator = PersistentIndexFeature::instance()->comparator();
|
||||
auto comparator = MMFilesPersistentIndexFeature::instance()->comparator();
|
||||
std::vector<MMFilesSkiplistIndexElement*> elements;
|
||||
|
||||
int res;
|
||||
|
@ -394,7 +394,7 @@ int PersistentIndex::insert(transaction::Methods* trx, TRI_voc_rid_t revisionId,
|
|||
}
|
||||
|
||||
/// @brief removes a document from the index
|
||||
int PersistentIndex::remove(transaction::Methods* trx, TRI_voc_rid_t revisionId,
|
||||
int MMFilesPersistentIndex::remove(transaction::Methods* trx, TRI_voc_rid_t revisionId,
|
||||
VPackSlice const& doc, bool isRollback) {
|
||||
std::vector<MMFilesSkiplistIndexElement*> elements;
|
||||
|
||||
|
@ -460,21 +460,21 @@ int PersistentIndex::remove(transaction::Methods* trx, TRI_voc_rid_t revisionId,
|
|||
return res;
|
||||
}
|
||||
|
||||
int PersistentIndex::unload() {
|
||||
int MMFilesPersistentIndex::unload() {
|
||||
// nothing to do
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
/// @brief called when the index is dropped
|
||||
int PersistentIndex::drop() {
|
||||
return PersistentIndexFeature::instance()->dropIndex(_collection->vocbase()->id(),
|
||||
int MMFilesPersistentIndex::drop() {
|
||||
return MMFilesPersistentIndexFeature::instance()->dropIndex(_collection->vocbase()->id(),
|
||||
_collection->cid(), _iid);
|
||||
}
|
||||
|
||||
/// @brief attempts to locate an entry in the index
|
||||
/// Warning: who ever calls this function is responsible for destroying
|
||||
/// the PersistentIndexIterator* results
|
||||
PersistentIndexIterator* PersistentIndex::lookup(transaction::Methods* trx,
|
||||
/// the MMFilesPersistentIndexIterator* results
|
||||
MMFilesPersistentIndexIterator* MMFilesPersistentIndex::lookup(transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
VPackSlice const searchValues,
|
||||
bool reverse) const {
|
||||
|
@ -573,17 +573,17 @@ PersistentIndexIterator* PersistentIndex::lookup(transaction::Methods* trx,
|
|||
// Same for the iterator
|
||||
auto physical = static_cast<MMFilesCollection*>(_collection->getPhysical());
|
||||
auto idx = physical->primaryIndex();
|
||||
return new PersistentIndexIterator(_collection, trx, mmdr, this, idx, _db, reverse, leftBorder, rightBorder);
|
||||
return new MMFilesPersistentIndexIterator(_collection, trx, mmdr, this, idx, _db, reverse, leftBorder, rightBorder);
|
||||
}
|
||||
|
||||
bool PersistentIndex::accessFitsIndex(
|
||||
bool MMFilesPersistentIndex::accessFitsIndex(
|
||||
arangodb::aql::AstNode const* access, arangodb::aql::AstNode const* other,
|
||||
arangodb::aql::AstNode const* op, arangodb::aql::Variable const* reference,
|
||||
std::unordered_map<size_t, std::vector<arangodb::aql::AstNode const*>>&
|
||||
found,
|
||||
std::unordered_set<std::string>& nonNullAttributes,
|
||||
bool isExecution) const {
|
||||
if (!this->canUseConditionPart(access, other, op, reference, nonNullAttributes, isExecution)) {
|
||||
if (!canUseConditionPart(access, other, op, reference, nonNullAttributes, isExecution)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -674,7 +674,7 @@ bool PersistentIndex::accessFitsIndex(
|
|||
return false;
|
||||
}
|
||||
|
||||
void PersistentIndex::matchAttributes(
|
||||
void MMFilesPersistentIndex::matchAttributes(
|
||||
arangodb::aql::AstNode const* node,
|
||||
arangodb::aql::Variable const* reference,
|
||||
std::unordered_map<size_t, std::vector<arangodb::aql::AstNode const*>>&
|
||||
|
@ -716,7 +716,7 @@ void PersistentIndex::matchAttributes(
|
|||
}
|
||||
}
|
||||
|
||||
bool PersistentIndex::supportsFilterCondition(
|
||||
bool MMFilesPersistentIndex::supportsFilterCondition(
|
||||
arangodb::aql::AstNode const* node,
|
||||
arangodb::aql::Variable const* reference, size_t itemsInIndex,
|
||||
size_t& estimatedItems, double& estimatedCost) const {
|
||||
|
@ -816,7 +816,7 @@ bool PersistentIndex::supportsFilterCondition(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PersistentIndex::supportsSortCondition(
|
||||
bool MMFilesPersistentIndex::supportsSortCondition(
|
||||
arangodb::aql::SortCondition const* sortCondition,
|
||||
arangodb::aql::Variable const* reference, size_t itemsInIndex,
|
||||
double& estimatedCost, size_t& coveredAttributes) const {
|
||||
|
@ -862,7 +862,7 @@ bool PersistentIndex::supportsSortCondition(
|
|||
return false;
|
||||
}
|
||||
|
||||
IndexIterator* PersistentIndex::iteratorForCondition(
|
||||
IndexIterator* MMFilesPersistentIndex::iteratorForCondition(
|
||||
transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
arangodb::aql::AstNode const* node,
|
||||
|
@ -1054,7 +1054,7 @@ IndexIterator* PersistentIndex::iteratorForCondition(
|
|||
}
|
||||
|
||||
/// @brief specializes the condition for use with the index
|
||||
arangodb::aql::AstNode* PersistentIndex::specializeCondition(
|
||||
arangodb::aql::AstNode* MMFilesPersistentIndex::specializeCondition(
|
||||
arangodb::aql::AstNode* node,
|
||||
arangodb::aql::Variable const* reference) const {
|
||||
std::unordered_map<size_t, std::vector<arangodb::aql::AstNode const*>> found;
|
||||
|
@ -1116,7 +1116,7 @@ arangodb::aql::AstNode* PersistentIndex::specializeCondition(
|
|||
return node;
|
||||
}
|
||||
|
||||
bool PersistentIndex::isDuplicateOperator(
|
||||
bool MMFilesPersistentIndex::isDuplicateOperator(
|
||||
arangodb::aql::AstNode const* node,
|
||||
std::unordered_set<int> const& operatorsFound) const {
|
||||
auto type = node->type;
|
||||
|
|
|
@ -50,28 +50,27 @@ struct Variable;
|
|||
|
||||
class LogicalCollection;
|
||||
class MMFilesPrimaryIndex;
|
||||
class PersistentIndex;
|
||||
class MMFilesPersistentIndex;
|
||||
namespace transaction {
|
||||
class Methods;
|
||||
}
|
||||
;
|
||||
|
||||
/// @brief Iterator structure for RocksDB. We require a start and stop node
|
||||
class PersistentIndexIterator final : public IndexIterator {
|
||||
class MMFilesPersistentIndexIterator final : public IndexIterator {
|
||||
private:
|
||||
friend class PersistentIndex;
|
||||
friend class MMFilesPersistentIndex;
|
||||
|
||||
public:
|
||||
PersistentIndexIterator(LogicalCollection* collection, transaction::Methods* trx,
|
||||
MMFilesPersistentIndexIterator(LogicalCollection* collection, transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
arangodb::PersistentIndex const* index,
|
||||
arangodb::MMFilesPersistentIndex const* index,
|
||||
arangodb::MMFilesPrimaryIndex* primaryIndex,
|
||||
rocksdb::OptimisticTransactionDB* db,
|
||||
bool reverse,
|
||||
arangodb::velocypack::Slice const& left,
|
||||
arangodb::velocypack::Slice const& right);
|
||||
|
||||
~PersistentIndexIterator() = default;
|
||||
~MMFilesPersistentIndexIterator() = default;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -93,16 +92,16 @@ class PersistentIndexIterator final : public IndexIterator {
|
|||
bool _probe;
|
||||
};
|
||||
|
||||
class PersistentIndex final : public MMFilesPathBasedIndex {
|
||||
friend class PersistentIndexIterator;
|
||||
class MMFilesPersistentIndex final : public MMFilesPathBasedIndex {
|
||||
friend class MMFilesPersistentIndexIterator;
|
||||
|
||||
public:
|
||||
PersistentIndex() = delete;
|
||||
MMFilesPersistentIndex() = delete;
|
||||
|
||||
PersistentIndex(TRI_idx_iid_t, LogicalCollection*,
|
||||
MMFilesPersistentIndex(TRI_idx_iid_t, LogicalCollection*,
|
||||
arangodb::velocypack::Slice const&);
|
||||
|
||||
~PersistentIndex();
|
||||
~MMFilesPersistentIndex();
|
||||
|
||||
public:
|
||||
IndexType type() const override {
|
||||
|
@ -164,8 +163,8 @@ class PersistentIndex final : public MMFilesPathBasedIndex {
|
|||
/// @brief attempts to locate an entry in the index
|
||||
///
|
||||
/// Warning: who ever calls this function is responsible for destroying
|
||||
/// the velocypack::Slice and the PersistentIndexIterator* results
|
||||
PersistentIndexIterator* lookup(transaction::Methods*,
|
||||
/// the velocypack::Slice and the MMFilesPersistentIndexIterator* results
|
||||
MMFilesPersistentIndexIterator* lookup(transaction::Methods*,
|
||||
ManagedDocumentResult* mmdr,
|
||||
arangodb::velocypack::Slice const,
|
||||
bool reverse) const;
|
||||
|
|
|
@ -50,11 +50,11 @@ using namespace arangodb;
|
|||
using namespace arangodb::application_features;
|
||||
using namespace arangodb::options;
|
||||
|
||||
static PersistentIndexFeature* Instance = nullptr;
|
||||
static MMFilesPersistentIndexFeature* Instance = nullptr;
|
||||
|
||||
PersistentIndexFeature::PersistentIndexFeature(
|
||||
MMFilesPersistentIndexFeature::MMFilesPersistentIndexFeature(
|
||||
application_features::ApplicationServer* server)
|
||||
: application_features::ApplicationFeature(server, "PersistentIndex"),
|
||||
: application_features::ApplicationFeature(server, "MMFilesPersistentIndex"),
|
||||
_db(nullptr), _comparator(nullptr), _path(), _active(true),
|
||||
_writeBufferSize(0), _maxWriteBufferNumber(2),
|
||||
_delayedWriteRate(2 * 1024 * 1024), _minWriteBufferNumberToMerge(1),
|
||||
|
@ -69,7 +69,7 @@ PersistentIndexFeature::PersistentIndexFeature(
|
|||
startsAfter("DatabasePath");
|
||||
}
|
||||
|
||||
PersistentIndexFeature::~PersistentIndexFeature() {
|
||||
MMFilesPersistentIndexFeature::~MMFilesPersistentIndexFeature() {
|
||||
try {
|
||||
delete _db;
|
||||
} catch (...) {
|
||||
|
@ -80,7 +80,7 @@ PersistentIndexFeature::~PersistentIndexFeature() {
|
|||
}
|
||||
}
|
||||
|
||||
void PersistentIndexFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
void MMFilesPersistentIndexFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
options->addSection("rocksdb", "Configure the RocksDB engine");
|
||||
|
||||
options->addOption(
|
||||
|
@ -175,7 +175,7 @@ void PersistentIndexFeature::collectOptions(std::shared_ptr<ProgramOptions> opti
|
|||
new UInt64Parameter(&_compactionReadaheadSize));
|
||||
}
|
||||
|
||||
void PersistentIndexFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
void MMFilesPersistentIndexFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
if (!_active) {
|
||||
forceDisable();
|
||||
} else {
|
||||
|
@ -201,7 +201,7 @@ void PersistentIndexFeature::validateOptions(std::shared_ptr<ProgramOptions> opt
|
|||
}
|
||||
}
|
||||
|
||||
void PersistentIndexFeature::start() {
|
||||
void MMFilesPersistentIndexFeature::start() {
|
||||
Instance = this;
|
||||
|
||||
if (!isEnabled()) {
|
||||
|
@ -214,7 +214,7 @@ void PersistentIndexFeature::start() {
|
|||
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "initializing rocksdb, path: " << _path;
|
||||
|
||||
_comparator = new RocksDBKeyComparator();
|
||||
_comparator = new MMFilesPersistentIndexKeyComparator();
|
||||
|
||||
rocksdb::BlockBasedTableOptions tableOptions;
|
||||
tableOptions.cache_index_and_filter_blocks = true;
|
||||
|
@ -222,7 +222,7 @@ void PersistentIndexFeature::start() {
|
|||
|
||||
// TODO: using the prefix extractor will lead to the comparator being
|
||||
// called with just the key prefix (which the comparator currently cannot handle)
|
||||
// _options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(PersistentIndex::minimalPrefixSize()));
|
||||
// _options.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(MMFilesPersistentIndex::minimalPrefixSize()));
|
||||
// _options.table_factory.reset(rocksdb::NewBlockBasedTableFactory(tableOptions));
|
||||
|
||||
_options.create_if_missing = true;
|
||||
|
@ -264,7 +264,7 @@ void PersistentIndexFeature::start() {
|
|||
}
|
||||
}
|
||||
|
||||
void PersistentIndexFeature::unprepare() {
|
||||
void MMFilesPersistentIndexFeature::unprepare() {
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -283,11 +283,11 @@ void PersistentIndexFeature::unprepare() {
|
|||
syncWal();
|
||||
}
|
||||
|
||||
PersistentIndexFeature* PersistentIndexFeature::instance() {
|
||||
MMFilesPersistentIndexFeature* MMFilesPersistentIndexFeature::instance() {
|
||||
return Instance;
|
||||
}
|
||||
|
||||
int PersistentIndexFeature::syncWal() {
|
||||
int MMFilesPersistentIndexFeature::syncWal() {
|
||||
#ifndef _WIN32
|
||||
// SyncWAL() always reports a "not implemented" error on Windows
|
||||
if (Instance == nullptr || !Instance->isEnabled()) {
|
||||
|
@ -306,31 +306,31 @@ int PersistentIndexFeature::syncWal() {
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int PersistentIndexFeature::dropDatabase(TRI_voc_tick_t databaseId) {
|
||||
int MMFilesPersistentIndexFeature::dropDatabase(TRI_voc_tick_t databaseId) {
|
||||
if (Instance == nullptr) {
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "dropping RocksDB database: " << databaseId;
|
||||
return Instance->dropPrefix(PersistentIndex::buildPrefix(databaseId));
|
||||
return Instance->dropPrefix(MMFilesPersistentIndex::buildPrefix(databaseId));
|
||||
}
|
||||
|
||||
int PersistentIndexFeature::dropCollection(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
|
||||
int MMFilesPersistentIndexFeature::dropCollection(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
|
||||
if (Instance == nullptr) {
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "dropping RocksDB database: " << databaseId << ", collection: " << collectionId;
|
||||
return Instance->dropPrefix(PersistentIndex::buildPrefix(databaseId, collectionId));
|
||||
return Instance->dropPrefix(MMFilesPersistentIndex::buildPrefix(databaseId, collectionId));
|
||||
}
|
||||
|
||||
int PersistentIndexFeature::dropIndex(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId, TRI_idx_iid_t indexId) {
|
||||
int MMFilesPersistentIndexFeature::dropIndex(TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId, TRI_idx_iid_t indexId) {
|
||||
if (Instance == nullptr) {
|
||||
return TRI_ERROR_INTERNAL;
|
||||
}
|
||||
// LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "dropping RocksDB database: " << databaseId << ", collection: " << collectionId << ", index: " << indexId;
|
||||
return Instance->dropPrefix(PersistentIndex::buildPrefix(databaseId, collectionId, indexId));
|
||||
return Instance->dropPrefix(MMFilesPersistentIndex::buildPrefix(databaseId, collectionId, indexId));
|
||||
}
|
||||
|
||||
int PersistentIndexFeature::dropPrefix(std::string const& prefix) {
|
||||
int MMFilesPersistentIndexFeature::dropPrefix(std::string const& prefix) {
|
||||
if (!isEnabled()) {
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ int PersistentIndexFeature::dropPrefix(std::string const& prefix) {
|
|||
l.reserve(prefix.size() + builder.slice().byteSize());
|
||||
l.append(prefix);
|
||||
// extend the prefix to at least 24 bytes
|
||||
while (l.size() < PersistentIndex::keyPrefixSize()) {
|
||||
while (l.size() < MMFilesPersistentIndex::keyPrefixSize()) {
|
||||
uint64_t value = 0;
|
||||
l.append(reinterpret_cast<char const*>(&value), sizeof(uint64_t));
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ int PersistentIndexFeature::dropPrefix(std::string const& prefix) {
|
|||
u.reserve(prefix.size() + builder.slice().byteSize());
|
||||
u.append(prefix);
|
||||
// extend the prefix to at least 24 bytes
|
||||
while (u.size() < PersistentIndex::keyPrefixSize()) {
|
||||
while (u.size() < MMFilesPersistentIndex::keyPrefixSize()) {
|
||||
uint64_t value = UINT64_MAX;
|
||||
u.append(reinterpret_cast<char const*>(&value), sizeof(uint64_t));
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ int PersistentIndexFeature::dropPrefix(std::string const& prefix) {
|
|||
}
|
||||
}
|
||||
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "dropping RocksDB range: " << VPackSlice(l.c_str() + PersistentIndex::keyPrefixSize()).toJson() << " - " << VPackSlice(u.c_str() + PersistentIndex::keyPrefixSize()).toJson();
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "dropping RocksDB range: " << VPackSlice(l.c_str() + MMFilesPersistentIndex::keyPrefixSize()).toJson() << " - " << VPackSlice(u.c_str() + MMFilesPersistentIndex::keyPrefixSize()).toJson();
|
||||
#endif
|
||||
|
||||
// delete files in range lower..upper
|
||||
|
@ -401,7 +401,7 @@ int PersistentIndexFeature::dropPrefix(std::string const& prefix) {
|
|||
// go on and delete the remaining keys (delete files in range does not necessarily
|
||||
// find them all, just complete files)
|
||||
|
||||
auto comparator = PersistentIndexFeature::instance()->comparator();
|
||||
auto comparator = MMFilesPersistentIndexFeature::instance()->comparator();
|
||||
rocksdb::DB* db = _db->GetBaseDB();
|
||||
|
||||
rocksdb::WriteBatch batch;
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_INDEXES_ROCKS_DB_FEATURE_H
|
||||
#define ARANGOD_INDEXES_ROCKS_DB_FEATURE_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_PERSISTENT_INDEX_FEATURE_H
|
||||
#define ARANGOD_MMFILES_MMFILES_PERSISTENT_INDEX_FEATURE_H 1
|
||||
|
||||
#include "ApplicationFeatures/ApplicationFeature.h"
|
||||
#include "Basics/Common.h"
|
||||
|
@ -35,12 +35,12 @@ class OptimisticTransactionDB;
|
|||
}
|
||||
|
||||
namespace arangodb {
|
||||
class RocksDBKeyComparator;
|
||||
class MMFilesPersistentIndexKeyComparator;
|
||||
|
||||
class PersistentIndexFeature final : public application_features::ApplicationFeature {
|
||||
class MMFilesPersistentIndexFeature final : public application_features::ApplicationFeature {
|
||||
public:
|
||||
explicit PersistentIndexFeature(application_features::ApplicationServer* server);
|
||||
~PersistentIndexFeature();
|
||||
explicit MMFilesPersistentIndexFeature(application_features::ApplicationServer* server);
|
||||
~MMFilesPersistentIndexFeature();
|
||||
|
||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
|
@ -48,14 +48,14 @@ class PersistentIndexFeature final : public application_features::ApplicationFea
|
|||
void unprepare() override final;
|
||||
|
||||
inline rocksdb::OptimisticTransactionDB* db() const { return _db; }
|
||||
inline RocksDBKeyComparator* comparator() const { return _comparator; }
|
||||
inline MMFilesPersistentIndexKeyComparator* comparator() const { return _comparator; }
|
||||
|
||||
static int syncWal();
|
||||
static int dropDatabase(TRI_voc_tick_t);
|
||||
static int dropCollection(TRI_voc_tick_t, TRI_voc_cid_t);
|
||||
static int dropIndex(TRI_voc_tick_t, TRI_voc_cid_t, TRI_idx_iid_t);
|
||||
|
||||
static PersistentIndexFeature* instance();
|
||||
static MMFilesPersistentIndexFeature* instance();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -65,7 +65,7 @@ class PersistentIndexFeature final : public application_features::ApplicationFea
|
|||
|
||||
rocksdb::OptimisticTransactionDB* _db;
|
||||
rocksdb::Options _options;
|
||||
RocksDBKeyComparator* _comparator;
|
||||
MMFilesPersistentIndexKeyComparator* _comparator;
|
||||
std::string _path;
|
||||
bool _active;
|
||||
uint64_t _writeBufferSize;
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
|
||||
using namespace arangodb;
|
||||
|
||||
int RocksDBKeyComparator::Compare(rocksdb::Slice const& lhs, rocksdb::Slice const& rhs) const {
|
||||
int MMFilesPersistentIndexKeyComparator::Compare(rocksdb::Slice const& lhs, rocksdb::Slice const& rhs) const {
|
||||
TRI_ASSERT(lhs.size() > 8);
|
||||
TRI_ASSERT(rhs.size() > 8);
|
||||
|
||||
// compare by index id first
|
||||
int res = memcmp(lhs.data(), rhs.data(), PersistentIndex::keyPrefixSize());
|
||||
int res = memcmp(lhs.data(), rhs.data(), MMFilesPersistentIndex::keyPrefixSize());
|
||||
|
||||
if (res != 0) {
|
||||
return res;
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_INDEXES_ROCKS_DB_KEY_COMPARATOR_H
|
||||
#define ARANGOD_INDEXES_ROCKS_DB_KEY_COMPARATOR_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_PERSISTENT_INDEX_KEY_COMPARATOR_H
|
||||
#define ARANGOD_MMFILES_MMFILES_PERSISTENT_INDEX_KEY_COMPARATOR_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
#include "MMFiles/MMFilesPersistentIndex.h"
|
||||
|
@ -34,13 +34,13 @@
|
|||
|
||||
namespace arangodb {
|
||||
|
||||
class RocksDBKeyComparator : public rocksdb::Comparator {
|
||||
class MMFilesPersistentIndexKeyComparator final : public rocksdb::Comparator {
|
||||
public:
|
||||
RocksDBKeyComparator() = default;
|
||||
~RocksDBKeyComparator() = default;
|
||||
MMFilesPersistentIndexKeyComparator() = default;
|
||||
~MMFilesPersistentIndexKeyComparator() = default;
|
||||
|
||||
static inline arangodb::velocypack::Slice extractKeySlice(rocksdb::Slice const& slice) {
|
||||
return arangodb::velocypack::Slice(slice.data() + PersistentIndex::keyPrefixSize());
|
||||
return arangodb::velocypack::Slice(slice.data() + MMFilesPersistentIndex::keyPrefixSize());
|
||||
}
|
||||
|
||||
int Compare(rocksdb::Slice const& lhs, rocksdb::Slice const& rhs) const;
|
||||
|
|
|
@ -128,7 +128,7 @@ bool MMFilesPrimaryIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
|||
|
||||
void MMFilesPrimaryIndexIterator::reset() { _iterator.reset(); }
|
||||
|
||||
AllIndexIterator::AllIndexIterator(LogicalCollection* collection,
|
||||
MMFilesAllIndexIterator::MMFilesAllIndexIterator(LogicalCollection* collection,
|
||||
transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
MMFilesPrimaryIndex const* index,
|
||||
|
@ -136,7 +136,7 @@ AllIndexIterator::AllIndexIterator(LogicalCollection* collection,
|
|||
bool reverse)
|
||||
: IndexIterator(collection, trx, mmdr, index), _index(indexImpl), _reverse(reverse), _total(0) {}
|
||||
|
||||
bool AllIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
||||
bool MMFilesAllIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
||||
while (limit > 0) {
|
||||
MMFilesSimpleIndexElement element;
|
||||
if (_reverse) {
|
||||
|
@ -154,15 +154,15 @@ bool AllIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void AllIndexIterator::reset() { _position.reset(); }
|
||||
void MMFilesAllIndexIterator::reset() { _position.reset(); }
|
||||
|
||||
AnyIndexIterator::AnyIndexIterator(LogicalCollection* collection, transaction::Methods* trx,
|
||||
MMFilesAnyIndexIterator::MMFilesAnyIndexIterator(LogicalCollection* collection, transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
MMFilesPrimaryIndex const* index,
|
||||
MMFilesPrimaryIndexImpl const* indexImpl)
|
||||
: IndexIterator(collection, trx, mmdr, index), _index(indexImpl), _step(0), _total(0) {}
|
||||
|
||||
bool AnyIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
||||
bool MMFilesAnyIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
||||
while (limit > 0) {
|
||||
MMFilesSimpleIndexElement element =
|
||||
_index->findRandom(&_context, _initial, _position, _step, _total);
|
||||
|
@ -176,7 +176,7 @@ bool AnyIndexIterator::next(TokenCallback const& cb, size_t limit) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void AnyIndexIterator::reset() {
|
||||
void MMFilesAnyIndexIterator::reset() {
|
||||
_step = 0;
|
||||
_total = 0;
|
||||
_position = _initial;
|
||||
|
@ -313,7 +313,7 @@ MMFilesSimpleIndexElement MMFilesPrimaryIndex::lookupSequential(
|
|||
IndexIterator* MMFilesPrimaryIndex::allIterator(transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
bool reverse) const {
|
||||
return new AllIndexIterator(_collection, trx, mmdr, this, _primaryIndex, reverse);
|
||||
return new MMFilesAllIndexIterator(_collection, trx, mmdr, this, _primaryIndex, reverse);
|
||||
}
|
||||
|
||||
/// @brief request an iterator over all elements in the index in
|
||||
|
@ -321,7 +321,7 @@ IndexIterator* MMFilesPrimaryIndex::allIterator(transaction::Methods* trx,
|
|||
/// exactly once unless the collection is modified.
|
||||
IndexIterator* MMFilesPrimaryIndex::anyIterator(transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr) const {
|
||||
return new AnyIndexIterator(_collection, trx, mmdr, this, _primaryIndex);
|
||||
return new MMFilesAnyIndexIterator(_collection, trx, mmdr, this, _primaryIndex);
|
||||
}
|
||||
|
||||
/// @brief a method to iterate over all elements in the index in
|
||||
|
|
|
@ -68,16 +68,16 @@ class MMFilesPrimaryIndexIterator final : public IndexIterator {
|
|||
arangodb::velocypack::ArrayIterator _iterator;
|
||||
};
|
||||
|
||||
class AllIndexIterator final : public IndexIterator {
|
||||
class MMFilesAllIndexIterator final : public IndexIterator {
|
||||
public:
|
||||
AllIndexIterator(LogicalCollection* collection,
|
||||
MMFilesAllIndexIterator(LogicalCollection* collection,
|
||||
transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
MMFilesPrimaryIndex const* index,
|
||||
MMFilesPrimaryIndexImpl const* indexImpl,
|
||||
bool reverse);
|
||||
|
||||
~AllIndexIterator() {}
|
||||
~MMFilesAllIndexIterator() {}
|
||||
|
||||
char const* typeName() const override { return "all-index-iterator"; }
|
||||
|
||||
|
@ -92,14 +92,14 @@ class AllIndexIterator final : public IndexIterator {
|
|||
uint64_t _total;
|
||||
};
|
||||
|
||||
class AnyIndexIterator final : public IndexIterator {
|
||||
class MMFilesAnyIndexIterator final : public IndexIterator {
|
||||
public:
|
||||
AnyIndexIterator(LogicalCollection* collection, transaction::Methods* trx,
|
||||
MMFilesAnyIndexIterator(LogicalCollection* collection, transaction::Methods* trx,
|
||||
ManagedDocumentResult* mmdr,
|
||||
MMFilesPrimaryIndex const* index,
|
||||
MMFilesPrimaryIndexImpl const* indexImpl);
|
||||
|
||||
~AnyIndexIterator() {}
|
||||
~MMFilesAnyIndexIterator() {}
|
||||
|
||||
char const* typeName() const override { return "any-index-iterator"; }
|
||||
|
||||
|
|
|
@ -104,25 +104,25 @@ static int CompareElementElement(void* userData,
|
|||
return arangodb::basics::VelocyPackHelper::compare(l, r, true);
|
||||
}
|
||||
|
||||
bool BaseSkiplistLookupBuilder::isEquality() const { return _isEquality; }
|
||||
bool MMFilesBaseSkiplistLookupBuilder::isEquality() const { return _isEquality; }
|
||||
|
||||
VPackSlice const* BaseSkiplistLookupBuilder::getLowerLookup() const {
|
||||
VPackSlice const* MMFilesBaseSkiplistLookupBuilder::getLowerLookup() const {
|
||||
return &_lowerSlice;
|
||||
}
|
||||
|
||||
bool BaseSkiplistLookupBuilder::includeLower() const { return _includeLower; }
|
||||
bool MMFilesBaseSkiplistLookupBuilder::includeLower() const { return _includeLower; }
|
||||
|
||||
VPackSlice const* BaseSkiplistLookupBuilder::getUpperLookup() const {
|
||||
VPackSlice const* MMFilesBaseSkiplistLookupBuilder::getUpperLookup() const {
|
||||
return &_upperSlice;
|
||||
}
|
||||
|
||||
bool BaseSkiplistLookupBuilder::includeUpper() const { return _includeUpper; }
|
||||
bool MMFilesBaseSkiplistLookupBuilder::includeUpper() const { return _includeUpper; }
|
||||
|
||||
SkiplistLookupBuilder::SkiplistLookupBuilder(
|
||||
MMFilesSkiplistLookupBuilder::MMFilesSkiplistLookupBuilder(
|
||||
transaction::Methods* trx,
|
||||
std::vector<std::vector<arangodb::aql::AstNode const*>>& ops,
|
||||
arangodb::aql::Variable const* var, bool reverse)
|
||||
: BaseSkiplistLookupBuilder(trx) {
|
||||
: MMFilesBaseSkiplistLookupBuilder(trx) {
|
||||
_lowerBuilder->openArray();
|
||||
if (ops.empty()) {
|
||||
// We only use this skiplist to sort. use empty array for lookup
|
||||
|
@ -249,17 +249,17 @@ SkiplistLookupBuilder::SkiplistLookupBuilder(
|
|||
}
|
||||
}
|
||||
|
||||
bool SkiplistLookupBuilder::next() {
|
||||
bool MMFilesSkiplistLookupBuilder::next() {
|
||||
// The first search value is created during creation.
|
||||
// So next is always false.
|
||||
return false;
|
||||
}
|
||||
|
||||
SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
||||
MMFilesSkiplistInLookupBuilder::MMFilesSkiplistInLookupBuilder(
|
||||
transaction::Methods* trx,
|
||||
std::vector<std::vector<arangodb::aql::AstNode const*>>& ops,
|
||||
arangodb::aql::Variable const* var, bool reverse)
|
||||
: BaseSkiplistLookupBuilder(trx), _dataBuilder(trx), _done(false) {
|
||||
: MMFilesBaseSkiplistLookupBuilder(trx), _dataBuilder(trx), _done(false) {
|
||||
TRI_ASSERT(!ops.empty()); // We certainly do not need IN here
|
||||
transaction::BuilderLeaser tmp(trx);
|
||||
std::set<VPackSlice, arangodb::basics::VelocyPackHelper::VPackSorted<true>>
|
||||
|
@ -422,7 +422,7 @@ SkiplistInLookupBuilder::SkiplistInLookupBuilder(
|
|||
buildSearchValues();
|
||||
}
|
||||
|
||||
bool SkiplistInLookupBuilder::next() {
|
||||
bool MMFilesSkiplistInLookupBuilder::next() {
|
||||
if (_done || !forwardInPosition()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ bool SkiplistInLookupBuilder::next() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SkiplistInLookupBuilder::forwardInPosition() {
|
||||
bool MMFilesSkiplistInLookupBuilder::forwardInPosition() {
|
||||
std::list<PosStruct>::reverse_iterator it = _inPositions.rbegin();
|
||||
while (it != _inPositions.rend()) {
|
||||
it->current++;
|
||||
|
@ -448,7 +448,7 @@ bool SkiplistInLookupBuilder::forwardInPosition() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void SkiplistInLookupBuilder::buildSearchValues() {
|
||||
void MMFilesSkiplistInLookupBuilder::buildSearchValues() {
|
||||
auto inPos = _inPositions.begin();
|
||||
_lowerBuilder->clear();
|
||||
_lowerBuilder->openArray();
|
||||
|
@ -507,7 +507,7 @@ MMFilesSkiplistIterator::MMFilesSkiplistIterator(LogicalCollection* collection,
|
|||
TRI_Skiplist const* skiplist, size_t numPaths,
|
||||
std::function<int(void*, MMFilesSkiplistIndexElement const*, MMFilesSkiplistIndexElement const*,
|
||||
MMFilesSkiplistCmpType)> const& CmpElmElm,
|
||||
bool reverse, BaseSkiplistLookupBuilder* builder)
|
||||
bool reverse, MMFilesBaseSkiplistLookupBuilder* builder)
|
||||
: IndexIterator(collection, trx, mmdr, index),
|
||||
_skiplistIndex(skiplist),
|
||||
_numPaths(numPaths),
|
||||
|
@ -1235,14 +1235,14 @@ IndexIterator* MMFilesSkiplistIndex::iteratorForCondition(
|
|||
}
|
||||
|
||||
if (usesIn) {
|
||||
auto builder = std::make_unique<SkiplistInLookupBuilder>(
|
||||
auto builder = std::make_unique<MMFilesSkiplistInLookupBuilder>(
|
||||
trx, mapping, reference, reverse);
|
||||
return new MMFilesSkiplistIterator(_collection, trx, mmdr, this,
|
||||
_skiplistIndex, numPaths(), CmpElmElm,
|
||||
reverse, builder.release());
|
||||
}
|
||||
auto builder =
|
||||
std::make_unique<SkiplistLookupBuilder>(trx, mapping, reference, reverse);
|
||||
std::make_unique<MMFilesSkiplistLookupBuilder>(trx, mapping, reference, reverse);
|
||||
return new MMFilesSkiplistIterator(_collection, trx, mmdr, this,
|
||||
_skiplistIndex, numPaths(), CmpElmElm,
|
||||
reverse, builder.release());
|
||||
|
|
|
@ -47,12 +47,9 @@ class MMFilesSkiplistIndex;
|
|||
namespace transaction {
|
||||
class Methods;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/// @brief Abstract Builder for lookup values in skiplist index
|
||||
|
||||
class BaseSkiplistLookupBuilder {
|
||||
class MMFilesBaseSkiplistLookupBuilder {
|
||||
protected:
|
||||
bool _isEquality;
|
||||
bool _includeLower;
|
||||
|
@ -65,9 +62,8 @@ class BaseSkiplistLookupBuilder {
|
|||
arangodb::velocypack::Slice _upperSlice;
|
||||
|
||||
public:
|
||||
explicit BaseSkiplistLookupBuilder(transaction::Methods* trx) :
|
||||
_lowerBuilder(trx), _upperBuilder(trx)
|
||||
{
|
||||
explicit MMFilesBaseSkiplistLookupBuilder(transaction::Methods* trx) :
|
||||
_lowerBuilder(trx), _upperBuilder(trx) {
|
||||
_isEquality = true;
|
||||
_includeUpper = true;
|
||||
_includeLower = true;
|
||||
|
@ -76,7 +72,7 @@ class BaseSkiplistLookupBuilder {
|
|||
_upperBuilder->clear();
|
||||
}
|
||||
|
||||
virtual ~BaseSkiplistLookupBuilder() {};
|
||||
virtual ~MMFilesBaseSkiplistLookupBuilder() {}
|
||||
|
||||
/// @brief Compute the next lookup values
|
||||
/// If returns false there is no further lookup
|
||||
|
@ -109,15 +105,15 @@ class BaseSkiplistLookupBuilder {
|
|||
/// returned in the correct ordering. And no
|
||||
/// lookup is returned twice.
|
||||
|
||||
class SkiplistLookupBuilder : public BaseSkiplistLookupBuilder {
|
||||
class MMFilesSkiplistLookupBuilder final : public MMFilesBaseSkiplistLookupBuilder {
|
||||
|
||||
public:
|
||||
SkiplistLookupBuilder(
|
||||
MMFilesSkiplistLookupBuilder(
|
||||
transaction::Methods* trx,
|
||||
std::vector<std::vector<arangodb::aql::AstNode const*>>&,
|
||||
arangodb::aql::Variable const*, bool);
|
||||
|
||||
~SkiplistLookupBuilder() {}
|
||||
~MMFilesSkiplistLookupBuilder() {}
|
||||
|
||||
/// @brief Compute the next lookup values
|
||||
/// If returns false there is no further lookup
|
||||
|
@ -125,7 +121,7 @@ class SkiplistLookupBuilder : public BaseSkiplistLookupBuilder {
|
|||
|
||||
};
|
||||
|
||||
class SkiplistInLookupBuilder : public BaseSkiplistLookupBuilder {
|
||||
class MMFilesSkiplistInLookupBuilder final : public MMFilesBaseSkiplistLookupBuilder {
|
||||
|
||||
private:
|
||||
|
||||
|
@ -145,12 +141,12 @@ class SkiplistInLookupBuilder : public BaseSkiplistLookupBuilder {
|
|||
bool _done;
|
||||
|
||||
public:
|
||||
SkiplistInLookupBuilder(
|
||||
MMFilesSkiplistInLookupBuilder(
|
||||
transaction::Methods* trx,
|
||||
std::vector<std::vector<arangodb::aql::AstNode const*>>&,
|
||||
arangodb::aql::Variable const*, bool);
|
||||
|
||||
~SkiplistInLookupBuilder() {}
|
||||
~MMFilesSkiplistInLookupBuilder() {}
|
||||
|
||||
/// @brief Compute the next lookup values
|
||||
/// If returns false there is no further lookup
|
||||
|
@ -190,7 +186,7 @@ class MMFilesSkiplistIterator final : public IndexIterator {
|
|||
std::vector<std::pair<Node*, Node*>> _intervals;
|
||||
size_t _currentInterval;
|
||||
|
||||
BaseSkiplistLookupBuilder* _builder;
|
||||
MMFilesBaseSkiplistLookupBuilder* _builder;
|
||||
|
||||
std::function<int(void*, MMFilesSkiplistIndexElement const*, MMFilesSkiplistIndexElement const*,
|
||||
MMFilesSkiplistCmpType)> _CmpElmElm;
|
||||
|
@ -202,7 +198,7 @@ class MMFilesSkiplistIterator final : public IndexIterator {
|
|||
TRI_Skiplist const* skiplist, size_t numPaths,
|
||||
std::function<int(void*, MMFilesSkiplistIndexElement const*, MMFilesSkiplistIndexElement const*,
|
||||
MMFilesSkiplistCmpType)> const& CmpElmElm,
|
||||
bool reverse, BaseSkiplistLookupBuilder* builder);
|
||||
bool reverse, MMFilesBaseSkiplistLookupBuilder* builder);
|
||||
|
||||
~MMFilesSkiplistIterator() {
|
||||
delete _builder;
|
||||
|
|
|
@ -64,7 +64,7 @@ MMFilesTransactionState::~MMFilesTransactionState() {
|
|||
/// @brief get (or create) a rocksdb WriteTransaction
|
||||
rocksdb::Transaction* MMFilesTransactionState::rocksTransaction() {
|
||||
if (_rocksTransaction == nullptr) {
|
||||
_rocksTransaction = PersistentIndexFeature::instance()->db()->BeginTransaction(
|
||||
_rocksTransaction = MMFilesPersistentIndexFeature::instance()->db()->BeginTransaction(
|
||||
rocksdb::WriteOptions(), rocksdb::OptimisticTransactionOptions());
|
||||
}
|
||||
return _rocksTransaction;
|
||||
|
@ -278,7 +278,7 @@ int MMFilesTransactionState::addOperation(TRI_voc_rid_t revisionId,
|
|||
}
|
||||
if (localWaitForSync) {
|
||||
// also sync RocksDB WAL
|
||||
PersistentIndexFeature::syncWal();
|
||||
MMFilesPersistentIndexFeature::syncWal();
|
||||
}
|
||||
operation.setTick(slotInfo.tick);
|
||||
fid = slotInfo.logfileId;
|
||||
|
@ -473,7 +473,7 @@ int MMFilesTransactionState::writeCommitMarker() {
|
|||
|
||||
if (_waitForSync) {
|
||||
// also sync RocksDB WAL
|
||||
PersistentIndexFeature::syncWal();
|
||||
MMFilesPersistentIndexFeature::syncWal();
|
||||
}
|
||||
|
||||
TRI_IF_FAILURE("TransactionWriteCommitMarkerThrow") {
|
||||
|
|
|
@ -790,7 +790,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
|
||||
auto physical = static_cast<MMFilesCollection*>(col->getPhysical());
|
||||
TRI_ASSERT(physical != nullptr);
|
||||
PersistentIndexFeature::dropIndex(databaseId, collectionId, indexId);
|
||||
MMFilesPersistentIndexFeature::dropIndex(databaseId, collectionId, indexId);
|
||||
|
||||
std::string const indexName("index-" + std::to_string(indexId) +
|
||||
".json");
|
||||
|
@ -868,7 +868,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
vocbase->dropCollection(collection, true, false);
|
||||
}
|
||||
|
||||
PersistentIndexFeature::dropCollection(databaseId, collectionId);
|
||||
MMFilesPersistentIndexFeature::dropCollection(databaseId, collectionId);
|
||||
|
||||
// check if there is another collection with the same name as the one
|
||||
// that
|
||||
|
@ -987,7 +987,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
state->databaseFeature->dropDatabase(nameString, true, false);
|
||||
}
|
||||
|
||||
PersistentIndexFeature::dropDatabase(databaseId);
|
||||
MMFilesPersistentIndexFeature::dropDatabase(databaseId);
|
||||
|
||||
vocbase = nullptr;
|
||||
/* TODO: check what TRI_ERROR_ARANGO_DATABASE_NOT_FOUND means here
|
||||
|
@ -1052,7 +1052,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
TRI_ASSERT(physical != nullptr);
|
||||
col->dropIndex(indexId);
|
||||
|
||||
PersistentIndexFeature::dropIndex(databaseId, collectionId, indexId);
|
||||
MMFilesPersistentIndexFeature::dropIndex(databaseId, collectionId, indexId);
|
||||
|
||||
// additionally remove the index file
|
||||
std::string const indexName("index-" + std::to_string(indexId) +
|
||||
|
@ -1094,7 +1094,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
if (collection != nullptr) {
|
||||
vocbase->dropCollection(collection, true, false);
|
||||
}
|
||||
PersistentIndexFeature::dropCollection(databaseId, collectionId);
|
||||
MMFilesPersistentIndexFeature::dropCollection(databaseId, collectionId);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ bool MMFilesWalRecoverState::ReplayMarker(TRI_df_marker_t const* marker,
|
|||
state->databaseFeature->dropDatabase(databaseId, true, false);
|
||||
}
|
||||
|
||||
PersistentIndexFeature::dropDatabase(databaseId);
|
||||
MMFilesPersistentIndexFeature::dropDatabase(databaseId);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ MMFilesWalRecoveryFeature::MMFilesWalRecoveryFeature(ApplicationServer* server)
|
|||
requiresElevatedPrivileges(false);
|
||||
startsAfter("Database");
|
||||
startsAfter("MMFilesLogfileManager");
|
||||
startsAfter("PersistentIndex");
|
||||
startsAfter("MMFilesPersistentIndex");
|
||||
}
|
||||
|
||||
/// @brief run the recovery procedure
|
||||
|
|
|
@ -152,16 +152,15 @@ static int runServer(int argc, char** argv) {
|
|||
server.addFeature(new InitDatabaseFeature(&server, nonServerFeatures));
|
||||
server.addFeature(new LanguageFeature(&server));
|
||||
server.addFeature(new LockfileFeature(&server));
|
||||
server.addFeature(new MMFilesLogfileManager(&server));
|
||||
server.addFeature(new LoggerBufferFeature(&server));
|
||||
server.addFeature(new LoggerFeature(&server, true));
|
||||
server.addFeature(new MMFilesLogfileManager(&server));
|
||||
server.addFeature(new MMFilesPersistentIndexFeature(&server));
|
||||
server.addFeature(new NonceFeature(&server));
|
||||
server.addFeature(new PageSizeFeature(&server));
|
||||
server.addFeature(new PrivilegeFeature(&server));
|
||||
server.addFeature(new QueryRegistryFeature(&server));
|
||||
server.addFeature(new TraverserEngineRegistryFeature(&server));
|
||||
server.addFeature(new RandomFeature(&server));
|
||||
server.addFeature(new PersistentIndexFeature(&server));
|
||||
server.addFeature(new QueryRegistryFeature(&server));
|
||||
server.addFeature(new SchedulerFeature(&server));
|
||||
server.addFeature(new ScriptFeature(&server, &ret));
|
||||
server.addFeature(new ServerFeature(&server, &ret));
|
||||
|
@ -171,6 +170,7 @@ static int runServer(int argc, char** argv) {
|
|||
server.addFeature(new StatisticsFeature(&server));
|
||||
server.addFeature(new TempFeature(&server, name));
|
||||
server.addFeature(new TransactionManagerFeature(&server));
|
||||
server.addFeature(new TraverserEngineRegistryFeature(&server));
|
||||
server.addFeature(new UnitTestsFeature(&server, &ret));
|
||||
server.addFeature(new UpgradeFeature(&server, &ret, nonServerFeatures));
|
||||
server.addFeature(new V8DealerFeature(&server));
|
||||
|
|
Loading…
Reference in New Issue