diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-02-02 18:50:59 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-02-02 18:50:59 +0100 |
commit | 36eadb5844aafc2e2f572a6c25d76730d2bed909 (patch) | |
tree | d324ecfef6099986e429807f1e2fa36f5d96637e | |
parent | 5c0e13b0bd89d403b0a603dd4fe6f676a8bc08b8 (diff) |
Ignore maxentries per chunk.
8 files changed, 25 insertions, 38 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp index 399811cc4b3..318ffcc040e 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp @@ -23,6 +23,8 @@ using vespalib::make_string; using vespalib::IllegalArgumentException; using search::DocumentStore; using search::LogDocumentStore; +using search::LogDataStore; +using search::WriteableFileChunk; using search::TuneFileSummary; using search::common::FileHeaderContext; @@ -143,13 +145,13 @@ SummaryManager::SummaryManager(vespalib::ThreadExecutor & executor, const ProtonConfig::Summary::Log & log(summary.log); const ProtonConfig::Summary::Log::Chunk & chunk(log.chunk); - search::WriteableFileChunk::Config fileConfig(deriveCompression(chunk.compression), chunk.maxbytes, chunk.maxentries); - search::LogDataStore::Config logConfig(log.maxfilesize, log.maxdiskbloatfactor, log.maxbucketspread, - log.minfilesizefactor, log.numthreads, log.compact2activefile, - deriveCompression(log.compact.compression), fileConfig); + WriteableFileChunk::Config fileConfig(deriveCompression(chunk.compression), chunk.maxbytes); + LogDataStore::Config logConfig(log.maxfilesize, log.maxdiskbloatfactor, log.maxbucketspread, + log.minfilesizefactor, log.numthreads, log.compact2activefile, + deriveCompression(log.compact.compression), fileConfig); logConfig.disableCrcOnRead(chunk.skipcrconread); _docStore.reset(new LogDocumentStore(executor, baseDir, - search::LogDocumentStore::Config(config, logConfig), + LogDocumentStore::Config(config, logConfig), growStrategy, tuneFileSummary, fileHeaderContext, tlSyncer, summary.compact2buckets ? bucketizer : search::IBucketizer::SP())); } @@ -172,7 +174,7 @@ IFlushTarget::List SummaryManager::getFlushTargets() { IFlushTarget::List ret; ret.push_back(IFlushTarget::SP(new SummaryFlushTarget(getBackingStore()))); - if (dynamic_cast<search::LogDocumentStore *>(_docStore.get()) != NULL) { + if (dynamic_cast<LogDocumentStore *>(_docStore.get()) != NULL) { ret.push_back(IFlushTarget::SP(new SummaryCompactTarget(getBackingStore()))); } return ret; diff --git a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp index 8350a00cbb3..f8a7dd28720 100644 --- a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp +++ b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp @@ -274,11 +274,9 @@ struct Fixture Fixture::Fixture() : _baseDir("visitor"), _repo(makeDocTypeRepoConfig()), - _storeConfig(DocumentStore:: - Config(CompressionConfig::NONE, 0, 0), - LogDataStore:: - Config(50000, 0.2, 3.0, 0.2, 1, true, CompressionConfig::LZ4, - WriteableFileChunk::Config(CompressionConfig(), 16384, 64))), + _storeConfig(DocumentStore::Config(CompressionConfig::NONE, 0, 0), + LogDataStore::Config(50000, 0.2, 3.0, 0.2, 1, true, CompressionConfig::LZ4, + WriteableFileChunk::Config(CompressionConfig(), 16384))), _executor(_storeConfig.getLogConfig().getNumThreads(), 128 * 1024), _fileHeaderContext(), _tlSyncer(), diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index 7e180bc5900..581b1d59b3d 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -212,10 +212,7 @@ TEST("testGrowing") { FastOS_File::EmptyAndRemoveDirectory("growing"); EXPECT_TRUE(FastOS_File::MakeDirectory("growing")); LogDataStore::Config config(100000, 0.1, 3.0, 0.2, 8, true, CompressionConfig::LZ4, - WriteableFileChunk::Config( - CompressionConfig(CompressionConfig::LZ4, 9, 60), - 1000, - 20)); + WriteableFileChunk::Config(CompressionConfig(CompressionConfig::LZ4, 9, 60), 1000)); vespalib::ThreadStackExecutor executor(config.getNumThreads(), 128*1024); DummyFileHeaderContext fileHeaderContext; MyTlSyncer tlSyncer; @@ -445,7 +442,7 @@ public: _repo(makeDocTypeRepoConfig()), _config(DocumentStore::Config(CompressionConfig::LZ4, 1000000, 0).allowVisitCaching(true), LogDataStore::Config(50000, 0.2, 3.0, 0.2, 1, true,CompressionConfig::LZ4, - WriteableFileChunk::Config(CompressionConfig(), 16384, 64))), + WriteableFileChunk::Config(CompressionConfig(), 16384))), _fileHeaderContext(), _executor(_config.getLogConfig().getNumThreads(), 128*1024), _tlSyncer(), @@ -698,18 +695,18 @@ TEST("requireThatFlushTimeIsAvailableAfterFlush") { } TEST("requireThatChunksObeyLimits") { - Chunk c(0, Chunk::Config(256, 2)); + Chunk c(0, Chunk::Config(256)); EXPECT_TRUE(c.hasRoom(1000)); // At least 1 is allowed no matter what the size is. c.append(1, "abc", 3); EXPECT_TRUE(c.hasRoom(229)); EXPECT_FALSE(c.hasRoom(230)); c.append(2, "abc", 3); - EXPECT_FALSE(c.hasRoom(20)); + EXPECT_TRUE(c.hasRoom(20)); } TEST("requireThatChunkCanProduceUniqueList") { const char *d = "ABCDEF"; - Chunk c(0, Chunk::Config(100, 20)); + Chunk c(0, Chunk::Config(100)); c.append(1, d, 1); c.append(2, d, 2); c.append(3, d, 3); diff --git a/searchlib/src/vespa/searchlib/docstore/chunk.cpp b/searchlib/src/vespa/searchlib/docstore/chunk.cpp index 9821845545c..a2123253ef7 100644 --- a/searchlib/src/vespa/searchlib/docstore/chunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/chunk.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include "chunk.h" #include "chunkformats.h" #include <vespa/vespalib/stllike/hash_map.hpp> @@ -61,7 +60,7 @@ Chunk::Chunk(uint32_t id, const Config & config) : _lastSerial(static_cast<uint64_t>(-1l)), _format(new ChunkFormatV2(config.getMaxBytes())) { - _lids.reserve(config.getMaxCount()); + _lids.reserve(4096/sizeof(Entry)); } Chunk::Chunk(uint32_t id, const void * buffer, size_t len, bool skipcrc) : diff --git a/searchlib/src/vespa/searchlib/docstore/chunk.h b/searchlib/src/vespa/searchlib/docstore/chunk.h index d81055e099e..26eeebff7ed 100644 --- a/searchlib/src/vespa/searchlib/docstore/chunk.h +++ b/searchlib/src/vespa/searchlib/docstore/chunk.h @@ -63,12 +63,10 @@ public: typedef std::unique_ptr<Chunk> UP; class Config { public: - Config(size_t maxBytes, size_t maxCount) : _maxBytes(maxBytes), _maxCount(maxCount) { } + Config(size_t maxBytes) : _maxBytes(maxBytes) { } size_t getMaxBytes() const { return _maxBytes; } - size_t getMaxCount() const { return _maxCount; } private: size_t _maxBytes; - size_t _maxCount; }; class Entry { public: diff --git a/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp b/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp index ddb9bdbba16..6a19070a78a 100644 --- a/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp +++ b/searchlib/src/vespa/searchlib/docstore/storebybucket.cpp @@ -43,7 +43,7 @@ StoreByBucket::add(BucketId bucketId, uint32_t chunkId, uint32_t lid, const void Chunk::UP StoreByBucket::createChunk() { - return std::make_unique<Chunk>(_chunkSerial++, Chunk::Config(0x10000, 1000)); + return std::make_unique<Chunk>(_chunkSerial++, Chunk::Config(0x10000)); } uint64_t diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp index 839184760e4..f8d99e586fb 100644 --- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp @@ -100,7 +100,7 @@ WriteableFileChunk(vespalib::ThreadExecutor &executor, _pendingDat(0), _currentDiskFootprint(0), _nextChunkId(1), - _active(new Chunk(0, Chunk::Config(config.getMaxChunkBytes(), config.getMaxChunkEntries()))), + _active(new Chunk(0, Chunk::Config(config.getMaxChunkBytes()))), _alignment(1), _granularity(1), _maxChunkSize(0x100000), @@ -172,7 +172,7 @@ WriteableFileChunk::updateLidMap(const LockGuard & guard, ISetLid & ds, uint64_t { size_t sz = FileChunk::updateLidMap(guard, ds, serialNum); _nextChunkId = _chunkInfo.size(); - _active.reset( new Chunk(_nextChunkId++, Chunk::Config(_config.getMaxChunkBytes(), _config.getMaxChunkEntries()))); + _active.reset( new Chunk(_nextChunkId++, Chunk::Config(_config.getMaxChunkBytes()))); _serialNum = getLastPersistedSerialNum(); _firstChunkIdToBeWritten = _active->getId(); setDiskFootprint(0); @@ -631,9 +631,7 @@ int32_t WriteableFileChunk::flushLastIfNonEmpty(bool force) chunkId = _active->getId(); _chunkMap[chunkId] = std::move(_active); assert(_nextChunkId < LidInfo::getMaxChunkNum()); - _active.reset(new Chunk(_nextChunkId++, - Chunk::Config(_config.getMaxChunkBytes(), - _config.getMaxChunkEntries()))); + _active.reset(new Chunk(_nextChunkId++, Chunk::Config(_config.getMaxChunkBytes()))); } return chunkId; } diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h index 62a280361d4..b93e88800a4 100644 --- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h +++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.h @@ -24,24 +24,19 @@ public: public: Config() : _compression(document::CompressionConfig::LZ4, 9, 60), - _maxChunkBytes(0x10000), - _maxChunkEntries(256) + _maxChunkBytes(0x10000) { } - Config(const document::CompressionConfig &compression, - size_t maxChunkBytes, size_t maxChunkEntries) + Config(const document::CompressionConfig &compression, size_t maxChunkBytes) : _compression(compression), - _maxChunkBytes(maxChunkBytes), - _maxChunkEntries(maxChunkEntries) + _maxChunkBytes(maxChunkBytes) { } const document::CompressionConfig & getCompression() const { return _compression; } size_t getMaxChunkBytes() const { return _maxChunkBytes; } - size_t getMaxChunkEntries() const { return _maxChunkEntries; } private: document::CompressionConfig _compression; size_t _maxChunkBytes; - size_t _maxChunkEntries; }; public: |