Make sure LeveledCompactor respect context cancellation during the time opening blocks (#16407)

Signed-off-by: Alex Le <leqiyue@amazon.com>
This commit is contained in:
Alex Le 2025-04-08 01:04:23 -07:00 committed by GitHub
parent 10b4e1b231
commit 701d13abf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -470,6 +470,12 @@ func (c *LeveledCompactor) CompactWithBlockPopulator(dest string, dirs []string,
start := time.Now()
for _, d := range dirs {
select {
case <-c.ctx.Done():
return nil, c.ctx.Err()
default:
}
meta, _, err := readMetaFile(d)
if err != nil {
return nil, err