From 1c43920bfcae166e3b78fb5e1bf1a4c414cad3d6 Mon Sep 17 00:00:00 2001 From: jsteemann Date: Wed, 5 Apr 2017 13:40:18 +0200 Subject: [PATCH] preparations for revision() --- arangod/MMFiles/MMFilesCollection.cpp | 4 ++++ arangod/MMFiles/MMFilesCollection.h | 3 ++- arangod/MMFiles/MMFilesTransactionCollection.cpp | 2 +- arangod/RocksDBEngine/RocksDBCollection.cpp | 4 ++-- arangod/RocksDBEngine/RocksDBCollection.h | 2 +- arangod/V8Server/v8-collection.cpp | 2 +- arangod/V8Server/v8-query.cpp | 2 +- arangod/VocBase/LogicalCollection.cpp | 4 ++-- arangod/VocBase/LogicalCollection.h | 2 +- arangod/VocBase/PhysicalCollection.h | 2 +- 10 files changed, 16 insertions(+), 11 deletions(-) diff --git a/arangod/MMFiles/MMFilesCollection.cpp b/arangod/MMFiles/MMFilesCollection.cpp index e8936582b3..4b681e3b26 100644 --- a/arangod/MMFiles/MMFilesCollection.cpp +++ b/arangod/MMFiles/MMFilesCollection.cpp @@ -522,6 +522,10 @@ MMFilesCollection::MMFilesCollection(LogicalCollection* logical, MMFilesCollection::~MMFilesCollection() { } +TRI_voc_rid_t MMFilesCollection::revision(arangodb::transaction::Methods*) const { + return _lastRevision; +} + TRI_voc_rid_t MMFilesCollection::revision() const { return _lastRevision; } diff --git a/arangod/MMFiles/MMFilesCollection.h b/arangod/MMFiles/MMFilesCollection.h index 4379a779eb..3c60991c93 100644 --- a/arangod/MMFiles/MMFilesCollection.h +++ b/arangod/MMFiles/MMFilesCollection.h @@ -139,7 +139,8 @@ class MMFilesCollection final : public PhysicalCollection { virtual PhysicalCollection* clone(LogicalCollection*, PhysicalCollection*) override; - TRI_voc_rid_t revision() const override; + TRI_voc_rid_t revision(arangodb::transaction::Methods* trx) const override; + TRI_voc_rid_t revision() const; void setRevision(TRI_voc_rid_t revision, bool force); diff --git a/arangod/MMFiles/MMFilesTransactionCollection.cpp b/arangod/MMFiles/MMFilesTransactionCollection.cpp index 70950862dd..0761b99672 100644 --- a/arangod/MMFiles/MMFilesTransactionCollection.cpp +++ b/arangod/MMFiles/MMFilesTransactionCollection.cpp @@ -256,7 +256,7 @@ int MMFilesTransactionCollection::use(int nestingLevel) { if (AccessMode::isWriteOrExclusive(_accessType) && _originalRevision == 0) { // store original revision at transaction start - _originalRevision = _collection->revision(); + _originalRevision = physical->revision(); } bool shouldLock = _transaction->hasHint(transaction::Hints::Hint::LOCK_ENTIRELY); diff --git a/arangod/RocksDBEngine/RocksDBCollection.cpp b/arangod/RocksDBEngine/RocksDBCollection.cpp index 2c4299a5b2..49f21f5d46 100644 --- a/arangod/RocksDBEngine/RocksDBCollection.cpp +++ b/arangod/RocksDBEngine/RocksDBCollection.cpp @@ -132,8 +132,8 @@ PhysicalCollection* RocksDBCollection::clone(LogicalCollection* logical, return new RocksDBCollection(logical, physical); } -TRI_voc_rid_t RocksDBCollection::revision() const { - THROW_ARANGO_NOT_YET_IMPLEMENTED(); +TRI_voc_rid_t RocksDBCollection::revision(arangodb::transaction::Methods* trx) const { + // TODO! return 0; } diff --git a/arangod/RocksDBEngine/RocksDBCollection.h b/arangod/RocksDBEngine/RocksDBCollection.h index 3316fe4f71..241e76f153 100644 --- a/arangod/RocksDBEngine/RocksDBCollection.h +++ b/arangod/RocksDBEngine/RocksDBCollection.h @@ -75,7 +75,7 @@ class RocksDBCollection final : public PhysicalCollection { virtual PhysicalCollection* clone(LogicalCollection*, PhysicalCollection*) override; - TRI_voc_rid_t revision() const override; + TRI_voc_rid_t revision(arangodb::transaction::Methods* trx) const override; void getPropertiesVPack(velocypack::Builder&) const override; void getPropertiesVPackCoordinator(velocypack::Builder&) const override; diff --git a/arangod/V8Server/v8-collection.cpp b/arangod/V8Server/v8-collection.cpp index b8aaa02ce9..cd448fa7df 100644 --- a/arangod/V8Server/v8-collection.cpp +++ b/arangod/V8Server/v8-collection.cpp @@ -2087,7 +2087,7 @@ static int GetRevision(arangodb::LogicalCollection* collection, TRI_voc_rid_t& r // READ-LOCK start trx.lockRead(); - rid = collection->revision(); + rid = collection->revision(&trx); trx.finish(res); // READ-LOCK end diff --git a/arangod/V8Server/v8-query.cpp b/arangod/V8Server/v8-query.cpp index cb08c0b6ec..97f6bf47bd 100644 --- a/arangod/V8Server/v8-query.cpp +++ b/arangod/V8Server/v8-query.cpp @@ -387,7 +387,7 @@ static void JS_ChecksumCollection( LogicalCollection* collection = trx.documentCollection(); auto physical = collection->getPhysical(); TRI_ASSERT(physical != nullptr); - std::string const revisionId = TRI_RidToString(physical->revision()); + std::string const revisionId = TRI_RidToString(physical->revision(&trx)); uint64_t hash = 0; ManagedDocumentResult mmdr; diff --git a/arangod/VocBase/LogicalCollection.cpp b/arangod/VocBase/LogicalCollection.cpp index fa6d21bf70..4e576746a2 100644 --- a/arangod/VocBase/LogicalCollection.cpp +++ b/arangod/VocBase/LogicalCollection.cpp @@ -638,9 +638,9 @@ std::string LogicalCollection::statusString() const { } // SECTION: Properties -TRI_voc_rid_t LogicalCollection::revision() const { +TRI_voc_rid_t LogicalCollection::revision(transaction::Methods* trx) const { // TODO CoordinatorCase - return _physical->revision(); + return _physical->revision(trx); } bool LogicalCollection::isLocal() const { return _isLocal; } diff --git a/arangod/VocBase/LogicalCollection.h b/arangod/VocBase/LogicalCollection.h index 3f00ae477f..bf935a5ebf 100644 --- a/arangod/VocBase/LogicalCollection.h +++ b/arangod/VocBase/LogicalCollection.h @@ -151,7 +151,7 @@ class LogicalCollection { uint64_t numberDocuments(transaction::Methods*) const; // SECTION: Properties - TRI_voc_rid_t revision() const; + TRI_voc_rid_t revision(transaction::Methods*) const; bool isLocal() const; bool deleted() const; bool isSystem() const; diff --git a/arangod/VocBase/PhysicalCollection.h b/arangod/VocBase/PhysicalCollection.h index 2d62bb6af4..24bc15ee32 100644 --- a/arangod/VocBase/PhysicalCollection.h +++ b/arangod/VocBase/PhysicalCollection.h @@ -61,7 +61,7 @@ class PhysicalCollection { virtual PhysicalCollection* clone(LogicalCollection*, PhysicalCollection*) = 0; - virtual TRI_voc_rid_t revision() const = 0; + virtual TRI_voc_rid_t revision(arangodb::transaction::Methods* trx) const = 0; /// @brief export properties virtual void getPropertiesVPack(velocypack::Builder&) const = 0;