限制分离恢复状态写入大小

写盘前校验与读取一致的八兆字节上限

超限时记录原因并拒绝不可恢复检查点
This commit is contained in:
2026-09-12 02:17:55 +08:00
parent 478e08fb92
commit 12fbb61fad
@@ -66,6 +66,17 @@ fn write_separation_state_blocking(path: &Path, state: &SeparationState) -> Resu
app_log!("ui_separation.error stage=state_write reason=serialize error={error}");
format!("序列化 separation state 失败:{error}")
})?;
if bytes.len() > SEPARATION_STATE_MAX_BYTES {
app_log!(
"ui_separation.error stage=state_write reason=too_large bytes={} max_bytes={}",
bytes.len(),
SEPARATION_STATE_MAX_BYTES
);
return Err(format!(
"separation state 超过 {} 字节上限",
SEPARATION_STATE_MAX_BYTES
));
}
let parent = path.parent().ok_or_else(|| {
app_log!("ui_separation.error stage=state_write reason=missing_parent");
"separation state 路径缺少父目录".to_string()