tryAddLevel0Table returns true if ok and no stalling.
(t *table.Table)
| 184 | |
| 185 | // tryAddLevel0Table returns true if ok and no stalling. |
| 186 | func (s *levelHandler) tryAddLevel0Table(t *table.Table) bool { |
| 187 | y.AssertTrue(s.level == 0) |
| 188 | // Need lock as we may be deleting the first table during a level 0 compaction. |
| 189 | s.Lock() |
| 190 | defer s.Unlock() |
| 191 | // Return false only if L0 is in memory and number of tables is more than number of |
| 192 | // ZeroTableStall. For on disk L0, we should just add the tables to the level. |
| 193 | if s.db.opt.KeepL0InMemory && len(s.tables) >= s.db.opt.NumLevelZeroTablesStall { |
| 194 | return false |
| 195 | } |
| 196 | |
| 197 | s.tables = append(s.tables, t) |
| 198 | t.IncrRef() |
| 199 | s.totalSize += t.Size() |
| 200 | |
| 201 | return true |
| 202 | } |
| 203 | |
| 204 | func (s *levelHandler) numTables() int { |
| 205 | s.RLock() |