Skip to content

Commit d27e5b8

Browse files
authored
remove unnessary drains in eviction (#10559)
1 parent 2e93482 commit d27e5b8

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

enterprise/server/backends/pebble_cache/pebble_cache.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,10 +2625,6 @@ func newPartitionEvictor(ctx context.Context, part disk.Partition, fileStorer fi
26252625

26262626
func (e *partitionEvictor) startSampleGenerator(quitChan chan struct{}) {
26272627
e.generateSamplesForEviction(quitChan)
2628-
// Drain samples chan before exiting
2629-
for len(e.samples) > 0 {
2630-
<-e.samples
2631-
}
26322628
close(e.samples)
26332629
}
26342630

@@ -2647,9 +2643,6 @@ func (e *partitionEvictor) processEviction(quitChan chan struct{}) {
26472643
})
26482644
}
26492645
eg.Wait()
2650-
for len(e.deletes) > 0 {
2651-
<-e.deletes
2652-
}
26532646
}
26542647

26552648
func (e *partitionEvictor) generateSamplesForEviction(quitChan chan struct{}) error {

enterprise/server/raft/usagetracker/usagetracker.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ func (pu *partitionUsage) processEviction(ctx context.Context) {
264264
for {
265265
select {
266266
case <-ctx.Done():
267-
for len(pu.deletes) > 0 {
268-
<-pu.deletes
269-
}
270267
return
271268
case sampleToDelete := <-pu.deletes:
272269
keys = append(keys, &sender.KeyMeta{
@@ -284,10 +281,6 @@ func (pu *partitionUsage) processEviction(ctx context.Context) {
284281

285282
func (pu *partitionUsage) startSampleGenerator(ctx context.Context) {
286283
pu.generateSamplesForEviction(ctx)
287-
// Drain samples chan before exiting
288-
for len(pu.samples) > 0 {
289-
<-pu.samples
290-
}
291284
close(pu.samples)
292285
}
293286

0 commit comments

Comments
 (0)