You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: CopyGCDir records GC metadata size for copied data objects #25938
backup.CopyGCDir records the GC metadata file's size for every data object referenced by that metadata file, instead of recording the copied object's actual size.
In a focused test, the copied object is 257 bytes and the GC metadata file is 506 bytes. The returned taeFile entry for the object reports 506 bytes.
These entries are serialized into tae_list, and their sizes are summed into tae_sum. Therefore both the per-object backup manifest and the aggregate backup size are incorrect. Backup/restore tooling that relies on the manifest size can also make incorrect validation or reporting decisions.
What did you expect to happen?
Each copied GC-referenced object should have its own actual file size recorded in the backup manifest.
How can we reproduce it?
Create source and destination in-memory file services.
Write one 257-byte object to the source file service.
Write a valid GC metadata file that references the object. The resulting metadata file is 506 bytes.
Call CopyGCDir.
Find the returned taeFile entry for the copied object and compare its size with srcFs.StatFile(objectName).Size.
Actual result: the object entry reports 506, not 257.
Root cause
The object-entry construction in pkg/backup/tae.go uses the directory entry indexed by the GC metadata file:
go test ./pkg/backup \
-run '^TestCopyGCDirRecordsCopiedObjectSizeInManifests$' \
-count=20 -v
go test -race ./pkg/backup \
-run '^TestCopyGCDirRecordsCopiedObjectSizeInManifests$' \
-count=5
Activity
Ariznawlll commentedon Jul 21, 2026
最新 main 白盒验证
main@7f9ef5de9bb9337d8db0a9b15c44cba3b2838aa2pkg/backup/gc_meta_inherit_audit_test.goTestAuditCopyGCDirRecordsCopiedObjectSizebackup.CopyGCDir执行了什么
MemoryFS分别作为源和备份目标。objectio.NewObjectWriterSpecial(objectio.WriterGC, ...)写入一份真实 GC 元数据,并让它引用该对象;生成的 GC 元数据文件大小为 506 字节。CopyGCDir完成对象和元数据复制。[]*taeFile中定位该对象,断言其size等于srcFS.StatFile(objectName).Size。执行命令
测试结果
FAIL,连续 3 次均稳定复现(3/3)。 每次结果一致:
结论
确认是 bug。对象内容实际已经复制,但
CopyGCDir把 GC 元数据文件的 506 字节错误写成该对象的大小。该字段随后进入tae_list,并参与tae_sum汇总,所以对象级清单和总大小都会错误。本次没有观察到对象内容损坏,因此结论仅限定在清单/统计及其消费方。fix(backup): preserve GC metadata watermarks and sizes (#25972)
LeftHandCold commentedon Jul 22, 2026
fixed
Ariznawlll commentedon Jul 22, 2026
已在最新
main分支完成复验,CopyGCDir记录错误对象大小的问题已修复。测试版本
mainc0486a2446c84c6dd6bf142494fe85243877ddc5测试过程
执行正式回归用例
TestCopyGCDirRecordsCopiedObjectSizeInManifests:CopyGCDir;taeFile条目以及生成的 manifest 汇总;StatFile.Size,而不是 GC metadata 的大小。执行命令:
实际结果
taeFile.size与源对象真实大小一致;测试结论
CopyGCDir已改为针对每个被引用对象读取并记录自身文件大小,tae_list的对象级大小和相应汇总不再被 GC metadata 文件大小污染,原问题验证通过。fix(backup): preserve GC metadata watermarks and sizes (matrixorigin#…
fix(backup): preserve GC metadata watermarks and sizes (matrixorigin#…
fix(backup): preserve GC metadata watermarks and sizes (matrixorigin#…