diff options
author | Henning Baldersheim <balder@oath.com> | 2018-09-24 11:50:47 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-09-24 11:50:47 +0200 |
commit | 85491d4ce0d186321e2c8a34f62ae13cadd6d5a4 (patch) | |
tree | f06b1f7ff8f82b657fe57df0eb433fc244602a74 /searchlib | |
parent | 963ede37edb248accf9eba715d83eca45c8804b9 (diff) |
Update comments and tests as memory size has increased by 8 bytes per entry in the cache.
Diffstat (limited to 'searchlib')
4 files changed, 23 insertions, 12 deletions
diff --git a/searchlib/src/tests/docstore/document_store/document_store_test.cpp b/searchlib/src/tests/docstore/document_store/document_store_test.cpp index 16acbdfe878..649fb675dca 100644 --- a/searchlib/src/tests/docstore/document_store/document_store_test.cpp +++ b/searchlib/src/tests/docstore/document_store/document_store_test.cpp @@ -102,8 +102,15 @@ void verifyValue(vespalib::stringref s, const Value & v) { EXPECT_EQUAL(0, memcmp(s.data(), result.first.getData(), result.first.getDataLen())); } -TEST("require that Value can store uncompressed data") { +TEST("require that Value and cache entries have expected size") { + using pair = std::pair<DocumentIdT, Value>; + using Node = vespalib::hash_node<pair>; EXPECT_EQUAL(64ul, sizeof(Value)); + EXPECT_EQUAL(72ul, sizeof(pair)); + EXPECT_EQUAL(80ul, sizeof(Node)); +} + +TEST("require that Value can store uncompressed data") { Value v = createValue(S1, CompressionConfig::NONE); verifyValue(S1, v); } diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index 34046f551d9..eb49a556bdc 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -622,7 +622,7 @@ TEST("test that the integrated visit cache works.") { for (size_t i(1); i <= 100; i++) { vcs.verifyRead(i); } - constexpr size_t BASE_SZ = 21374; + constexpr size_t BASE_SZ = 22174; TEST_DO(verifyCacheStats(ds.getCacheStats(), 0, 100, 100, BASE_SZ)); for (size_t i(1); i <= 100; i++) { vcs.verifyRead(i); @@ -642,22 +642,22 @@ TEST("test that the integrated visit cache works.") { vcs.verifyVisit({7,9,17,19,67,88}, true); TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 102, 99, BASE_SZ+130)); vcs.verifyVisit({7,9,17,19,67,88,89}, true); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 103, 99, BASE_SZ+201)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 103, 99, BASE_SZ+180)); vcs.rewrite(17); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 103, 97, BASE_SZ-657)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 103, 97, BASE_SZ-680)); vcs.verifyVisit({7,9,17,19,67,88,89}, true); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 104, 98, BASE_SZ-3)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 104, 98, BASE_SZ-20)); vcs.remove(17); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 104, 97, BASE_SZ-657)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 104, 97, BASE_SZ-680)); vcs.verifyVisit({7,9,17,19,67,88,89}, {7,9,19,67,88,89}, true); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 105, 98, BASE_SZ-64)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 105, 98, BASE_SZ-90)); vcs.verifyVisit({41, 42}, true); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 106, 99, BASE_SZ+238)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 106, 99, BASE_SZ+210)); vcs.verifyVisit({43, 44}, true); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 107, 100, BASE_SZ+540)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 107, 100, BASE_SZ+520)); vcs.verifyVisit({41, 42, 43, 44}, true); - TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 108, 99, BASE_SZ+362)); + TEST_DO(verifyCacheStats(ds.getCacheStats(), 101, 108, 99, BASE_SZ+340)); } TEST("testWriteRead") { diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp index 513550bff96..003f448ab07 100644 --- a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp @@ -185,7 +185,7 @@ DocumentStore::read(DocumentIdT lid, const DocumentTypeRepo &repo) const if ( result.second ) { return deserializeDocument(result.first, repo); } else { - LOG(warning, "Summary cache for lid %u is corrupt. Invalidating and reading directly backing store", lid); + LOG(warning, "Summary cache for lid %u is corrupt. Invalidating and reading directly from backing store", lid); _cache->invalidate(lid); } } diff --git a/searchlib/src/vespa/searchlib/docstore/value.h b/searchlib/src/vespa/searchlib/docstore/value.h index 8121ed452a0..426bcaf0e31 100644 --- a/searchlib/src/vespa/searchlib/docstore/value.h +++ b/searchlib/src/vespa/searchlib/docstore/value.h @@ -7,6 +7,11 @@ namespace search::docstore { +/** + * This class is used to represent a serialized and optionally compressed blob. + * Has efficient move/copy operators for use in a cache/stl containers. + * Also has crc checks of uncompressed data. + */ class Value { public: using Alloc = vespalib::alloc::Alloc; @@ -21,7 +26,6 @@ public: Value(const Value &rhs); - void setCompression(CompressionConfig::Type comp, size_t uncompressedSize); uint64_t getSyncToken() const { return _syncToken; } CompressionConfig::Type getCompression() const { return _compression; } size_t getUncompressedSize() const { return _uncompressedSize; } |