Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Other Environment Information
- Found by reading
origin/mainat the commit above. Not reproduced with a live backup. - Hardware parameters: code inspection
- OS type: n/a
- Others:
mo_brcheckpoint rewrite (pkg/vm/engine/tae/logtail/backup.go, called frompkg/backup/tae.go). This is not#28473(backup fails with 20405 because a source object is already missing). This path returns success. It is not#29259(compact metadata write fails and the merge returns the error).
Actual Behavior
ReWriteCheckpointAndBlockFromKey ignores every dataSinker.Write error, then calls Sync and returns that location as a successful rewrite.
dataSinker := ckputil.NewDataSinker(
common.CheckpointAllocator, dstFs, ioutil.WithMemorySizeThreshold(DefaultCheckpointSize))
// ...
dataSinker.Write(ctx, objectInfoMeta)
dataSinker.Write(ctx, tombstoneInfoMeta)
// else branch:
dataSinker.Write(ctx, dest)
newData := NewCheckpointDataWithSinker(dataSinker, common.CheckpointAllocator)
location, checkpointFiles, err := newData.Sync(ctx, dstFs)
if err != nil {
return nil, nil, nil, err
}
files = append(files, checkpointFiles...)
files = append(files, location.Name().String())
return location, location, files, nilDefaultCheckpointSize is 512MiB (pkg/vm/engine/tae/logtail/utils.go). NewDataSinker also sets WithTailSizeCap(0).
Sinker.Write copies rows and calls pushStaged. Once staged bytes reach 512MiB, pushStaged calls trySpill. trySpill sorts, then defer cleanupInMemoryStaged(), then syncFileSinker. On a file-service error, syncFileSinker returns that error, the defer drops the in-memory batch, and Write returns the error. Earlier successful spills stay in staged.persisted.
The caller discards that error. Sinker.Sync does not remember it:
- If
staged.persistedandstaged.inMemoryare both empty,Syncreturns nil immediately. - If an earlier spill succeeded and memory was cleared,
Syncappends those persisted stats and returns nil.allMergeSortedanddedupAllstay false forNewDataSinker, so it does not reject a partial object list.
CheckpointData_V2.Sync then builds a table-range object. CollectTableRanges returns nil when the object list is empty, and the range writer is still synced. transferred is set and the function returns a location with no error.
pkg/backup/tae.go only checks the rewrite error after consuming checkpointFiles. A nil error continues into checkpoint.MergeCkpMeta and saveTaeFilesList. The backup is stored as complete.
Rows that never reached a successful spill are absent from that checkpoint. A list that fails on its first spill becomes an empty object list. A list that fails after one successful spill keeps only the prefix, so the tombstone half can be missing while the data half is published. Restore reads this checkpoint as the set of live objects.
A canceled context is not this case. Sinker.Sync returns context.Cause when ctx is already done, and the rewrite returns that error.
Expected Behavior
A dataSinker.Write error should fail the rewrite. The objects already spilled for this attempt should be deleted, and MergeCkpMeta / saveTaeFilesList should not run. The same failure inside Sync already returns an error and deletePersistedCheckpointObjects runs because transferred is still false. The Write call before Sync needs to surface that error.
Steps to Reproduce
- Rewrite a checkpoint whose object-list batch reaches
DefaultCheckpointSize(512MiB), soSinker.WritecallstrySpill. - Fail that spill's file-service write (destination full, or an injected
Syncerror on the stage file sinker). Leave the context active. ReWriteCheckpointAndBlockFromKeyreturns a nil error and a location.- The location's object list is empty, or only the prefix that spilled before the error.
pkg/backup/tae.gomerges that location into the backup meta and saves the file list. - Restore from that backup does not see the object-list rows that were discarded by
cleanupInMemoryStaged.
No test injects a Sinker.Write error in ReWriteCheckpointAndBlockFromKey.
Additional information
appendValToBatchalso returns an error thatinitCkpBatchignores. Those batches are on-heap (NewObjectListBatchusesNewWithSchema(false, ...)), so this report does not claim an mpool-cap failure there. The file-service error fromtrySpillis sufficient.- There is no
defer dataSinker.Close()and noDeletePersistedaround the ignoredWrite. A failedsyncFileSinkermay also leave itsActiveObjectNameinstaged.unpublishedwith no cleanup. The wrong result is the successful short checkpoint, not that name by itself.
Activity
XuPeng-SH commentedon Oct 22, 2026
This report is now tracked together with #29261. The canonical issue retains explicit acceptance cases for the behavior described here. This is an administrative duplicate/consolidation closure only; the underlying defect is not claimed fixed. The original description and discussion remain available on this issue.