Badger: DropPrefixRace test should not wait indefinitely

Created on 3 Jul 2019  路  2Comments  路  Source: dgraph-io/badger

What version of Badger are you using?

Master

Does this issue reproduce with the latest master?

Yes

What did you do?

while go clean -testcache && go test -v -race -run='TestDropPrefixRace' -timeout=1m; do :; done

What happened?

The TestDropPrefixRace gets stuck into finitely loop. See the logs below

...
badger 2019/07/03 01:46:50 DEBUG: Flushing memtable
badger 2019/07/03 01:46:50 DEBUG: Storing value log head: {Fid:0 Len:46 Offset:1549649}
badger 2019/07/03 01:46:50 DEBUG: STALLED STALLED STALLED: 151.331416ms
badger 2019/07/03 01:46:50 DEBUG: level=0. Status= Size=223613
badger 2019/07/03 01:46:50 DEBUG: level=1. Status= Size=121345
badger 2019/07/03 01:46:50 DEBUG: level=2. Status= Size=308338
badger 2019/07/03 01:46:50 DEBUG: level=3. Status= Size=0
badger 2019/07/03 01:46:50 DEBUG: level=4. Status= Size=0
badger 2019/07/03 01:46:50 DEBUG: level=5. Status= Size=0
badger 2019/07/03 01:46:50 DEBUG: level=6. Status= Size=0
badger 2019/07/03 01:46:50 DEBUG: Waiting to add level 0 table. Compaction priorities: [{level:0 score:2 dropPrefix:[]}]
badger 2019/07/03 01:46:51 DEBUG: Waiting to add level 0 table. Compaction priorities: [{level:0 score:2 dropPrefix:[]}]
badger 2019/07/03 01:46:52 DEBUG: Waiting to add level 0 table. Compaction priorities: [{level:0 score:2 dropPrefix:[]}]
badger 2019/07/03 01:46:53 DEBUG: Waiting to add level 0 table. Compaction priorities: [{level:0 score:2
...

See https://slack-files.com/T9TBKDGN6-FKWNE1FB3-1fdb7dc8a5 for complete logs.

Badger gets stuck at the following for loop
https://github.com/dgraph-io/badger/blob/329b6828fc708b90d01faeaf2b83fb6d1c5138ef/levels.go#L872-L890

The infinite loop is because we stop all compactions in drop prefix
https://github.com/dgraph-io/badger/blob/329b6828fc708b90d01faeaf2b83fb6d1c5138ef/db.go#L1308 and the code in AddLevel0Table waits for level 0 to be compactable or level 1 to have enough space to hold level 0 tables.
https://github.com/dgraph-io/badger/blob/329b6828fc708b90d01faeaf2b83fb6d1c5138ef/levels.go#L877

aretesting kinbug prioritP1 statuaccepted

All 2 comments

@sch00lb0y is looking into this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

djdv picture djdv  路  7Comments

dc0d picture dc0d  路  3Comments

jarifibrahim picture jarifibrahim  路  7Comments

tonyalaribe picture tonyalaribe  路  8Comments

dwoske picture dwoske  路  7Comments