rocksdb/table
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
..
adaptive_table_factory.cc solve the problem of table_factory_to_write_=nullptr (#1342) 2016-09-20 10:11:51 -07:00
adaptive_table_factory.h Only cache level 0 indexes and filter when opening table reader 2016-07-20 11:23:31 -07:00
block_based_filter_block_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_based_filter_block.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_based_filter_block.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_based_table_builder.cc record index partition properties 2017-06-13 11:21:32 -07:00
block_based_table_builder.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_based_table_factory.cc Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
block_based_table_factory.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_based_table_reader.cc record index partition properties 2017-06-13 11:21:32 -07:00
block_based_table_reader.h Remoe unused BlockBasedTable::compaction_optimized_ 2017-05-18 06:41:23 -07:00
block_builder.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_builder.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
block_prefix_index.cc Fix clang analyzer errors 2016-07-08 17:50:51 -07:00
block_prefix_index.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
block_test.cc unbiase readamp bitmap 2017-05-10 01:49:52 -07:00
block.cc support merge and delete in file ingestion 2017-05-26 12:11:21 -07:00
block.h unbiase readamp bitmap 2017-05-10 01:49:52 -07:00
bloom_block.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
bloom_block.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
cleanable_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
cuckoo_table_builder_test.cc Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
cuckoo_table_builder.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
cuckoo_table_builder.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
cuckoo_table_factory.cc Only cache level 0 indexes and filter when opening table reader 2016-07-20 11:23:31 -07:00
cuckoo_table_factory.h Fix interaction between CompactionFilter::Decision::kRemoveAndSkipUnt… 2017-06-02 15:11:38 -07:00
cuckoo_table_reader_test.cc Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
cuckoo_table_reader.cc Fix interaction between CompactionFilter::Decision::kRemoveAndSkipUnt… 2017-06-02 15:11:38 -07:00
cuckoo_table_reader.h do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
filter_block.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
flush_block_policy.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
format.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
format.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
full_filter_block_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
full_filter_block.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
full_filter_block.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
get_context.cc Sample number of reads per SST file 2017-06-12 07:12:08 -07:00
get_context.h Sample number of reads per SST file 2017-06-12 07:12:08 -07:00
index_builder.cc record index partition properties 2017-06-13 11:21:32 -07:00
index_builder.h record index partition properties 2017-06-13 11:21:32 -07:00
internal_iterator.h fix assertion failure in Prev() 2016-10-13 17:36:48 -07:00
iter_heap.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
iterator_wrapper.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
iterator.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
merger_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
merging_iterator.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
merging_iterator.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
meta_blocks.cc record index partition properties 2017-06-13 11:21:32 -07:00
meta_blocks.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
mock_table.cc do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
mock_table.h do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
partitioned_filter_block_test.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
partitioned_filter_block.cc Fix concurrency issue with filter_block_set_ 2017-06-06 12:56:52 -07:00
partitioned_filter_block.h Object lifetime in cache 2017-05-05 23:20:01 -07:00
persistent_cache_helper.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
persistent_cache_helper.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
persistent_cache_options.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_builder.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_builder.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_factory.cc store prefix_extractor_name in table 2016-08-26 11:46:32 -07:00
plain_table_factory.h Only cache level 0 indexes and filter when opening table reader 2016-07-20 11:23:31 -07:00
plain_table_index.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_index.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_key_coding.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_key_coding.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
plain_table_reader.cc Fix interaction between CompactionFilter::Decision::kRemoveAndSkipUnt… 2017-06-02 15:11:38 -07:00
plain_table_reader.h do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
scoped_arena_iterator.h Compaction Support for Range Deletion 2016-10-18 12:04:56 -07:00
sst_file_writer_collectors.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sst_file_writer.cc support merge and delete in file ingestion 2017-05-26 12:11:21 -07:00
table_builder.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
table_properties_internal.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
table_properties.cc record index partition properties 2017-06-13 11:21:32 -07:00
table_reader_bench.cc Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
table_reader.h do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
table_test.cc using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public… 2017-06-02 17:26:19 -07:00
two_level_iterator.cc do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00
two_level_iterator.h do not read next datablock if upperbound is reached 2017-05-05 23:20:01 -07:00