Use wyhash

This commit is contained in:
Vitaliy Filippov
2025-11-23 19:08:24 +03:00
parent b0bf45c26f
commit ad308ed92a
2 changed files with 10 additions and 5 deletions
+2 -2
View File
@@ -819,7 +819,7 @@ void blockstore_heap_t::reshard(pool_id_t pool, uint32_t pg_count, uint32_t pg_s
}
uint32_t old_pg_count = !pool_settings.pg_count ? 1 : pool_settings.pg_count;
uint64_t pool_id = (uint64_t)pool;
emhash7::HashMap<uint64_t, emhash7::HashMap<inode_t, emhash7::HashMap<uint64_t, uint64_t>>> new_shards;
heap_block_index_t new_shards;
for (uint32_t pg_num = 0; pg_num <= old_pg_count; pg_num++)
{
auto sh_it = block_index.find((pool_id << (64-POOL_ID_BITS)) | pg_num);
@@ -905,7 +905,7 @@ heap_object_t *blockstore_heap_t::read_locked_entry(object_id oid, uint64_t copy
return read_entry(oid, NULL);
}
void blockstore_heap_t::free_mvcc(emhash7::HashMap<heap_mvcc_copy_id_t, heap_object_mvcc_t>::iterator mvcc_it)
void blockstore_heap_t::free_mvcc(heap_mvcc_map_t::iterator mvcc_it)
{
if (mvcc_it->second.entry_copy)
{
+8 -3
View File
@@ -15,6 +15,7 @@
#include "../client/object_id.h"
#include "../../emhash/hash_table5.hpp"
#include "../../emhash/hash_table7.hpp"
#include "../../emhash/thirdparty/martin/unordered_dense.h"
#include "blockstore_disk.h"
#include "multilist.h"
@@ -150,6 +151,10 @@ struct heap_refqi_t
bool is_data;
};
using i64hash_t = ankerl::unordered_dense::hash<uint64_t>;
using heap_block_index_t = emhash7::HashMap<uint64_t, emhash7::HashMap<inode_t, emhash7::HashMap<uint64_t, uint64_t, i64hash_t>, i64hash_t>, i64hash_t>;
using heap_mvcc_map_t = emhash7::HashMap<heap_mvcc_copy_id_t, heap_object_mvcc_t>;
class blockstore_heap_t
{
friend class heap_write_t;
@@ -167,14 +172,14 @@ class blockstore_heap_t
uint64_t next_lsn = 0;
emhash7::HashMap<pool_id_t, pool_shard_settings_t> pool_shard_settings;
// PG => inode => stripe => block number
emhash7::HashMap<uint64_t, emhash7::HashMap<inode_t, emhash7::HashMap<uint64_t, uint64_t>>> block_index;
heap_block_index_t block_index;
std::vector<heap_block_info_t> block_info;
allocator_t *data_alloc = NULL;
multilist_index_t *meta_alloc = NULL;
uint32_t meta_alloc_count = 0;
uint64_t meta_used_space = 0;
multilist_alloc_t *buffer_alloc = NULL;
emhash7::HashMap<heap_mvcc_copy_id_t, heap_object_mvcc_t> object_mvcc;
heap_mvcc_map_t object_mvcc;
std::unordered_map<uint64_t, uint32_t> mvcc_data_refs;
std::unordered_map<uint64_t, uint32_t> mvcc_buffer_refs;
std::map<uint64_t, uint64_t> inode_space_stats;
@@ -209,7 +214,7 @@ class blockstore_heap_t
void copy_full_object(uint8_t *dst, heap_object_t *obj);
bool mvcc_save_copy(heap_object_t *obj);
bool mvcc_check_tracking(object_id oid);
void free_mvcc(emhash7::HashMap<heap_mvcc_copy_id_t, heap_object_mvcc_t>::iterator mvcc_it);
void free_mvcc(heap_mvcc_map_t::iterator mvcc_it);
void allocate_block(heap_block_info_t & inf);
int add_object(object_id oid, heap_write_t *wr, uint32_t *modified_block);
void mark_overwritten(uint64_t over_lsn, uint64_t inode, heap_write_t *wr, heap_write_t *end_wr, bool tracking_active);