diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-03-08 15:06:24 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-03-08 15:06:24 +0100 |
commit | 03f1f46dce69a365869f039fe7ddda9760742c68 (patch) | |
tree | 7388adf2d2db7cba485974ff76649ecd0abccabc | |
parent | 43a5f9b030ddae8a370eb15890fa2e96e52f2df9 (diff) |
Add function comment.
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/save_utils.cpp | 4 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/save_utils.h | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/save_utils.cpp b/searchlib/src/vespa/searchlib/attribute/save_utils.cpp index 1d2fabf33d2..b433197b23e 100644 --- a/searchlib/src/vespa/searchlib/attribute/save_utils.cpp +++ b/searchlib/src/vespa/searchlib/attribute/save_utils.cpp @@ -8,8 +8,8 @@ namespace search::attribute { EntryRefVector make_entry_ref_vector_snapshot(const vespalib::RcuVectorBase<vespalib::datastore::AtomicEntryRef>& ref_vector, uint32_t size) { - assert(size <= ref_vector.get_size()); // Called from writer only - auto* source = &ref_vector.get_elem_ref(0); // Called from writer only + assert(size <= ref_vector.get_size()); + auto* source = &ref_vector.get_elem_ref(0); EntryRefVector result; result.reserve(size); for (uint32_t lid = 0; lid < size; ++lid) { diff --git a/searchlib/src/vespa/searchlib/attribute/save_utils.h b/searchlib/src/vespa/searchlib/attribute/save_utils.h index bd27a0e130c..56c953fc1c4 100644 --- a/searchlib/src/vespa/searchlib/attribute/save_utils.h +++ b/searchlib/src/vespa/searchlib/attribute/save_utils.h @@ -12,6 +12,14 @@ namespace search::attribute { using EntryRefVector = std::vector<vespalib::datastore::EntryRef, vespalib::allocator_large<vespalib::datastore::EntryRef>>; +/* + * Create a vector of entry refs from an rcu vector containing atomic + * entry refs. The new vector can be used by a flush thread while + * saving an attribute vector as long as the proper generation guard + * is also held. + * + * The function must be called from the attribute write thread. + */ EntryRefVector make_entry_ref_vector_snapshot(const vespalib::RcuVectorBase<vespalib::datastore::AtomicEntryRef>& ref_vector, uint32_t size); } |