Skip to content

Commit 1680900

Browse files
committed
[manager] document EventReport reclaim accounting boundaries
Keep reporter-owned locations out of generic physical deletion without granting false predicted-key credit when ordinary and EventReport locations coexist. Document that EventReport bytes remain in the group-wide capacity watermark while being excluded from per-storage-type watermarks. Add regression coverage ensuring reporter locations cannot satisfy migration cold-tier spec coverage.
1 parent d789955 commit 1680900

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

docs/design/cache_reclaimer_async_delete.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,14 @@ size 的 Location 按 0 bytes 记账,但仍加入 pending 并受数量上限
221221
只有本次请求覆盖某个 block 的全部有效 Location 时,才增加一个 `predicted_deleted_keys`。V1 不跨
222222
多个 `DeleteHandler` 合并推断,允许保守少计。
223223

224+
EventReport Location 由外部 reporter 拥有,只能由 ReportEvent snapshot、delta 或 host lifecycle 清理,不能进入
225+
通用物理存储回收请求。它仍然是 metadata key 上的有效 Location:若一个 block 同时包含 EventReport 与普通
226+
Location,删除全部普通 Location 后 key 仍然存在,因此不得产生 `predicted_deleted_keys` credit。EventReport usage
227+
不参与按 storage type 的水位,但仍计入 group 总 byte 水位;通用 Reclaimer 即使因此触发,也只能选择普通
228+
Location,EventReport-only 场景会按 no-progress 退避,不能进入物理删除。EventReport Location 也不能作为
229+
migration cold-tier spec coverage。key-count 水位继续使用 MetaIndexer 的官方总 key 数,无法证明可删除时保持
230+
fail-closed、允许保守多触发而不能提前抵扣。
231+
224232
水位判断改为:
225233

226234
```text
@@ -362,6 +370,10 @@ V1 提供以下指标:
362370
有效 Location。
363371
15. Meta 异步请求跳过 `CLS_DELETING`,重复提交不会再次安排物理删除。
364372
16. Admission 已进入队列但尚未执行时停止 Executor,cancel callback 使 Future 以错误终态完成。
373+
17. EventReport Location 不进入物理删除请求,但与普通 Location 共存时仍阻止错误的
374+
`predicted_deleted_keys` credit。
375+
18. EventReport usage 仍可触发 group 总 byte 水位,但不触发 EventReport storage-type 水位。
376+
19. reporter URI host 即使与 migration target storage 同名,也不能补齐 cold-tier spec coverage。
365377

366378
### 8.2 集成测试关注点
367379

kv_cache_manager/manager/cache_reclaimer.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,10 @@ bool CacheReclaimer::FilterLocID(RequestContext *request_context,
14881488
if (!loc_ptr) {
14891489
continue;
14901490
}
1491+
// Reporter-owned locations are not reclaim candidates, but still
1492+
// keep the metadata key alive after all ordinary locations have
1493+
// been removed. Count them before filtering so key-count credit is
1494+
// only granted when the deletion can actually remove the key.
14911495
++valid_location_count;
14921496
const auto &loc = *loc_ptr;
14931497
if (IsEventReportStorageType(loc.type())) {

kv_cache_manager/manager/test/cache_reclaimer_test.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4499,10 +4499,20 @@ TEST_F(CacheReclaimerTest, TestFilterLocIDDoesNotEvictHotWhenColdSpecsIncomplete
44994499
DataStorageType::DATA_STORAGE_TYPE_DUMMY,
45004500
1,
45014501
std::vector<LocationSpec>{LocationSpec("TP0", "dummy://cold_01/cold_partial/tp0")});
4502+
// A reporter may use the migration target name as its URI host and carry
4503+
// the otherwise missing spec. It is not an ordinary cold-tier replica and
4504+
// must not make the hot location eligible for physical reclamation.
4505+
auto event_report_loc = std::make_shared<CacheLocation>(
4506+
"event_report#mem#cold_01:9600",
4507+
CacheLocationStatus::CLS_SERVING,
4508+
DataStorageType::DATA_STORAGE_TYPE_EVENT_REPORT_L2,
4509+
1,
4510+
std::vector<LocationSpec>{LocationSpec("TP1", "event_report://cold_01:9600/mem?size=1")});
45024511

45034512
CacheLocationMap loc_map;
45044513
loc_map.emplace("hot_full", hot_loc);
45054514
loc_map.emplace("cold_partial", partial_cold_loc);
4515+
loc_map.emplace("event_report", event_report_loc);
45064516
batch_get_loc_out_maps = {std::move(loc_map)};
45074517
batch_get_loc_result = ErrorCode::EC_OK;
45084518

0 commit comments

Comments
 (0)