summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-08-26 21:46:41 +0200
committerTor Egge <Tor.Egge@broadpark.no>2019-08-26 21:46:41 +0200
commit919cbab31203663df7d417e9457714f009d1eb87 (patch)
tree0b5fe1fcebb3ba5031ddf3358ad49e12c13d3e21 /searchcore
parentdab8f7407cd1872bbe5c10b9a94ab4a8cd91eaa3 (diff)
Test that flushed sync token is not updated when attribute flush fails.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/attribute/attributeflush_test.cpp29
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();
}