rocksdb/utilities
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
..
backupable Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
blob_db Implement ReopenWritibaleFile on Windows and other fixes 2017-06-20 10:31:13 -07:00
checkpoint Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
compaction_filters Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
convenience Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
date_tiered Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
document fixed typo 2017-06-05 11:27:34 -07:00
geodb Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
leveldb_options Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
lua Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
memory Disable auto compactions in memory_test and re-enable the test (#1408) 2016-10-19 18:18:42 -07:00
merge_operators Fix cassandra ASAN use-after-free 2017-06-20 13:27:16 -07:00
option_change_migration Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
options Downgrade option sanitiy check level for prefix_extractor 2017-06-22 16:26:36 -07:00
persistent_cache Fix data races caught by tsan 2017-05-22 10:27:23 -07:00
redis Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
simulator_cache Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
spatialdb Suppress clang-analyzer false positive 2017-05-19 10:56:28 -07:00
table_properties_collectors Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
transactions Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
ttl Move various string utility functions into string_util 2017-04-06 14:54:12 -07:00
write_batch_with_index support PopSavePoint for WriteBatch 2017-05-03 10:57:45 -07:00
col_buf_decoder.cc fix non-portable behavior in encoder 2017-01-20 16:39:22 -08:00
col_buf_decoder.h Fix clang build failure and refactor unit test 2016-08-02 15:16:39 -07:00
col_buf_encoder.cc Avoid unsupported attributes when not building with UBSAN 2017-05-30 11:13:01 -07:00
col_buf_encoder.h Fix clang build failure and refactor unit test 2016-08-02 15:16:39 -07:00
column_aware_encoding_exp.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
column_aware_encoding_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
column_aware_encoding_util.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
column_aware_encoding_util.h Move some files under util/ to separate dirs 2017-04-05 19:09:16 -07:00
debug.cc Add GetAllKeyVersions API 2017-05-12 15:54:06 -07:00
env_librados_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
env_librados.cc Remove double buffering on RandomRead on Windows. 2017-04-27 12:30:05 -07:00
env_librados.md Add EnvLibrados - RocksDB Env of RADOS (#1222) 2016-07-21 11:16:34 -07:00
env_mirror_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
env_mirror.cc Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
env_timed_test.cc using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public… 2017-06-02 17:26:19 -07:00
env_timed.cc Move some files under util/ to separate dirs 2017-04-05 19:09:16 -07:00
merge_operators.h Create a MergeOperator for Cassandra Row Value 2017-06-16 14:27:00 -07:00
object_registry_test.cc Generalize Env registration framework 2017-01-25 16:09:14 -08:00
util_merge_operators_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00