[KV Connector][Mooncake] Add cache_prefix to namespace store keys (#45767)
Signed-off-by: Dao Le <Dao007forever@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
188c68798e
commit
44b2512767
@@ -26,6 +26,7 @@ from vllm.distributed.kv_transfer.kv_connector.v1.mooncake.store.data import (
|
||||
ChunkedTokenDatabase,
|
||||
KeyMetadata,
|
||||
LoadSpec,
|
||||
PoolKey,
|
||||
ReqMeta,
|
||||
)
|
||||
from vllm.distributed.kv_transfer.kv_connector.v1.mooncake.store.metrics import (
|
||||
@@ -240,6 +241,31 @@ def _patch_worker_runtime(monkeypatch, *, local_ip: str = "10.0.0.7") -> None:
|
||||
monkeypatch.setattr(worker, "get_ip", lambda: local_ip)
|
||||
|
||||
|
||||
def test_pool_key_to_string_without_prefix_is_unchanged():
|
||||
"""Default (empty) cache_prefix keeps keys byte-identical to the
|
||||
historical unprefixed format so existing deployments keep their hits."""
|
||||
key = PoolKey(KeyMetadata("test-model", 0, 0, 0, 0), "deadbeef")
|
||||
assert (
|
||||
key.to_string() == "test-model@tp_rank:0@pcp0@dcp0@pp_rank:0@group:0@deadbeef"
|
||||
)
|
||||
|
||||
|
||||
def test_pool_key_cache_prefix_namespaces_and_disambiguates():
|
||||
"""A non-empty cache_prefix is prepended, and two instances with
|
||||
different prefixes never collide on identical block hashes."""
|
||||
md_a = KeyMetadata("test-model", 0, 0, 0, 0, cache_prefix="depA")
|
||||
md_b = KeyMetadata("test-model", 0, 0, 0, 0, cache_prefix="depB")
|
||||
|
||||
key_a = PoolKey(md_a, "deadbeef")
|
||||
key_b = PoolKey(md_b, "deadbeef")
|
||||
|
||||
assert key_a.to_string() == (
|
||||
"depA@test-model@tp_rank:0@pcp0@dcp0@pp_rank:0@group:0@deadbeef"
|
||||
)
|
||||
assert key_a.to_string() != key_b.to_string()
|
||||
assert hash(key_a) != hash(key_b)
|
||||
|
||||
|
||||
def test_default_local_buffer_size_matches_pr40900():
|
||||
"""PR-40900 shipped a 4 GiB default for local_buffer_size; the dual-mode
|
||||
patch preserves it (and the JSON key) so unchanged PR-40900 configs work."""
|
||||
|
||||
Reference in New Issue
Block a user