Revision 499ebb3ab5ea4207950fc95acf102b8f58add1c5 authored by Maysam Yabandeh on 24 June 2017, 21:06:43 UTC, committed by Facebook Github Bot on 24 June 2017, 21:11:29 UTC
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
1 parent 0ac4afb
History
File Mode Size
builder.cc -rw-r--r-- 8.7 KB
builder.h -rw-r--r-- 3.5 KB
c.cc -rw-r--r-- 107.2 KB
c_test.c -rw-r--r-- 48.1 KB
column_family.cc -rw-r--r-- 42.2 KB
column_family.h -rw-r--r-- 22.6 KB
column_family_test.cc -rw-r--r-- 108.2 KB
compact_files_test.cc -rw-r--r-- 9.6 KB
compacted_db_impl.cc -rw-r--r-- 5.8 KB
compacted_db_impl.h -rw-r--r-- 3.9 KB
compaction.cc -rw-r--r-- 15.9 KB
compaction.h -rw-r--r-- 11.9 KB
compaction_iteration_stats.h -rw-r--r-- 1.3 KB
compaction_iterator.cc -rw-r--r-- 24.3 KB
compaction_iterator.h -rw-r--r-- 7.9 KB
compaction_iterator_test.cc -rw-r--r-- 16.0 KB
compaction_job.cc -rw-r--r-- 54.3 KB
compaction_job.h -rw-r--r-- 5.6 KB
compaction_job_stats_test.cc -rw-r--r-- 35.7 KB
compaction_job_test.cc -rw-r--r-- 34.6 KB
compaction_picker.cc -rw-r--r-- 55.2 KB
compaction_picker.h -rw-r--r-- 12.1 KB
compaction_picker_test.cc -rw-r--r-- 50.5 KB
compaction_picker_universal.cc -rw-r--r-- 27.4 KB
compaction_picker_universal.h -rw-r--r-- 3.8 KB
comparator_db_test.cc -rw-r--r-- 12.6 KB
convenience.cc -rw-r--r-- 1.1 KB
corruption_test.cc -rw-r--r-- 15.0 KB
cuckoo_table_db_test.cc -rw-r--r-- 9.9 KB
db_basic_test.cc -rw-r--r-- 28.0 KB
db_block_cache_test.cc -rw-r--r-- 22.0 KB
db_bloom_filter_test.cc -rw-r--r-- 39.7 KB
db_compaction_filter_test.cc -rw-r--r-- 27.1 KB
db_compaction_test.cc -rw-r--r-- 89.9 KB
db_dynamic_level_test.cc -rw-r--r-- 17.0 KB
db_filesnapshot.cc -rw-r--r-- 4.5 KB
db_flush_test.cc -rw-r--r-- 5.6 KB
db_impl.cc -rw-r--r-- 92.8 KB
db_impl.h -rw-r--r-- 49.5 KB
db_impl_compaction_flush.cc -rw-r--r-- 66.7 KB
db_impl_debug.cc -rw-r--r-- 5.9 KB
db_impl_experimental.cc -rw-r--r-- 5.6 KB
db_impl_files.cc -rw-r--r-- 19.2 KB
db_impl_open.cc -rw-r--r-- 38.9 KB
db_impl_readonly.cc -rw-r--r-- 7.0 KB
db_impl_readonly.h -rw-r--r-- 4.6 KB
db_impl_write.cc -rw-r--r-- 45.1 KB
db_info_dumper.cc -rw-r--r-- 3.9 KB
db_info_dumper.h -rw-r--r-- 654 bytes
db_inplace_update_test.cc -rw-r--r-- 5.8 KB
db_io_failure_test.cc -rw-r--r-- 8.5 KB
db_iter.cc -rw-r--r-- 40.7 KB
db_iter.h -rw-r--r-- 3.4 KB
db_iter_test.cc -rw-r--r-- 94.2 KB
db_iterator_test.cc -rw-r--r-- 57.8 KB
db_log_iter_test.cc -rw-r--r-- 9.8 KB
db_memtable_test.cc -rw-r--r-- 6.5 KB
db_merge_operator_test.cc -rw-r--r-- 11.2 KB
db_options_test.cc -rw-r--r-- 15.1 KB
db_properties_test.cc -rw-r--r-- 47.6 KB
db_range_del_test.cc -rw-r--r-- 31.6 KB
db_sst_test.cc -rw-r--r-- 28.7 KB
db_statistics_test.cc -rw-r--r-- 5.3 KB
db_table_properties_test.cc -rw-r--r-- 8.1 KB
db_tailing_iter_test.cc -rw-r--r-- 24.0 KB
db_test.cc -rw-r--r-- 171.0 KB
db_test2.cc -rw-r--r-- 80.5 KB
db_test_util.cc -rw-r--r-- 42.5 KB
db_test_util.h -rw-r--r-- 28.6 KB
db_universal_compaction_test.cc -rw-r--r-- 50.5 KB
db_wal_test.cc -rw-r--r-- 42.2 KB
db_write_test.cc -rw-r--r-- 2.9 KB
dbformat.cc -rw-r--r-- 6.0 KB
dbformat.h -rw-r--r-- 19.2 KB
dbformat_test.cc -rw-r--r-- 7.1 KB
deletefile_test.cc -rw-r--r-- 16.2 KB
event_helpers.cc -rw-r--r-- 5.0 KB
event_helpers.h -rw-r--r-- 2.1 KB
experimental.cc -rw-r--r-- 1.8 KB
external_sst_file_basic_test.cc -rw-r--r-- 23.8 KB
external_sst_file_ingestion_job.cc -rw-r--r-- 23.5 KB
external_sst_file_ingestion_job.h -rw-r--r-- 6.2 KB
external_sst_file_test.cc -rw-r--r-- 66.4 KB
fault_injection_test.cc -rw-r--r-- 16.6 KB
file_indexer.cc -rw-r--r-- 7.7 KB
file_indexer.h -rw-r--r-- 6.2 KB
file_indexer_test.cc -rw-r--r-- 10.0 KB
filename_test.cc -rw-r--r-- 5.8 KB
flush_job.cc -rw-r--r-- 13.1 KB
flush_job.h -rw-r--r-- 3.7 KB
flush_job_test.cc -rw-r--r-- 8.2 KB
flush_scheduler.cc -rw-r--r-- 2.5 KB
flush_scheduler.h -rw-r--r-- 1.4 KB
forward_iterator.cc -rw-r--r-- 27.5 KB
forward_iterator.h -rw-r--r-- 5.3 KB
forward_iterator_bench.cc -rw-r--r-- 11.4 KB
internal_stats.cc -rw-r--r-- 50.0 KB
internal_stats.h -rw-r--r-- 20.1 KB
job_context.h -rw-r--r-- 4.2 KB
listener_test.cc -rw-r--r-- 28.8 KB
log_format.h -rw-r--r-- 1.5 KB
log_reader.cc -rw-r--r-- 14.0 KB
log_reader.h -rw-r--r-- 5.6 KB
log_test.cc -rw-r--r-- 21.7 KB
log_writer.cc -rw-r--r-- 4.7 KB
log_writer.h -rw-r--r-- 3.9 KB
malloc_stats.cc -rw-r--r-- 1.5 KB
malloc_stats.h -rw-r--r-- 661 bytes
managed_iterator.cc -rw-r--r-- 6.8 KB
managed_iterator.h -rw-r--r-- 2.6 KB
manual_compaction_test.cc -rw-r--r-- 4.6 KB
memtable.cc -rw-r--r-- 31.8 KB
memtable.h -rw-r--r-- 16.5 KB
memtable_list.cc -rw-r--r-- 16.2 KB
memtable_list.h -rw-r--r-- 9.6 KB
memtable_list_test.cc -rw-r--r-- 21.6 KB
merge_context.h -rw-r--r-- 3.3 KB
merge_helper.cc -rw-r--r-- 14.4 KB
merge_helper.h -rw-r--r-- 8.4 KB
merge_helper_test.cc -rw-r--r-- 11.3 KB
merge_operator.cc -rw-r--r-- 3.2 KB
merge_test.cc -rw-r--r-- 14.1 KB
options_file_test.cc -rw-r--r-- 3.7 KB
perf_context_test.cc -rw-r--r-- 22.9 KB
pinned_iterators_manager.h -rw-r--r-- 2.6 KB
plain_table_db_test.cc -rw-r--r-- 39.9 KB
prefix_test.cc -rw-r--r-- 29.4 KB
range_del_aggregator.cc -rw-r--r-- 21.2 KB
range_del_aggregator.h -rw-r--r-- 7.8 KB
range_del_aggregator_test.cc -rw-r--r-- 5.1 KB
repair.cc -rw-r--r-- 22.5 KB
repair_test.cc -rw-r--r-- 9.8 KB
snapshot_impl.cc -rw-r--r-- 940 bytes
snapshot_impl.h -rw-r--r-- 3.7 KB
table_cache.cc -rw-r--r-- 16.1 KB
table_cache.h -rw-r--r-- 6.4 KB
table_properties_collector.cc -rw-r--r-- 4.2 KB
table_properties_collector.h -rw-r--r-- 4.4 KB
table_properties_collector_test.cc -rw-r--r-- 18.0 KB
transaction_log_impl.cc -rw-r--r-- 9.1 KB
transaction_log_impl.h -rw-r--r-- 4.4 KB
version_builder.cc -rw-r--r-- 13.8 KB
version_builder.h -rw-r--r-- 1.8 KB
version_builder_test.cc -rw-r--r-- 10.5 KB
version_edit.cc -rw-r--r-- 16.6 KB
version_edit.h -rw-r--r-- 10.0 KB
version_edit_test.cc -rw-r--r-- 6.5 KB
version_set.cc -rw-r--r-- 133.7 KB
version_set.h -rw-r--r-- 33.4 KB
version_set_test.cc -rw-r--r-- 14.8 KB
wal_manager.cc -rw-r--r-- 16.0 KB
wal_manager.h -rw-r--r-- 3.3 KB
wal_manager_test.cc -rw-r--r-- 9.7 KB
write_batch.cc -rw-r--r-- 47.0 KB
write_batch_base.cc -rw-r--r-- 3.2 KB
write_batch_internal.h -rw-r--r-- 8.3 KB
write_batch_test.cc -rw-r--r-- 26.7 KB
write_callback.h -rw-r--r-- 838 bytes
write_callback_test.cc -rw-r--r-- 11.5 KB
write_controller.cc -rw-r--r-- 4.2 KB
write_controller.h -rw-r--r-- 4.9 KB
write_controller_test.cc -rw-r--r-- 4.8 KB
write_thread.cc -rw-r--r-- 22.6 KB
write_thread.h -rw-r--r-- 14.4 KB

back to top