feat: add sync checkpoint restore for last successful sync
Capture rolling online DB snapshots after push/drain/reconcile and expose SyncPage 数据恢复 plus checkpoint/restore APIs; mark Z12h and restore done in coop docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -90,6 +90,9 @@ func agentSyncPushHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
if res != nil && res.Skipped {
|
||||
outcome = "skipped"
|
||||
}
|
||||
if res != nil && res.Applied {
|
||||
dbsync.ScheduleCheckpoint(svcCtx.DBSync.Store(), ch, "push")
|
||||
}
|
||||
logSyncReq(r, "push", channelID, item.Table, item.RowPK, outcome, "", dur, reqID)
|
||||
auditSync(svcCtx, r, "dbsync.push", map[string]any{
|
||||
"channel_id": channelID, "table": item.Table, "row_pk": item.RowPK,
|
||||
@@ -153,6 +156,15 @@ func agentSyncPushBatchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
httpx.OkJson(w, payload)
|
||||
return
|
||||
}
|
||||
applied := 0
|
||||
for _, r0 := range results {
|
||||
if r0.Applied {
|
||||
applied++
|
||||
}
|
||||
}
|
||||
if applied > 0 {
|
||||
dbsync.ScheduleCheckpoint(svcCtx.DBSync.Store(), ch, "push_batch")
|
||||
}
|
||||
logSyncReq(r, "push_batch", channelID, "", "", "ok", "", dur, reqID)
|
||||
auditSync(svcCtx, r, "dbsync.push_batch", map[string]any{
|
||||
"channel_id": channelID, "n": len(body.Items), "ms": dur.Milliseconds(), "req_id": reqID,
|
||||
|
||||
Reference in New Issue
Block a user