Address windows build issues

Intro SubCompactionState move functionality
 =delete copy functionality
 #ifdef SyncPoint in tests for Windows Release builds
main
Dmitri Smirnov 9 years ago
parent b604d2562f
commit 1cac89c9b1
  1. 31
      db/compaction_job.cc
  2. 9
      db/db_compaction_test.cc
  3. 7
      db/db_universal_compaction_test.cc
  4. 8
      db/fault_injection_test.cc

@ -59,7 +59,7 @@ namespace rocksdb {
// Maintains state for each sub-compaction
struct CompactionJob::SubCompactionState {
Compaction* const compaction;
Compaction* compaction;
// The boundaries of the key-range this compaction is interested in. No two
// subcompactions may have overlapping key-ranges.
@ -113,7 +113,7 @@ struct CompactionJob::SubCompactionState {
// is in or beyond the last file checked during the previous call
std::vector<size_t> level_ptrs;
explicit SubCompactionState(Compaction* c, Slice* _start, Slice* _end,
SubCompactionState(Compaction* c, Slice* _start, Slice* _end,
SequenceNumber earliest, SequenceNumber visible,
SequenceNumber latest)
: compaction(c),
@ -130,6 +130,33 @@ struct CompactionJob::SubCompactionState {
assert(compaction != nullptr);
level_ptrs = std::vector<size_t>(compaction->number_levels(), 0);
}
SubCompactionState(SubCompactionState&& o) {
*this = std::move(o);
}
SubCompactionState& operator=(SubCompactionState&& o) {
compaction = std::move(o.compaction);
start = std::move(o.start);
end = std::move(o.end);
status = std::move(o.status);
outputs = std::move(o.outputs);
outfile = std::move(o.outfile);
builder = std::move(o.builder);
total_bytes = std::move(o.total_bytes);
num_input_records = std::move(o.num_input_records);
num_output_records = std::move(o.num_output_records);
earliest_snapshot = std::move(o.earliest_snapshot);
visible_at_tip = std::move(o.visible_at_tip);
latest_snapshot = std::move(o.latest_snapshot);
level_ptrs = std::move(o.level_ptrs);
return *this;
}
// Because member unique_ptrs do not have these.
SubCompactionState(const SubCompactionState&) = delete;
SubCompactionState& operator=(const SubCompactionState&) = delete;
};
// Maintains state for the entire compaction

@ -13,6 +13,10 @@
#include "util/sync_point.h"
namespace rocksdb {
// SYNC_POINT is not supported in released Windows mode.
#if !(defined NDEBUG) || !defined(OS_WIN)
class DBCompactionTest : public DBTestBase {
public:
DBCompactionTest() : DBTestBase("/db_compaction_test") {}
@ -1647,8 +1651,6 @@ TEST_P(DBCompactionTestWithParam, CompressLevelCompaction) {
Destroy(options);
}
// SYNC_POINT is not supported in released Windows mode.
#if !(defined NDEBUG) || !defined(OS_WIN)
// This tests for a bug that could cause two level0 compactions running
// concurrently
TEST_P(DBCompactionTestWithParam, SuggestCompactRangeNoTwoLevel0Compactions) {
@ -1705,7 +1707,6 @@ TEST_P(DBCompactionTestWithParam, SuggestCompactRangeNoTwoLevel0Compactions) {
dbfull()->TEST_WaitForCompact();
}
#endif // !(defined NDEBUG) || !defined(OS_WIN)
TEST_P(DBCompactionTestWithParam, ForceBottommostLevelCompaction) {
int32_t trivial_move = 0;
@ -1792,7 +1793,7 @@ TEST_P(DBCompactionTestWithParam, ForceBottommostLevelCompaction) {
INSTANTIATE_TEST_CASE_P(DBCompactionTestWithParam, DBCompactionTestWithParam,
::testing::Values(1, 4));
#endif // !(defined NDEBUG) || !defined(OS_WIN)
} // namespace rocksdb
int main(int argc, char** argv) {

@ -11,7 +11,6 @@
#include "util/db_test_util.h"
#if !(defined NDEBUG) || !defined(OS_WIN)
#include "util/sync_point.h"
#endif
namespace rocksdb {
@ -113,9 +112,6 @@ class DelayFilterFactory : public CompactionFilterFactory {
};
} // namespace
// SyncPoint is not supported in released Windows mode.
#if !(defined NDEBUG) || !defined(OS_WIN)
// TODO(kailiu) The tests on UniversalCompaction has some issues:
// 1. A lot of magic numbers ("11" or "12").
// 2. Made assumption on the memtable flush conditions, which may change from
@ -257,7 +253,6 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrigger) {
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
}
#endif // !(defined NDEBUG) || !defined(OS_WIN)
TEST_P(DBTestUniversalCompaction, UniversalCompactionSizeAmplification) {
Options options;
@ -1241,6 +1236,8 @@ INSTANTIATE_TEST_CASE_P(DBTestUniversalManualCompactionOutputPathId,
} // namespace rocksdb
#endif // !(defined NDEBUG) || !defined(OS_WIN)
int main(int argc, char** argv) {
#if !(defined NDEBUG) || !defined(OS_WIN)
rocksdb::port::InstallStackTraceHandler();

@ -11,6 +11,8 @@
// the last "sync". It then checks for data loss errors by purposely dropping
// file data (or entire files) not protected by a "sync".
#if !(defined NDEBUG) || !defined(OS_WIN)
#include <map>
#include <set>
#include "db/db_impl.h"
@ -931,7 +933,13 @@ INSTANTIATE_TEST_CASE_P(FaultTest, FaultInjectionTest, ::testing::Bool());
} // namespace rocksdb
#endif // #if !(defined NDEBUG) || !defined(OS_WIN)
int main(int argc, char** argv) {
#if !(defined NDEBUG) || !defined(OS_WIN)
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
#else
return 0;
#endif
}

Loading…
Cancel
Save