From 85fe2a3064e796abd8f7e4937fa78fd40dfa052c Mon Sep 17 00:00:00 2001 From: Willem Kaufmann Date: Wed, 15 May 2024 12:03:38 -0400 Subject: [PATCH] storage: change map type for `_db` in `kvstore` In an effort to move to fragmented data structures, the `absl::btree_map` type used in the `kvstore` is now replaced by a `chunked_hash_map`. We do not rely on the ordering or any sort of pointer/reference/iterator stability provided by `absl::btree_map` in our current uses of `_db`, so this is a painless swap. --- src/v/storage/kvstore.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/v/storage/kvstore.h b/src/v/storage/kvstore.h index 46d2ec4b625ad..24be2caf45b84 100644 --- a/src/v/storage/kvstore.h +++ b/src/v/storage/kvstore.h @@ -11,7 +11,9 @@ #pragma once #include "base/seastarx.h" +#include "bytes/bytes.h" #include "bytes/iobuf.h" +#include "container/chunked_hash_map.h" #include "metrics/metrics.h" #include "storage/fwd.h" #include "storage/ntp_config.h" @@ -91,6 +93,8 @@ struct kvstore_config { class kvstore { public: + using map_t = chunked_hash_map; + enum class key_space : int8_t { testing = 0, consensus = 1, @@ -164,7 +168,7 @@ class kvstore { // Protect _db and _next_offset across asynchronous mutations. mutex _db_mut{"kvstore::db_mut"}; model::offset _next_offset; - absl::btree_map _db; + map_t _db; std::optional _ntp_sanitizer_config; ss::future<> put(key_space ks, bytes key, std::optional value);