rocksdb/util
Maysam Yabandeh 499ebb3ab5 Optimize for serial commits in 2PC
Summary:
Throughput: 46k tps in our sysbench settings (filling the details later)

The idea is to have the simplest change that gives us a reasonable boost
in 2PC throughput.

Major design changes:
1. The WAL file internal buffer is not flushed after each write. Instead
it is flushed before critical operations (WAL copy via fs) or when
FlushWAL is called by MySQL. Flushing the WAL buffer is also protected
via mutex_.
2. Use two sequence numbers: last seq, and last seq for write. Last seq
is the last visible sequence number for reads. Last seq for write is the
next sequence number that should be used to write to WAL/memtable. This
allows to have a memtable write be in parallel to WAL writes.
3. BatchGroup is not used for writes. This means that we can have
parallel writers which changes a major assumption in the code base. To
accommodate for that i) allow only 1 WriteImpl that intends to write to
memtable via mem_mutex_--which is fine since in 2PC almost all of the memtable writes
come via group commit phase which is serial anyway, ii) make all the
parts in the code base that assumed to be the only writer (via
EnterUnbatched) to also acquire mem_mutex_, iii) stat updates are
protected via a stat_mutex_.

Note: the first commit has the approach figured out but is not clean.
Submitting the PR anyway to get the early feedback on the approach. If
we are ok with the approach I will go ahead with this updates:
0) Rebase with Yi's pipelining changes
1) Currently batching is disabled by default to make sure that it will be
consistent with all unit tests. Will make this optional via a config.
2) A couple of unit tests are disabled. They need to be updated with the
serial commit of 2PC taken into account.
3) Replacing BatchGroup with mem_mutex_ got a bit ugly as it requires
releasing mutex_ beforehand (the same way EnterUnbatched does). This
needs to be cleaned up.
Closes https://github.com/facebook/rocksdb/pull/2345

Differential Revision: D5210732

Pulled By: maysamyabandeh

fbshipit-source-id: 78653bd95a35cd1e831e555e0e57bdfd695355a4
2017-06-24 14:11:29 -07:00
..
aligned_buffer.h Make direct I/O write use incremental buffer 2017-06-13 04:41:37 -07:00
allocator.h Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
arena_test.cc Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
arena.cc Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
arena.h Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
auto_roll_logger_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
auto_roll_logger.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
auto_roll_logger.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
autovector_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
autovector.h Address MS Visual Studio 2017 issue with autovector 2017-05-22 10:57:06 -07:00
bloom_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
bloom.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
build_version.cc.in Makefile: generate util/build_version.cc from .in file (#1384) 2016-10-25 11:31:39 -07:00
build_version.h fixed typo 2017-06-05 11:27:34 -07:00
channel.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
coding_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
coding.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
coding.h Avoid unsupported attributes when not building with UBSAN 2017-05-30 11:13:01 -07:00
compaction_job_stats_impl.cc Single Delete Mismatch and Fallthrough statistics 2016-08-16 08:21:43 -07:00
comparator.cc do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
compression.h Remove use of deprecated LZ4 function 2016-11-21 12:24:14 -08:00
concurrent_arena.cc Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
concurrent_arena.h Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
core_local.h Core-local statistics 2017-05-23 10:42:59 -07:00
crc32c_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
crc32c.cc cross-platform compatibility improvements 2017-05-15 16:15:38 -07:00
crc32c.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
delete_scheduler_test.cc Limit trash directory to be 25% of total DB 2017-06-12 16:57:21 -07:00
delete_scheduler.cc Limit trash directory to be 25% of total DB 2017-06-12 16:57:21 -07:00
delete_scheduler.h Limit trash directory to be 25% of total DB 2017-06-12 16:57:21 -07:00
dynamic_bloom_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
dynamic_bloom.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
dynamic_bloom.h fixed typo in util/dynamic_bloom.h 2017-06-13 16:41:36 -07:00
event_logger_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
event_logger.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
event_logger.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
fault_injection_test_env.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
fault_injection_test_env.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
file_reader_writer_test.cc Make direct I/O write use incremental buffer 2017-06-13 04:41:37 -07:00
file_reader_writer.cc Call RateLimiter for compaction reads 2017-06-13 14:56:46 -07:00
file_reader_writer.h Call RateLimiter for compaction reads 2017-06-13 14:56:46 -07:00
file_util.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
file_util.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filelock_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filename.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filename.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
filter_policy.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
hash_map.h Use more efficient hash map for deadlock detection 2016-11-19 11:39:15 -08:00
hash.cc Avoid unsupported attributes when not building with UBSAN 2017-05-30 11:13:01 -07:00
hash.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
heap_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
heap.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
kv_map.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
log_buffer.cc travis: add Windows cross-compilation 2017-05-05 23:20:01 -07:00
log_buffer.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
log_write_bench.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
logging.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
memory_usage.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
mpsc.h Blob storage pr 2017-05-10 15:14:44 -07:00
murmurhash.cc Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
murmurhash.h Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
mutexlock.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
random.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
random.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
rate_limiter_test.cc Do not run RateLimiterTest.Rate test on Travis+Mac OSX. 2017-06-14 14:58:02 -07:00
rate_limiter.cc Call RateLimiter for compaction reads 2017-06-13 14:56:46 -07:00
rate_limiter.h Call RateLimiter for compaction reads 2017-06-13 14:56:46 -07:00
slice_transform_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
slice.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sst_file_manager_impl.cc Limit trash directory to be 25% of total DB 2017-06-12 16:57:21 -07:00
sst_file_manager_impl.h Limit trash directory to be 25% of total DB 2017-06-12 16:57:21 -07:00
status_message.cc Limit maximum memory used in the WriteBatch representation 2017-04-10 15:42:26 -07:00
status.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
stderr_logger.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
stop_watch.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
string_util.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
string_util.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sync_point.cc disable direct reads for log and manifest and add direct io to tests 2017-05-22 18:41:28 -07:00
sync_point.h disable direct reads for log and manifest and add direct io to tests 2017-05-22 18:41:28 -07:00
testharness.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testharness.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testutil.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
testutil.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_list_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_local_test.cc using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public… 2017-06-02 17:26:19 -07:00
thread_local.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
thread_local.h cross-platform compatibility improvements 2017-05-15 16:15:38 -07:00
thread_operation.h Gcc 7 error expansion to defined 2016-12-13 18:39:14 -08:00
threadpool_imp.cc New API for background work in single thread pool 2017-05-23 11:12:27 -07:00
threadpool_imp.h fixed typo 2017-06-13 16:58:01 -07:00
timer_queue_test.cc Blob storage pr 2017-05-10 15:14:44 -07:00
timer_queue.h Implement ReopenWritibaleFile on Windows and other fixes 2017-06-20 10:31:13 -07:00
transaction_test_util.cc Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
transaction_test_util.h Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
xxhash.cc fixed typo 2017-06-05 11:27:34 -07:00
xxhash.h Prevent xxhash symbols from polluting global namespace 2015-03-12 12:07:10 -07:00