summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-04-21 12:48:21 +0200
committerTor Egge <Tor.Egge@online.no>2021-04-21 12:48:21 +0200
commitd3e67ccce8b634650c13ccd7dbf38c19b0de154b (patch)
tree1b072ca3f460e191ea20f22daa9c82cc9b538904 /searchlib
parent5da673bc5d8a3e6661e9f099b8d15ea301964aaa (diff)
Drop incomplete dictionary snapshots.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp8
2 files changed, 6 insertions, 19 deletions
diff --git a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
index 715df028e8d..bbac15828a7 100644
--- a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
+++ b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp
@@ -161,23 +161,6 @@ TEST_F("require that string iterators are created correctly", StringFixture) {
verify_posting(*f1.api, "foo");
}
-TEST_F("require that dictionary snapshot works", LongFixture)
-{
- auto read_guard = f1.attr->makeReadGuard(false);
- auto dictionary_snapshot = f1.api->get_dictionary_snapshot();
- auto lookup1 = f1.api->lookup("111", dictionary_snapshot);
- EXPECT_TRUE(lookup1.enum_idx.valid());
- f1.attr->clearDoc(1);
- f1.attr->clearDoc(5);
- f1.attr->clearDoc(7);
- f1.attr->commit();
- auto lookup2 = f1.api->lookup("111", f1.api->get_dictionary_snapshot());
- EXPECT_FALSE(lookup2.enum_idx.valid());
- auto lookup3 = f1.api->lookup("111", dictionary_snapshot);
- EXPECT_TRUE(lookup3.enum_idx.valid());
- EXPECT_EQUAL(lookup1.enum_idx.ref(), lookup3.enum_idx.ref());
-}
-
TEST_F("require that collect_folded works for string", StringFixture)
{
StringAttribute *attr = static_cast<StringAttribute *>(f1.attr.get());
diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
index 8bb4e3fc47c..d867ae9f211 100644
--- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
@@ -259,7 +259,9 @@ EnumStoreDictionary<BTreeDictionaryT, HashDictionaryT>::update_posting_list(Inde
assert(itr.valid() && itr.getKey() == idx);
EntryRef old_posting_idx(itr.getData());
EntryRef new_posting_idx = updater(old_posting_idx);
- dict.thaw(itr);
+ // Note: Needs review when porting to other platforms
+ // Assumes that other CPUs observes stores from this CPU in order
+ std::atomic_thread_fence(std::memory_order_release);
itr.writeData(new_posting_idx.ref());
if constexpr (has_hash_dictionary) {
auto find_result = this->_hash_dict.find(this->_hash_dict.get_default_comparator(), idx);
@@ -295,7 +297,9 @@ EnumStoreDictionary<BTreeDictionaryT, HashDictionaryT>::normalize_posting_lists(
EntryRef new_posting_idx = normalize(old_posting_idx);
if (new_posting_idx != old_posting_idx) {
changed = true;
- dict.thaw(itr);
+ // Note: Needs review when porting to other platforms
+ // Assumes that other CPUs observes stores from this CPU in order
+ std::atomic_thread_fence(std::memory_order_release);
itr.writeData(new_posting_idx.ref());
if constexpr (has_hash_dictionary) {
auto find_result = this->_hash_dict.find(this->_hash_dict.get_default_comparator(), itr.getKey());