facebook / facebook/rocksdb

RFC: Pluggable WriteController

Open
#3,271 21 comments 0 reactions 2 assignees Claimed by @siying View on GitHub
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

I presented an alternate write throttle for slower class servers at the annual RocksDB Meetup December 4, 2017. The current implementation is completely external to RocksDB. During the Q&A session, I was asked how this could be better/cleanly integrated with RocksDB. My answer was to have the WriteController object pluggable, like the bloom filters and rate limiters. It was suggested that I post an RFC here first, then potentially submit a PR with said change and incorporating comments posted against the issue.

My suggested change is:

1. add a shared_ptr object to the Options structure where a user can supply a custom WriteController. This is a shared_ptr, not a unique_ptr, in case the user has multiple database instances that wish to share the same WriteController so as to have a "system-wide" view.

2. the shared_ptr from the Options structure is assigned to the DB_Impl object in place of the current WriteController member object. If the user does not supply a custom WriteController, an instance of the existing WriteController is automatically added.

3. write_controller.h moves to the include/rocksdb directory.

4. add "virtual" to most of the existing WriteController methods. This simplifies creating object derivatives.

5. optional: I have considered making some of the existing WriteController routines thread safe. They currently assume the caller holds the database mutex. This could be awkward if a derived instance is actually shared across multiple database instances. Otherwise, any user derived object will have to include the necessary protections.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.