]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix deadlock in WAL sync
authorAndres Noetzli <andres.noetzli@gmail.com>
Sat, 29 Aug 2015 01:06:32 +0000 (18:06 -0700)
committerAndres Noetzli <andres.noetzli@gmail.com>
Sat, 29 Aug 2015 01:07:47 +0000 (18:07 -0700)
commit297241e056debd50b53fa585f4238dacefb1c4ff
tree3a1b4a65c6a3b74f8534efca6376ec2716a89aeb
parent254c4fb88f04de5ddbe26eb66dfb695bcfee1f5f
Fix deadlock in WAL sync

Summary:
MarkLogsSynced() was doing `logs_.erase(it++);`. The standard is saying:

```
all iterators and references are invalidated, unless the erased members are at an end (front or back) of the deque (in which case only iterators and references to the erased members are invalidated)
```

Because `it` is an iterator to the first element of the container, it is
invalidated, only one iteration is executed and `log.getting_synced = false;`
is not being done, so `while (logs_.front().getting_synced)` in `WriteImpl()`
is not terminating.

Test Plan: make db_bench && ./db_bench --benchmarks=fillsync

Reviewers: igor, rven, IslamAbdelRahman, anthony, kradhakrishnan, yhchiang, sdong, tnovak

Reviewed By: tnovak

Subscribers: kolmike, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D45807
db/db_impl.cc
db/db_test.cc