Skip to content

Commit

Permalink
use lock for levelHandler sort tables instead of rlock
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshi-099 committed Dec 12, 2023
1 parent fb1b009 commit 35c5648
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions level_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ func (s *levelHandler) addTable(t *table.Table) {
// sortTables sorts tables of levelHandler based on table.Smallest.
// Normally it should be called after all addTable calls.
func (s *levelHandler) sortTables() {
s.RLock()
defer s.RUnlock()
s.Lock()
defer s.Unlock()

sort.Slice(s.tables, func(i, j int) bool {
return y.CompareKeys(s.tables[i].Smallest(), s.tables[j].Smallest()) < 0
Expand Down

0 comments on commit 35c5648

Please sign in to comment.