]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
workaround race conditions during `PeriodicWorkScheduler` registration (#7888)
authorAndrew Kryczka <ajkr@users.noreply.github.com>
Thu, 21 Jan 2021 16:47:06 +0000 (08:47 -0800)
committerAndrew Kryczka <andrewkr@fb.com>
Thu, 21 Jan 2021 20:40:16 +0000 (12:40 -0800)
commit1420cbf09dd04d4dad5df05b4e8db9fa13f06899
tree91c54a1240b60387c7a824cbfbeea89f19f4a1a5
parent6002cce2237a4c6c8a6d6c1e08fc42fe5e7e234b
workaround race conditions during `PeriodicWorkScheduler` registration (#7888)

Summary:
This provides a workaround for two race conditions that will be fixed in
a more sophisticated way later. This PR:

(1) Makes the client serialize calls to `Timer::Start()` and `Timer::Shutdown()` (see https://github.com/facebook/rocksdb/issues/7711). The long-term fix will be to make those functions thread-safe.
(2) Makes `PeriodicWorkScheduler` atomically add/cancel work together with starting/shutting down its `Timer`. The long-term fix will be for `Timer` API to offer more specialized APIs so the client will not need to synchronize.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7888

Test Plan: ran the repro provided in https://github.com/facebook/rocksdb/issues/7881

Reviewed By: jay-zhuang

Differential Revision: D25990891

Pulled By: ajkr

fbshipit-source-id: a97fdaebbda6d7db7ddb1b146738b68c16c5be38
HISTORY.md
db/periodic_work_scheduler.cc
db/periodic_work_scheduler.h
util/timer.h