fix(levelHandler): use lock for levelHandler sort tables instead of rlock (#2034)

Co-authored-by: guangzhixu <guangzhixu@deepglint.com>
This commit is contained in:
lucario
2023-12-18 12:20:32 +05:30
committed by GitHub
co-authored by guangzhixu
parent e0305408e4
commit 08ac6d2a85
+2 -2
View File
@@ -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