rocksdb/db
Igor Canadi ae25742af9 Fix race condition in manifest roll
Summary:
When the manifest is getting rolled the following happens:
1) manifest_file_number_ is assigned to a new manifest number (even though the old one is still current)
2) mutex is unlocked
3) SetCurrentFile() creates temporary file manifest_file_number_.dbtmp
4) SetCurrentFile() renames manifest_file_number_.dbtmp to CURRENT
5) mutex is locked

If FindObsoleteFiles happens between (3) and (4) it will:
1) Delete manifest_file_number_.dbtmp (because it's not in pending_outputs_)
2) Delete old manifest (because the manifest_file_number_ already points to a new one)

I introduce the concept of prev_manifest_file_number_ that will avoid the race condition.

However, we should discuss the future of MANIFEST file rolling. We found some race conditions with it last week and who knows how many more are there. Nobody is using it in production because we don't trust the implementation. Should we even support it?

Test Plan: make check

Reviewers: ljin, dhruba, haobo, sdong

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D16929
2014-03-17 21:50:15 -07:00
..
builder.cc Put table factory back to public api 2014-02-03 19:51:20 -08:00
builder.h [Performance Branch] PlainTable to encode rows with seqID 0, value type using 1 internal byte. 2014-02-03 12:19:30 -08:00
c_test.c Fix C API 2014-02-24 15:15:34 -08:00
c.cc Consolidate SliceTransform object ownership 2014-03-10 12:56:46 -07:00
compaction_picker.cc [RocksDB] LogBuffer Cleanup 2014-03-10 11:05:44 -07:00
compaction_picker.h Buffer info logs when picking compactions and write them out after releasing the mutex 2014-03-05 15:36:32 -08:00
compaction.cc Merge pull request #47 from mlin/kCompactionStopStyleSimilarSize 2014-03-05 10:35:30 -08:00
compaction.h CompactionContext to include is_manual_compaction 2014-02-12 12:24:18 -08:00
corruption_test.cc Fix corruption_test failure caused by auto-enablement of checksum verification. 2014-01-31 17:16:38 -08:00
db_bench.cc Consolidate SliceTransform object ownership 2014-03-10 12:56:46 -07:00
db_filesnapshot.cc Move functions from VersionSet to Version 2014-01-15 16:18:04 -08:00
db_impl_readonly.cc use super_version in NewIterator() and MultiGet() function 2014-02-03 13:13:36 -08:00
db_impl_readonly.h CompactRange() to return status 2014-01-23 16:41:46 -08:00
db_impl.cc Fix race condition in manifest roll 2014-03-17 21:50:15 -07:00
db_impl.h Fix race condition in manifest roll 2014-03-17 21:50:15 -07:00
db_iter.cc Fix a bug that Prev() can hang. 2014-03-17 10:00:41 -07:00
db_iter.h Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
db_stats_logger.cc Move functions from VersionSet to Version 2014-01-15 16:18:04 -08:00
db_test.cc Fix a bug that Prev() can hang. 2014-03-17 10:00:41 -07:00
dbformat_test.cc Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
dbformat.cc [Performance Branch] PlainTable to encode rows with seqID 0, value type using 1 internal byte. 2014-02-03 12:19:30 -08:00
dbformat.h [Performance Branch] PlainTable to encode rows with seqID 0, value type using 1 internal byte. 2014-02-03 12:19:30 -08:00
deletefile_test.cc Start DeleteFileTest with clean plate 2013-11-15 16:30:23 -08:00
filename_test.cc Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
filename.cc Unify DeleteFile and DeleteWalFiles 2013-10-25 08:32:14 -07:00
filename.h Unify DeleteFile and DeleteWalFiles 2013-10-25 08:32:14 -07:00
internal_stats.cc InternalStatistics 2014-01-29 20:40:41 -08:00
internal_stats.h InternalStatistics 2014-01-29 20:40:41 -08:00
log_format.h Some minor refactoring on the code 2014-01-02 16:32:31 -08:00
log_reader.cc Make Log::Reader more robust 2014-02-28 13:19:47 -08:00
log_reader.h Fix UnmarkEOF for partial blocks 2014-01-27 14:49:10 -08:00
log_test.cc Make it compile on Debian/GCC 4.7 2014-03-14 22:44:35 +00:00
log_writer.cc Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
log_writer.h Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
memtable_list.cc IOError cleanup 2014-02-12 11:42:54 -08:00
memtable_list.h IOError cleanup 2014-02-12 11:42:54 -08:00
memtable.cc Correct the logic of MemTable::ShouldFlushNow(). 2014-03-17 12:20:11 -07:00
memtable.h A heuristic way to check if a memtable is full 2014-03-12 16:40:14 -07:00
merge_context.h Introduce MergeContext to Lazily Initialize merge operand list 2013-12-11 11:37:28 -08:00
merge_helper.cc Statistics code cleanup 2014-01-17 12:46:06 -08:00
merge_helper.h [RocksDB] Use raw pointer instead of shared pointer when passing Statistics object internally 2013-11-25 10:38:15 -08:00
merge_operator.cc Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
merge_test.cc Use ASSERT_EQ() instead of assert() in merge_test 2014-01-11 09:25:47 -08:00
perf_context_test.cc Missing includes 2014-03-14 13:02:20 -07:00
plain_table_db_test.cc Consolidate SliceTransform object ownership 2014-03-10 12:56:46 -07:00
prefix_filter_iterator.h Moving Some includes from options.h to forward declaration 2014-01-24 17:16:22 -08:00
prefix_test.cc Fix HashSkipList and HashLinkedList SIGSEGV 2014-03-14 10:02:04 -07:00
repair.cc Make Log::Reader more robust 2014-02-28 13:19:47 -08:00
simple_table_db_test.cc Make table properties shareable 2014-02-07 19:26:49 -08:00
skiplist_test.cc Clean up arena API 2014-01-30 22:10:10 -08:00
skiplist.h Consolidate SliceTransform object ownership 2014-03-10 12:56:46 -07:00
snapshot.h Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
table_cache.cc Expose the table properties to application 2014-02-13 16:28:21 -08:00
table_cache.h Expose the table properties to application 2014-02-13 16:28:21 -08:00
table_properties_collector_test.cc Fix problem 3 for issue #80 2014-02-11 17:52:18 -08:00
table_properties_collector.cc Extract metaindex block from block-based table 2013-12-05 16:34:16 -08:00
table_properties_collector.h Extract metaindex block from block-based table 2013-12-05 16:34:16 -08:00
tailing_iter.cc Consolidate SliceTransform object ownership 2014-03-10 12:56:46 -07:00
tailing_iter.h Tailing iterator 2014-01-23 16:26:08 -08:00
transaction_log_impl.cc Revert "Fix bad merge of D16791 and D16767" 2014-03-12 09:37:43 -07:00
transaction_log_impl.h Revert "Fix bad merge of D16791 and D16767" 2014-03-12 09:37:43 -07:00
version_edit_test.cc Remove compaction pointers 2014-01-16 14:06:53 -08:00
version_edit.cc Merge branch 'master' into performance 2014-01-16 14:31:18 -08:00
version_edit.h Merge branch 'master' into performance 2014-01-16 14:31:18 -08:00
version_set_test.cc Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00
version_set.cc Fix race condition in manifest roll 2014-03-17 21:50:15 -07:00
version_set.h Fix race condition in manifest roll 2014-03-17 21:50:15 -07:00
write_batch_internal.h In-place updates for equal keys and similar sized values 2013-10-31 11:27:12 -07:00
write_batch_test.cc [Performance Branch] PlainTable to encode rows with seqID 0, value type using 1 internal byte. 2014-02-03 12:19:30 -08:00
write_batch.cc Merge branch 'master' into performance 2014-01-23 16:32:49 -08:00