diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-03-08 10:06:00 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-03-08 13:22:36 +0000 |
commit | 659032d48faba60fc59224c702d19a24a99ca1c7 (patch) | |
tree | 1baabbc2dcf8fdb14684d53e48bfa50605d1990d /searchcore/src/tests/proton/documentdb/feedview | |
parent | 4d5ac042bb2e463a87f652b34ec3f5e89747240a (diff) |
Optimize updates to tensor attributes by only updating them in-memory and no longer go via the document store.
This makes tensor attributes behave as regular attributes.
Reprocessing is updated to correctly handle adding and removal of attribute aspect.
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/feedview')
-rw-r--r-- | searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 0f9df1fc594..fd1984a79fe 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -1070,46 +1070,43 @@ void putDocumentAndUpdate(Fixture &f, const vespalib::string &fieldName) } template <typename Fixture> -void requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(Fixture &f) +void requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(Fixture &f, + const vespalib::string &fieldName) { - putDocumentAndUpdate(f, "a1"); + putDocumentAndUpdate(f, fieldName); EXPECT_EQUAL(1u, f.msa._store._lastSyncToken); // document store not updated assertAttributeUpdate(2u, DocumentId("doc:test:1"), 1, f.maw); } +template <typename Fixture> +void requireThatUpdateUpdatesAttributeAndDocumentStore(Fixture &f, + const vespalib::string &fieldName) +{ + putDocumentAndUpdate(f, fieldName); + + EXPECT_EQUAL(2u, f.msa._store._lastSyncToken); // document store updated + assertAttributeUpdate(2u, DocumentId("doc:test:1"), 1, f.maw); +} + TEST_F("require that update() to fast-access attribute only updates attribute and not document store", FastAccessFeedViewFixture) { f.maw._attrs.insert("a1"); // mark a1 as fast-access attribute field - requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(f); + requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(f, "a1"); } TEST_F("require that update() to attribute only updates attribute and not document store", SearchableFeedViewFixture) { f.maw._attrs.insert("a1"); // mark a1 as attribute field - requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(f); + requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(f, "a1"); } TEST_F("require that update to non fast-access attribute also updates document store", FastAccessFeedViewFixture) { - putDocumentAndUpdate(f, "a1"); - - EXPECT_EQUAL(2u, f.msa._store._lastSyncToken); // document store updated - assertAttributeUpdate(2u, DocumentId("doc:test:1"), 1, f.maw); -} - -template <typename Fixture> -void requireThatUpdateUpdatesAttributeAndDocumentStore(Fixture &f, - const vespalib::string & - fieldName) -{ - putDocumentAndUpdate(f, fieldName); - - EXPECT_EQUAL(2u, f.msa._store._lastSyncToken); // document store updated - assertAttributeUpdate(2u, DocumentId("doc:test:1"), 1, f.maw); + requireThatUpdateUpdatesAttributeAndDocumentStore(f, "a1"); } TEST_F("require that update() to fast-access predicate attribute updates attribute and document store", @@ -1126,18 +1123,18 @@ TEST_F("require that update() to predicate attribute updates attribute and docum requireThatUpdateUpdatesAttributeAndDocumentStore(f, "a2"); } -TEST_F("require that update() to fast-access tensor attribute updates attribute and document store", +TEST_F("require that update() to fast-access tensor attribute only updates attribute and NOT document store", FastAccessFeedViewFixture) { f.maw._attrs.insert("a3"); // mark a3 as fast-access attribute field - requireThatUpdateUpdatesAttributeAndDocumentStore(f, "a3"); + requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(f, "a3"); } -TEST_F("require that update() to tensor attribute updates attribute and document store", +TEST_F("require that update() to tensor attribute only updates attribute and NOT document store", SearchableFeedViewFixture) { f.maw._attrs.insert("a3"); // mark a3 as attribute field - requireThatUpdateUpdatesAttributeAndDocumentStore(f, "a3"); + requireThatUpdateOnlyUpdatesAttributeAndNotDocumentStore(f, "a3"); } TEST_F("require that compactLidSpace() propagates to document meta store and document store and " |