Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WriteController: move it to public interface #579

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* unit tests: fix GlobalWriteControllerTest.GlobalAndWBMSetupDelay by waiting for the memtable memory release.
* spdb memtable: use_seek_parallel_threshold option parameter mishandled (#570)
* build: Plug memtable global switch memtable stuck fix. (#606)
* build: Windows compilation fix (#568).
* Logger: fix Block cache stats trace by spacing it from the last trace (#578).
* WriteController: move the class to public interface which should have been done under #346.

## Fig v2.5.0 (06/14/2023)
Based on RocksDB 8.1.1
Expand Down
2 changes: 1 addition & 1 deletion db/column_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
#include "db/range_del_aggregator.h"
#include "db/table_properties_collector.h"
#include "db/version_set.h"
#include "db/write_controller.h"
#include "file/sst_file_manager_impl.h"
#include "logging/logging.h"
#include "monitoring/thread_status_util.h"
#include "options/options_helper.h"
#include "port/port.h"
#include "rocksdb/convenience.h"
#include "rocksdb/table.h"
#include "rocksdb/write_controller.h"
#include "table/merging_iterator.h"
#include "util/autovector.h"
#include "util/cast_util.h"
Expand Down
2 changes: 1 addition & 1 deletion db/column_family.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#include "db/table_cache.h"
#include "db/table_properties_collector.h"
#include "db/write_batch_internal.h"
#include "db/write_controller.h"
#include "options/cf_options.h"
#include "rocksdb/compaction_job_stats.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "rocksdb/options.h"
#include "rocksdb/write_controller.h"
#include "trace_replay/block_cache_tracer.h"
#include "util/hash_containers.h"
#include "util/thread_local.h"
Expand Down
2 changes: 1 addition & 1 deletion db/compaction/compaction_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "db/range_del_aggregator.h"
#include "db/seqno_to_time_mapping.h"
#include "db/version_edit.h"
#include "db/write_controller.h"
#include "db/write_thread.h"
#include "logging/event_logger.h"
#include "options/cf_options.h"
Expand All @@ -41,6 +40,7 @@
#include "rocksdb/env.h"
#include "rocksdb/memtablerep.h"
#include "rocksdb/transaction_log.h"
#include "rocksdb/write_controller.h"
#include "table/scoped_arena_iterator.h"
#include "util/autovector.h"
#include "util/stop_watch.h"
Expand Down
2 changes: 1 addition & 1 deletion db/db_impl/db_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "db/trim_history_scheduler.h"
#include "db/version_edit.h"
#include "db/wal_manager.h"
#include "db/write_controller.h"
#include "db/write_thread.h"
#include "logging/event_logger.h"
#include "monitoring/instrumented_mutex.h"
Expand All @@ -59,6 +58,7 @@
#include "rocksdb/transaction_log.h"
#include "rocksdb/utilities/replayer.h"
#include "rocksdb/write_buffer_manager.h"
#include "rocksdb/write_controller.h"
#include "table/merging_iterator.h"
#include "table/scoped_arena_iterator.h"
#include "util/autovector.h"
Expand Down
2 changes: 1 addition & 1 deletion db/flush_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "db/seqno_to_time_mapping.h"
#include "db/snapshot_impl.h"
#include "db/version_edit.h"
#include "db/write_controller.h"
#include "db/write_thread.h"
#include "logging/event_logger.h"
#include "monitoring/instrumented_mutex.h"
Expand All @@ -39,6 +38,7 @@
#include "rocksdb/listener.h"
#include "rocksdb/memtablerep.h"
#include "rocksdb/transaction_log.h"
#include "rocksdb/write_controller.h"
#include "table/scoped_arena_iterator.h"
#include "util/autovector.h"
#include "util/stop_watch.h"
Expand Down
2 changes: 1 addition & 1 deletion db/global_write_controller_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.

#include "db/db_test_util.h"
#include "db/write_controller.h"
#include "rocksdb/write_buffer_manager.h"
#include "rocksdb/write_controller.h"

namespace ROCKSDB_NAMESPACE {

Expand Down
2 changes: 1 addition & 1 deletion db/memtable_list_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

#include "db/merge_context.h"
#include "db/version_set.h"
#include "db/write_controller.h"
#include "rocksdb/db.h"
#include "rocksdb/status.h"
#include "rocksdb/write_buffer_manager.h"
#include "rocksdb/write_controller.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "util/string_util.h"
Expand Down
2 changes: 1 addition & 1 deletion db/version_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#include "db/table_cache.h"
#include "db/version_builder.h"
#include "db/version_edit.h"
#include "db/write_controller.h"
#include "env/file_system_tracer.h"
#include "rocksdb/write_controller.h"
#if USE_COROUTINES
#include "folly/experimental/coro/BlockingWait.h"
#include "folly/experimental/coro/Collect.h"
Expand Down
2 changes: 1 addition & 1 deletion db/write_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).

#include "db/write_controller.h"
#include "rocksdb/write_controller.h"

#include <algorithm>
#include <atomic>
Expand Down
2 changes: 1 addition & 1 deletion db/write_controller_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
#include "db/write_controller.h"
#include "rocksdb/write_controller.h"

#include <array>
#include <ratio>
Expand Down
4 changes: 4 additions & 0 deletions db/write_controller.h → include/rocksdb/write_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ class WriteController {
bool NeedSpeedupCompaction() const {
return IsStopped() || NeedsDelay() || total_compaction_pressure_.load() > 0;
}

// Should only be called by Speedb internally!
// return how many microseconds the caller needs to sleep after the call
// num_bytes: how many number of bytes to put into the DB.
// Prerequisite: DB mutex held.
uint64_t GetDelay(SystemClock* clock, uint64_t num_bytes);

void set_delayed_write_rate(uint64_t write_rate) {
std::lock_guard<std::mutex> lock(metrics_mu_);
// avoid divide 0
Expand Down Expand Up @@ -117,6 +120,7 @@ class WriteController {

uint64_t TEST_GetMapMinRate();

// Below 2 functions should only be called by Speedb internally!
void WaitOnCV(std::function<bool()> continue_wait);
void NotifyCV();

Expand Down