feat(library): 目标维护窗口(持久所有权/独占/release-on-verify)+ known-broken 记录
build / build (push) Failing after 16s
build / build (push) Failing after 16s
为什么:用户确认维护窗口方案,需要真实占有目标而不是 503 页面。 - 迁移 000070 library_maintenance:scope 唯一持有者、作业/目标身份、服务原状态、阶段。 - worker 在写目标前 acquire,验证+登记成功才 release;回滚失败/未验证保持 needs_restore。 - API GET /library/maintenance + 同步入口在他人持有时 409。 - 已知缺陷如实记录:候选实例该路由 404;kill 取证脚本竞态导致三项断言为 false。
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -54,6 +55,21 @@ func (r libraryStageRecorder) Stage(ctx context.Context, stage, state, detail st
|
||||
|
||||
func int64Ptr(value int64) *int64 { return &value }
|
||||
|
||||
// redactDSN 只保留库名,避免把连接串写进维护记录。
|
||||
func redactDSN(dsn string) string {
|
||||
if dsn == "" {
|
||||
return ""
|
||||
}
|
||||
if index := strings.LastIndex(dsn, "/"); index >= 0 && index+1 < len(dsn) {
|
||||
name := dsn[index+1:]
|
||||
if cut := strings.Index(name, "?"); cut >= 0 {
|
||||
name = name[:cut]
|
||||
}
|
||||
return name
|
||||
}
|
||||
return "configured"
|
||||
}
|
||||
|
||||
// stageSize 是某一类数据在快照里的真实总量(行数/字节)。
|
||||
type stageSize struct {
|
||||
count int64
|
||||
|
||||
Reference in New Issue
Block a user