Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kv_cache_manager/manager/cache_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,10 @@ ErrorCode CacheManager::CreateBySpec(RequestContext *request_context,
}
}

if (block_keys.empty()) {
continue;
}
Comment on lines +2117 to +2119

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guard fixes the per-spec path, but the same empty-batch call is still reachable in the merged path: CreateInSingleBatch (cache_manager.cc:2049) calls data_storage_manager->Create with merged_block_keys, which is also empty when none of the registered specs match the requested location_spec_group_names — and that path is chosen whenever all spec sizes are equal (the common case). location_spec_infos() being empty also lands there with an empty key vector and common_size == 0.

Two options, either is behavior-preserving for in-tree backends (empty result, results.size() != block_keys.size()0 == 0):

  • add the same empty guard before the Create call at cache_manager.cc:2049, or
  • handle it once in DataStorageManager::Create with an early return {} for empty keys, mirroring the existing empty-input guard in Delete (data_storage_manager.cc:235) — this also covers every other caller (e.g. migration_manager) for free.

Just flagging the gap since the count=0 scenario this PR targets can still occur via the merged path.


🤖 Generated by Qoder


std::vector<std::pair<ErrorCode, DataStorageUri>> results = data_storage_manager->Create(
request_context, unique_name, block_keys, spec_info.size(), []() { /* do nothing */ });

Expand Down
Loading