diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-09-10 12:34:47 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-09-10 12:45:27 +0200 |
commit | c90f50b02a8ddb0d11aaef4cf456564beecaf7d3 (patch) | |
tree | 0a2a9883003e48140dd35162234fb4ab504af6e7 /vespalib | |
parent | 0c72768ea7290ebd3792201636bdca3b005ddf82 (diff) |
Allocate nested vector used to map from EntryRef to enum value earlier
to avoid interference from compaction when populating the mapping.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h index 40cc295e76d..0ffc695a285 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h @@ -23,6 +23,8 @@ private: const DataStoreBase &_store; EnumValues _enumValues; uint32_t _next_enum_val; + + void allocate_enum_values(); public: UniqueStoreEnumerator(const IUniqueStoreDictionary &dict, const DataStoreBase &store); ~UniqueStoreEnumerator(); diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp index 729177d394c..48489e9edd5 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.hpp @@ -15,6 +15,7 @@ UniqueStoreEnumerator<RefT>::UniqueStoreEnumerator(const IUniqueStoreDictionary _enumValues(), _next_enum_val(1) { + allocate_enum_values(); } template <typename RefT> @@ -37,7 +38,7 @@ UniqueStoreEnumerator<RefT>::enumerateValue(EntryRef ref) template <typename RefT> void -UniqueStoreEnumerator<RefT>::enumerateValues() +UniqueStoreEnumerator<RefT>::allocate_enum_values() { _enumValues.resize(RefType::numBuffers()); for (uint32_t bufferId = 0; bufferId < RefType::numBuffers(); ++bufferId) { @@ -46,6 +47,12 @@ UniqueStoreEnumerator<RefT>::enumerateValues() _enumValues[bufferId].resize(state.size() / state.getArraySize()); } } +} + +template <typename RefT> +void +UniqueStoreEnumerator<RefT>::enumerateValues() +{ _next_enum_val = 1; _dict_snapshot->foreach_key([this](EntryRef ref) { enumerateValue(ref); }); } |