mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 00:20:47 +00:00
Add a custom partitioner and sharder that will be used for Raft tables for strongly consistent tables. These tables will have partition keys of the form (shard, group_id) and the partitioner creates tokens that encode the target shard in the high 16 bits. Token layout: [shard: 16 bits][partition key hash: 48 bits] This encoding guarantees that raft group data will be located on the same shard as the tablet replica corresponding to that raft group as long we use the tablet replica's shard as the value in the partition key. Storing the shard directly in the partition key avoids additional lookups for request routing to the incoming new raft tables. For even more simplicity, we avoid biasing between uint64_t and int64_t by limiting the acceptable shard ids up to 32767 (leaving the top bit 0), which results in the same value of the token when interpreting either as uint64_t or int64_t. The sharder decodes the shard by extracting the high bits, which is shard-count independent. This allows the partition key:shard mapping to remain the same even during smp changes (only increases are allowed, the same limitation as for tablets).
29 lines
644 B
CMake
29 lines
644 B
CMake
include(add_whole_archive)
|
|
|
|
add_library(scylla_dht STATIC)
|
|
target_sources(scylla_dht
|
|
PRIVATE
|
|
boot_strapper.cc
|
|
fixed_shard.cc
|
|
i_partitioner.cc
|
|
murmur3_partitioner.cc
|
|
range_streamer.cc
|
|
token.cc)
|
|
target_include_directories(scylla_dht
|
|
PUBLIC
|
|
${CMAKE_SOURCE_DIR})
|
|
target_link_libraries(scylla_dht
|
|
PUBLIC
|
|
Seastar::seastar
|
|
xxHash::xxhash
|
|
PRIVATE
|
|
replica)
|
|
|
|
if (Scylla_USE_PRECOMPILED_HEADER_USE)
|
|
target_precompile_headers(scylla_dht REUSE_FROM scylla-precompiled-header)
|
|
endif()
|
|
add_whole_archive(dht scylla_dht)
|
|
|
|
check_headers(check-headers scylla_dht
|
|
GLOB_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/*.hh)
|