diff options
author | Geir Storli <geirst@yahoo-inc.com> | 2017-05-09 12:48:43 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahoo-inc.com> | 2017-05-12 14:01:24 +0000 |
commit | adca3a93bbb0d1af78b17b79d82c3a49564f2104 (patch) | |
tree | d12189b0a2d1981547d52afdc4a7bb2d8d08ab46 /searchlib | |
parent | 9b815d1bcc2665ae30b2bd1d7a304bbeb73a4b95 (diff) |
Rename nextId() -> getDocIdLimit().
Diffstat (limited to 'searchlib')
6 files changed, 18 insertions, 14 deletions
diff --git a/searchlib/src/apps/docstore/benchmarkdatastore.cpp b/searchlib/src/apps/docstore/benchmarkdatastore.cpp index 2393a82b44c..8aa2156743d 100644 --- a/searchlib/src/apps/docstore/benchmarkdatastore.cpp +++ b/searchlib/src/apps/docstore/benchmarkdatastore.cpp @@ -68,15 +68,15 @@ void BenchmarkDataStoreApp::read(size_t numReads, size_t perChunk, const IDataSt char state[8]; memset(state, 0, sizeof(state)); memset(&rstate, 0, sizeof(rstate)); - const size_t numDocs(dataStore->nextId()); - assert(numDocs > 0); + const size_t docIdLimit(dataStore->getDocIdLimit()); + assert(docIdLimit > 0); initstate_r(getpid(), state, sizeof(state), &rstate); assert(srandom_r(getpid(), &rstate) == 0); int32_t rnd(0); for ( size_t i(0); i < numReads; i++) { random_r(&rstate, &rnd); - uint32_t lid(rnd%numDocs); - for (uint32_t j(lid); j < std::min(numDocs, lid+perChunk); j++) { + uint32_t lid(rnd%docIdLimit); + for (uint32_t j(lid); j < std::min(docIdLimit, lid+perChunk); j++) { dataStore->read(j, buf); buf.clear(); } diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.h b/searchlib/src/vespa/searchlib/docstore/documentstore.h index 93bf899fbb6..cb36576709f 100644 --- a/searchlib/src/vespa/searchlib/docstore/documentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/documentstore.h @@ -105,9 +105,8 @@ public: /** * Get the number of entries (including removed IDs * or gaps in the local ID sequence) in the document store. - * @return The next local ID expected to be used. */ - uint64_t nextId() const override { return _backingStore.nextId(); } + uint32_t getDocIdLimit() const override { return _backingStore.getDocIdLimit(); } /** * Calculate memory used by this instance. During flush() actual diff --git a/searchlib/src/vespa/searchlib/docstore/idatastore.cpp b/searchlib/src/vespa/searchlib/docstore/idatastore.cpp index e0e788968c1..fc66870daaa 100644 --- a/searchlib/src/vespa/searchlib/docstore/idatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/idatastore.cpp @@ -6,7 +6,7 @@ namespace search { IDataStore::IDataStore(const vespalib::string& dirName) : - _nextId(0), + _docIdLimit(0), _dirName(dirName) { } diff --git a/searchlib/src/vespa/searchlib/docstore/idatastore.h b/searchlib/src/vespa/searchlib/docstore/idatastore.h index 9351a0f7802..5ae0eeeb9a1 100644 --- a/searchlib/src/vespa/searchlib/docstore/idatastore.h +++ b/searchlib/src/vespa/searchlib/docstore/idatastore.h @@ -175,9 +175,8 @@ public: /** * Get the number of entries (including removed IDs * or gaps in the local ID sequence) in the data store. - * @return The next local ID expected to be used */ - uint64_t nextId() const { return _nextId; } + uint32_t getDocIdLimit() const { return _docIdLimit; } /** * Returns the name of the base directory where the data file is stored. @@ -185,10 +184,17 @@ public: const vespalib::string & getBaseDir() const { return _dirName; } protected: - void setNextId(uint64_t id) { _nextId = id; } + void setDocIdLimit(uint32_t docIdLimit) { + _docIdLimit = docIdLimit; + } + void updateDocIdLimit(uint32_t docIdLimit) { + if (docIdLimit > _docIdLimit) { + setDocIdLimit(docIdLimit); + } + } private: - uint64_t _nextId; + uint32_t _docIdLimit; vespalib::string _dirName; }; diff --git a/searchlib/src/vespa/searchlib/docstore/idocumentstore.h b/searchlib/src/vespa/searchlib/docstore/idocumentstore.h index 0d0e18a0d82..df214b5d568 100644 --- a/searchlib/src/vespa/searchlib/docstore/idocumentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/idocumentstore.h @@ -122,9 +122,8 @@ public: /** * Get the number of entries (including removed IDs * or gaps in the local ID sequence) in the document store. - * @return The next local ID expected to be used. */ - virtual uint64_t nextId() const = 0; + virtual uint32_t getDocIdLimit() const = 0; /** * Calculate memory used by this instance. During flush() actual diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp index 74d4b27e04b..8acec09cd1e 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp @@ -876,7 +876,7 @@ LogDataStore::setLid(const LockGuard & guard, uint32_t lid, const LidInfo & meta _genHandler.incGeneration(); _genHandler.updateFirstUsedGeneration(); _lidInfo.removeOldGenerations(_genHandler.getFirstUsedGeneration()); - setNextId(_lidInfo.size()); + updateDocIdLimit(_lidInfo.size()); } _lidInfo[lid] = meta; } |