Skip to content

Commit ea6cd51

Browse files
RidRisRclaude
andcommitted
br/pkg/stream: preserve m2's IngestedSstPaths in MergeMigrations
MergeMigrations only appended m1's IngestedSstPaths, silently dropping m2's. During truncate (MergeAndMigrateTo -> processExtFullBackup), every merged layer's ext_backups/ directory became invisible to the cleanup logic and stayed on storage forever. Today this is a storage leak; once lease-based lock expiration lands, an auto-reclaimed read lock followed by a truncate can strand SSTs that PiTR still needs. ref #67819 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 801b1d3 commit ea6cd51

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

br/pkg/stream/stream_metas.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ func MergeMigrations(m1 *pb.Migration, m2 *pb.Migration) *pb.Migration {
614614
out.DestructPrefix = append(out.DestructPrefix, m1.GetDestructPrefix()...)
615615
out.DestructPrefix = append(out.DestructPrefix, m2.GetDestructPrefix()...)
616616
out.IngestedSstPaths = append(out.IngestedSstPaths, m1.GetIngestedSstPaths()...)
617+
out.IngestedSstPaths = append(out.IngestedSstPaths, m2.GetIngestedSstPaths()...)
617618
return out
618619
}
619620

br/pkg/stream/stream_metas_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,3 +2992,15 @@ func TestGroupedExtFullBackup(t *testing.T) {
29922992
})
29932993
}
29942994
}
2995+
2996+
func TestMergeMigrationsPreservesIngestedSstPaths(t *testing.T) {
2997+
m1 := mig(mExtFullBackup("base/a", "base/b"))
2998+
m2 := mig(mExtFullBackup("layer/c", "layer/d"))
2999+
3000+
merged := MergeMigrations(m1, m2)
3001+
3002+
require.ElementsMatch(t,
3003+
[]string{"base/a", "base/b", "layer/c", "layer/d"},
3004+
merged.IngestedSstPaths,
3005+
)
3006+
}

0 commit comments

Comments
 (0)