mirror of
https://github.com/luxfi/zapdb.git
synced 2026-07-27 06:54:45 +00:00
fix(levelHandler): use lock for levelHandler sort tables instead of rlock (#2034)
Co-authored-by: guangzhixu <guangzhixu@deepglint.com>
This commit is contained in:
committed by
GitHub
co-authored by
guangzhixu
parent
e0305408e4
commit
08ac6d2a85
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user