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
- Hardware parameters:
- OS type:
- Others: code inspection of origin/main. No open issue describes
compatibilityForV12discarding append errors. [Bug]: checkpoint GC clears a keep-set failure and can delete an object a live table still references #29258 is the GC keep-set named-return wipe, and [Bug]: TAE metadata writers must propagate append/write errors before publishing incomplete state #29261 isvisitObjectignoringsinker.Write. This reader runs only for checkpoint version <= 12. Current writer version is 13 (CheckpointCurrentVersion = CheckpointVersion13).
Actual Behavior
compatibilityForV12 (pkg/vm/engine/tae/logtail/ckp_reader.go 583–639) appends every converted v12 object row and ignores the error from each call:
vector.AppendMultiFixedfor account and object typeVector.Unionfor db, table, object stats, create ts, delete tsvector.AppendFixedfor the physical row idvector.AppendBytesfor the cluster key
It then does ckpData.SetRowCount(ckpData.Vecs[0].Length()) and returns nil. The named err is never assigned. ckpObjectReaderForV12.Read (151–201) treats that nil as success, advances objectIndex, and continues. ReadMeta installs this reader when version <= CheckpointVersion12 (289–311).
The destination batch is off-heap: ckputil.MakeDataScanTableIDBatch is batch.NewWithSchema(true, ...) (pkg/vm/engine/ckputil/data.go 38–43). appendMultiFixed updates length only after extendWithBitmaps succeeds (pkg/container/vector/vector.go 9856–9871). Union of the object-stats column (T_char, non-inline; ObjectStats is [ObjectStatsLen]byte) updates length in unionT before pregrowVarlenaArea (vector.go 8368–8439). MPool.Grow on an off-heap vector returns moerr.NewMPoolCapacityNoCtxf when the peak exceeds GlobalCap or mp.Cap.
common.CheckpointAllocator is mpool.NewMPool("tae_checkpoint", 0, ...), so Cap() is PiB and the practical failure is GlobalCap. GC and checkpoint replay both pass that pool.
Two outcomes, both after the reader has already returned success:
-
Silent omit. If the account
AppendMultiFixedfails, column 0 does not grow. Later columns that also fail beforesetLengthAfterExtendstay the same length.SetRowCountpublishes the old length.ForEachRow(642–690) iterates onlyRowCount(), so the failed block's objects are never visited and nothing panics.BuildBloomfilter(pkg/vm/engine/tae/db/gc/v3/executor.go55–77) only stops whenLoadBatchDatareturns an error.MakeBloomfilterCoarseFilter(exec_v1.go249–331) therefore builds a bloom without those object names.bf.Testtreats a miss as absent, and an object whose create and drop timestamps are both<the GC watermark is marked for deletion. The same short batch is what checkpoint replay reads (pkg/vm/engine/tae/db/checkpoint/replay.go656–693) and what backup opens (pkg/vm/engine/tae/logtail/backup.go411). -
Panic instead of the allocation error. If column 0 grows and the object-stats
Uniondoes not,ForEachRowindexes a shorter vector (GetBytesAtatvector.go3797–3803) or converts a short payload withobjectio.ObjectStats(...). That conversion is a slice-to-array conversion of[ObjectStatsLen]byteand panics when the slice is shorter thanObjectStatsLen. A zero varlena is inline and yields a 0-byte slice (pkg/container/types/bytes.go49–53 and 107–113). GC (pkg/vm/engine/tae/db/gc) and checkpoint replay have norecoveraround this read.unionTcan also leave the new object-stats slots logically published whenpregrowVarlenaAreafails aftersetLengthAfterExtend;MPool.Growcopies the old prefix and does not clear the tail (mpool.go1376–1425, off-heapallocusessimpleCAllocator().Allocate). A leftover header that is not a short inline value makesGetByteSlicesliceareaand typically panics.
ConsumeCheckpointWithTableID for version <= 12 (700–742) uses the same Read result.
Expected Behavior
An off-heap append or union failure in compatibilityForV12 should return that error. ckpObjectReaderForV12.Read, GC bloom construction, checkpoint replay, and backup should fail the operation. A failed block must not be omitted from a successful scan, and it must not be turned into a panic after the reader has reported success.
Steps to Reproduce
Code path, not a one-shot SQL script. The reader is selected only when the stored checkpoint version is <= 12.
- On a TN whose global checkpoint entry is still version 12, or while replaying version-12 entries at or after
maxGlobalEnd. - Drive
GlobalCapso an off-heap grow insidecompatibilityForV12fails. Checkpoint GC usesCheckpointAllocatorviaNewCheckpointCleaner(pkg/vm/engine/tae/db/gc/v3/checkpoint.go285) andExecuteGlobalCheckpointBasedGC(window.go143–158). Replay uses the same allocator (replay.go255). - If the account column does not grow, GC's coarse bloom misses the block's objects and
MakeBloomfilterCoarseFiltermarks old-enough objects for deletion whileExecutestill returns nil. If column 0 grew and object stats did not,ForEachRowpanics and the TN crashes instead of returningMPoolCapacity.
Additional information
compatibilityFn is a closure that cannot see the named return err, and none of the append calls assign it. The current-version object reader is a different path and is not this bug.
Activity
fix(tae): propagate v12 checkpoint conversion errors (#29685)
jiangxinmeng1 commentedon Oct 21, 2026
fixed by #29685
Ariznawlll commentedon Oct 21, 2026
测试版本
main3a1e42b4308bd0098e055ddb9360a07f85201d9cd0e7f9a552f90b28dd37c87a30c4c6dc83ae7423已确认是本次官方 main 的祖先。原问题验证
在最新 main 上运行
pkg/vm/engine/tae/logtail定向go test -race -count=3。原报告要求的 v12 转换过程中 append/union 内存失败,现在 8 档剩余容量(1/2/4/8/16/32/64/128 字节)均返回ErrMPoolCapacity,RowCount()=0,没有把失败当作成功发布,也没有 panic;3 轮全部通过。含真实两 block v12 对象的数据块和 tombstone 块,在首块转换失败后均返回容量错误,释放已加载块与目标 batch,CurrNB()=0;同一 reader 清理后重试成功并读回 2 行,数据/墓碑两路径各 3/3。Happy Path 覆盖
RowCount()=2且最终CurrNB()=0;数据和 tombstone 各 3/3。Unhappy Path 覆盖
-race -count=3下通过。白盒验证
pkg/vm/engine/tae/logtail的TestCompatibilityForV12PropagatesAppendError、TestCompatibilityForV12PropagatesEveryAppendError、TestCKPObjectReaderForV12ReleasesAllLoadedBlocksOnConversionError、TestConsumeCheckpointWithTableIDPropagatesIteratorError、TestSnapshotMetaPropagatesCheckpointReaderErrors:go test -race -count=3PASS。pkg/vm/engine/tae/db/gc/v3的 reader-error、先 spill 后 reader-error 清理和 snapshot rollback 定向组:go test -race -count=3PASS。备份 sinker 写错误清理定向测试也-race -count=3PASS。这里是内部-only 内存故障注入,公开 SQL 无法确定性触发,因此不新增重复 MOTR。回归测试
-race -count=3均 PASS。测试证据
可复核的完整 main SHA、原始失败注入及正向对照断言见上述固定 commit 的测试源文件;本轮隔离本地三次
go test -race输出均以ok结束,未出现 race 报告。修复 PR 的最终 review 亦记录对转换、GC、备份及清理路径的回归审查。测试结论
测试通过。