iceberg: keep version-hint.text out of remove_orphans (#11867) (#11871)

Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Chris LuandDevin authored and GitHub committed 2026-10-20 13:05:38 -07:00
1 parent df89afbef4
commit 610346ae8c
2 files changed
+5 -1

No files matched your search

+3
View File
@@ -342,6 +342,9 @@ func collectOrphanCandidates(
}
referencedFiles[path.Join("metadata", metadataFileName)] = struct{}{}
// Table-root readers (DuckDB iceberg_scan, Hadoop tables) open this to find
// the current metadata; nothing in the metadata references it.
referencedFiles[path.Join("metadata", "version-hint.text")] = struct{}{}
for mle := range meta.PreviousFiles() {
referencedFiles[mle.MetadataFile] = struct{}{}
}
@@ -57,6 +57,7 @@ func TestOrphanCleanupKeepsStatisticsFiles(t *testing.T) {
filer.PutFile(metaDir, "stats-1.puffin", old)
filer.PutFile(metaDir, "partition-stats-1.parquet", old)
filer.PutFile(metaDir, "stats-0.puffin", old) // superseded: a real orphan
filer.PutFile(metaDir, "version-hint.text", old)
candidates, err := collectOrphanCandidates(context.Background(), filer.Client, bucket, path.Join(namespace, tbl),
meta, "v1.metadata.json", 1)
@@ -70,7 +71,7 @@ func TestOrphanCleanupKeepsStatisticsFiles(t *testing.T) {
if !doomed["stats-0.puffin"] {
t.Fatalf("expected the unreferenced stats-0.puffin to be an orphan, got %v", doomed)
}
for _, name := range []string{"stats-1.puffin", "partition-stats-1.parquet", "v1.metadata.json"} {
for _, name := range []string{"stats-1.puffin", "partition-stats-1.parquet", "v1.metadata.json", "version-hint.text"} {
if doomed[name] {
t.Errorf("%s is referenced by the table metadata and must not be an orphan", name)
}