engine: the KV plan split, the host mirror, and --kv-resident bring-up

This commit is contained in:
C_Tamas committed 2026-10-24 19:19:19 +07:00
1 parent cce687bf2c
commit a9e627b7ca
44 files changed
+3118 -51

No files matched your search

+22
View File
@@ -94,6 +94,10 @@ struct IKVManager {
/* Blocks held by anything, as opposed to free_blocks (what can be handed out now). On an
* elastic pool they differ by what the cache released (KVManager::held_blocks). */
virtual int64_t held_blocks(int32_t group) const = 0;
/* One past the highest block id any held table can name (KVManager::held_top_blocks), the
* sound bound for the stage's live-row copy (kvstream/stage.h). A manager that cannot answer
* says "the whole row". */
virtual int64_t held_top_blocks(int32_t group) const { (void)group; return INT64_MAX; }
/* The pool in bytes, the only unit that sums across groups. Asked of the manager because its
* plan knows whether a group counts blocks or states. */
@@ -102,6 +106,17 @@ struct IKVManager {
/* What the carve gave the group; an elastic pool may have released part of it. */
virtual int64_t pool_bytes_carved(int32_t group) const = 0;
/* A streamed group's ring, residency map and host mirror as the step batch hands them to a
* plugin (RadKVStream), or null for a group that is fully resident. The addresses are fixed at
* bring-up, so the batch builder copies the pointer into every step's batch and a recorded
* pass keyed by it replays. The default is null: a manager with no streaming has none. */
virtual const RadKVStream* stream_view(int32_t group) const { (void)group; return nullptr; }
/* The resolve's cumulative traffic and the ring's depth, for the metrics. Zero and empty on a
* server that does not stream. */
virtual int64_t stream_misses() const { return 0; }
virtual int64_t stream_bytes_in() const { return 0; }
virtual int64_t stream_resident_blocks() const { return 0; }
/* Tokens one block covers, or 0 for a stateful group. */
virtual int64_t block_tokens(int32_t group) const = 0;
@@ -326,9 +341,16 @@ struct KVBinding final : IKVManager {
int64_t free_blocks(int32_t g) const override { return m->free_blocks(g); }
int64_t total_blocks(int32_t g) const override { return m->total_blocks(g); }
int64_t held_blocks(int32_t g) const override { return m->held_blocks(g); }
int64_t held_top_blocks(int32_t g) const override { return m->held_top_blocks(g); }
int64_t pool_bytes(int32_t g) const override { return m->pool_bytes(g); }
int64_t pool_bytes_used(int32_t g) const override { return m->pool_bytes_used(g); }
int64_t pool_bytes_carved(int32_t g) const override { return m->pool_bytes_carved(g); }
const RadKVStream* stream_view(int32_t g) const override { return m->stream_view(g); }
int64_t stream_misses() const override { return (int64_t)m->stream_stats().misses; }
int64_t stream_bytes_in() const override { return (int64_t)m->stream_stats().bytes_in; }
int64_t stream_resident_blocks() const override {
return m->stream_stats().resident_blocks;
}
int64_t block_tokens(int32_t g) const override {
const KVGroupPlan* p = m->plan(g);
return p && p->paged() ? p->block_size : 0;