diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-03-24 15:39:08 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2017-03-24 15:39:08 +0000 |
commit | f2d8cf327e614447b10f344007ef82c55ff1737f (patch) | |
tree | ce617c87e3a3085083ea73ba39d1ab6ece0d64ce /searchcore | |
parent | 154ae552cfc899678006fceb856e885792ab243c (diff) |
Test that reprocessing is skipped for attributes that were flushed after
earlier reprocessing.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp index 89024e7cd97..f560030db97 100644 --- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp @@ -5,12 +5,15 @@ LOG_SETUP("attribute_reprocessing_initializer_test"); #include <vespa/searchcore/proton/attribute/attribute_populator.h> #include <vespa/searchcore/proton/attribute/attributemanager.h> +#include <vespa/searchcore/proton/attribute/attributedisklayout.h> +#include <vespa/searchcore/proton/attribute/attribute_directory.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_handler.h> #include <vespa/searchcore/proton/test/attribute_utils.h> #include <vespa/searchcore/proton/test/directory_handler.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> +#include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchcore/proton/common/hw_info.h> @@ -19,6 +22,8 @@ LOG_SETUP("attribute_reprocessing_initializer_test"); using namespace proton; using namespace search; using namespace search::index; +using search::attribute::Config; +using search::attribute::BasicType; const vespalib::string TEST_DIR = "test_output"; const SerialNum INIT_SERIAL_NUM = 10; @@ -118,6 +123,7 @@ struct Fixture _handler() { } + ~Fixture() { } void init() { _initializer.reset(new AttributeReprocessingInitializer (ARIConfig(_newCfg._mgr, _newCfg._schema, _newCfg._inspector), @@ -249,6 +255,25 @@ TEST_F("require that predicate fields are not populated from attribute", Fixture EXPECT_TRUE(f.assertFields({"c", "d"})); } +TEST("require that added attribute aspect with flushed attribute after interruptted reprocessing does not require attribute populate") +{ + { + auto diskLayout = AttributeDiskLayout::create(TEST_DIR); + auto dir = diskLayout->createAttributeDir("a"); + auto writer = dir->getWriter(); + writer->createInvalidSnapshot(INIT_SERIAL_NUM); + writer->markValidSnapshot(INIT_SERIAL_NUM); + auto snapshotdir = writer->getSnapshotDir(INIT_SERIAL_NUM); + vespalib::mkdir(snapshotdir); + auto av = AttributeFactory::createAttribute(snapshotdir + "/a", + Config(BasicType::STRING)); + av->save(); + } + Fixture f; + f.addOldConfig({"a"}, {}).addNewConfig({"a"}, {"a"}).init(); + EXPECT_TRUE(f.assertAttributes({})); +} + TEST_MAIN() { TEST_RUN_ALL(); |