diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-08-27 10:34:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-27 10:34:34 +0200 |
commit | 6130643ad1dd31064b47fcac4d07a3a590cbdf29 (patch) | |
tree | 8fcd33ccf337a0e9d64fc87899bd6a7b43f94dd6 /searchcore/src/tests | |
parent | a6441b5c9ac6cdb89aafe8d62bbf6222dd7d8dd0 (diff) | |
parent | 919cbab31203663df7d417e9457714f009d1eb87 (diff) |
Merge pull request #10417 from vespa-engine/toregge/use-unique-store-enumerator-when-saving-enumerated-attributes
Use unique store enumerator when saving enumerated attribute vectors.
Diffstat (limited to 'searchcore/src/tests')
-rw-r--r-- | searchcore/src/tests/proton/attribute/attributeflush_test.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 81ab6142006..1173fe4b625 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -192,6 +192,10 @@ getInt32Config() return AVConfig(AVBasicType::INT32); } +AVConfig getInt32ArrayConfig() +{ + return AVConfig(AVBasicType::INT32, AVCollectionType::ARRAY); +} class Test : public vespalib::TestApp { @@ -225,6 +229,8 @@ private: void requireThatFlushedAttributeCanBeLoaded(const HwInfo &hwInfo); void requireThatFlushedAttributeCanBeLoaded(); + + void requireThatFlushFailurePreventsSyncTokenUpdate(); public: int Main() override; @@ -272,6 +278,11 @@ struct AttributeManagerFixture cfg.setFastSearch(true); return _m.addAttribute({name, cfg}, createSerialNum); } + AttributeVector::SP addIntArrayPostingAttribute(const vespalib::string &name) { + AVConfig cfg(getInt32ArrayConfig()); + cfg.setFastSearch(true); + return _m.addAttribute({name, cfg}, createSerialNum); + } }; AttributeManagerFixture::AttributeManagerFixture(BaseFixture &bf) @@ -612,6 +623,23 @@ Test::requireThatFlushedAttributeCanBeLoaded() TEST_DO(requireThatFlushedAttributeCanBeLoaded(HwInfo(HwInfo::Disk(0, true, false), HwInfo::Memory(0), HwInfo::Cpu(0)))); } +void +Test::requireThatFlushFailurePreventsSyncTokenUpdate() +{ + BaseFixture f; + AttributeManagerFixture amf(f); + auto &am = amf._m; + auto av = amf.addIntArrayPostingAttribute("a12"); + EXPECT_EQUAL(1u, av->getNumDocs()); + auto flush_target = am.getFlushable("a12"); + EXPECT_EQUAL(0u, flush_target->getFlushedSerialNum()); + auto flush_task = flush_target->initFlush(200); + // Trigger flush failure + av->getEnumStoreBase()->get_data_store_base().bump_compaction_count(); + flush_task->run(); + EXPECT_EQUAL(0u, flush_target->getFlushedSerialNum()); +} + int Test::Main() { @@ -631,6 +659,7 @@ Test::Main() TEST_DO(requireThatLastFlushTimeIsReported()); TEST_DO(requireThatShrinkWorks()); TEST_DO(requireThatFlushedAttributeCanBeLoaded()); + TEST_DO(requireThatFlushFailurePreventsSyncTokenUpdate()); TEST_DONE(); } |