From 8e63cad078503941530b1c8278dbef32d0027255 Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Tue, 17 Oct 2017 08:49:11 -0700 Subject: [PATCH] fix lite build Summary: * make `checksum_type_string_map` available for lite * comment out `FilesPerLevel` in lite mode. * travis and legocastle lite build also build `all` target and run tests Closes https://github.com/facebook/rocksdb/pull/3015 Differential Revision: D6069822 Pulled By: yiwu-arbug fbshipit-source-id: 9fe92ac220e711e9e6ed4e921bd25ef4314796a0 --- .travis.yml | 2 +- build_tools/rocksdb-lego-determinator | 25 +------------------------ db/db_blob_index_test.cc | 2 ++ db/db_test2.cc | 10 ++++++++++ options/options_helper.h | 6 +++--- 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73d18dab9..5fcc7d52b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ script: - if [ "${TEST_GROUP}" == '2' ]; then OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=comparator_db_test ROCKSDBTESTS_END=write_prepared_transaction_test make -j4 check_some; fi - if [ "${TEST_GROUP}" == '3' ]; then OPT=-DTRAVIS V=1 ROCKSDBTESTS_START=write_prepared_transaction_test make -j4 check_some; fi - if [ "${JOB_NAME}" == 'java_test' ]; then OPT=-DTRAVIS V=1 make clean jclean && make rocksdbjava jtest; fi - - if [ "${JOB_NAME}" == 'lite_build' ]; then OPT="-DTRAVIS -DROCKSDB_LITE" V=1 make -j4 static_lib; fi + - if [ "${JOB_NAME}" == 'lite_build' ]; then OPT="-DTRAVIS -DROCKSDB_LITE" V=1 make -j4 static_lib tools; fi - if [ "${JOB_NAME}" == 'examples' ]; then OPT=-DTRAVIS V=1 make -j4 static_lib; cd examples; make -j4; fi - if [ "${JOB_NAME}" == 'cmake' ]; then mkdir build && cd build && cmake .. && make -j4 rocksdb; fi - if [ "${JOB_NAME}" == 'cmake-mingw' ]; then mkdir build && cd build && cmake .. -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_SYSTEM_NAME=Windows && make -j4 rocksdb; fi diff --git a/build_tools/rocksdb-lego-determinator b/build_tools/rocksdb-lego-determinator index a40b3064e..6e8ae9cd7 100755 --- a/build_tools/rocksdb-lego-determinator +++ b/build_tools/rocksdb-lego-determinator @@ -343,27 +343,7 @@ LITE_BUILD_COMMANDS="[ $CLEANUP_ENV, { 'name':'Build RocksDB debug version', - 'shell':'$LITE make J=1 static_lib || $CONTRUN_NAME=lite_static_lib $TASK_CREATION_TOOL', - 'user':'root', - $PARSER - }, - ], - $REPORT - } -]" - -# -# RocksDB lite tests -# -LITE_UNIT_TEST_COMMANDS="[ - { - 'name':'Rocksdb Lite Unit Test', - 'oncall':'$ONCALL', - 'steps': [ - $CLEANUP_ENV, - { - 'name':'Build RocksDB debug version', - 'shell':'$SHM $LITE make J=1 check || $CONTRUN_NAME=lite_check $TASK_CREATION_TOOL', + 'shell':'$LITE make J=1 all check || $CONTRUN_NAME=lite $TASK_CREATION_TOOL', 'user':'root', $PARSER }, @@ -748,9 +728,6 @@ case $1 in lite) echo $LITE_BUILD_COMMANDS ;; - lite_test) - echo $LITE_UNIT_TEST_COMMANDS - ;; stress_crash) echo $STRESS_CRASH_TEST_COMMANDS ;; diff --git a/db/db_blob_index_test.cc b/db/db_blob_index_test.cc index 43aa3a534..005a23d63 100644 --- a/db/db_blob_index_test.cc +++ b/db/db_blob_index_test.cc @@ -123,7 +123,9 @@ class DBBlobIndexTest : public DBTestBase { ASSERT_OK(Flush()); ASSERT_OK( dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr)); +#ifndef ROCKSDB_LITE ASSERT_EQ("0,1", FilesPerLevel()); +#endif // !ROCKSDB_LITE break; } } diff --git a/db/db_test2.cc b/db/db_test2.cc index 4b635f7fd..26441044d 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -2316,15 +2316,21 @@ TEST_F(DBTest2, ReduceLevel) { Put("foo", "bar"); Flush(); MoveFilesToLevel(6); +#ifndef ROCKSDB_LITE ASSERT_EQ("0,0,0,0,0,0,1", FilesPerLevel()); +#endif // !ROCKSDB_LITE CompactRangeOptions compact_options; compact_options.change_level = true; compact_options.target_level = 1; dbfull()->CompactRange(compact_options, nullptr, nullptr); +#ifndef ROCKSDB_LITE ASSERT_EQ("0,1", FilesPerLevel()); +#endif // !ROCKSDB_LITE options.num_levels = 3; Reopen(options); +#ifndef ROCKSDB_LITE ASSERT_EQ("0,1", FilesPerLevel()); +#endif // !ROCKSDB_LITE } // Test that ReadCallback is actually used in both memtbale and sst tables @@ -2358,14 +2364,18 @@ TEST_F(DBTest2, ReadCallbackTest) { } Flush(); MoveFilesToLevel(6); +#ifndef ROCKSDB_LITE ASSERT_EQ("0,0,0,0,0,0,2", FilesPerLevel()); +#endif // !ROCKSDB_LITE for (; i < 30; i++) { Put(key, value + std::to_string(i)); auto snapshot = dbfull()->GetSnapshot(); snapshots.push_back(snapshot); } Flush(); +#ifndef ROCKSDB_LITE ASSERT_EQ("1,0,0,0,0,0,2", FilesPerLevel()); +#endif // !ROCKSDB_LITE // And also add some values to the memtable for (; i < 40; i++) { Put(key, value + std::to_string(i)); diff --git a/options/options_helper.h b/options/options_helper.h index 61d31fd39..49ab09f5a 100644 --- a/options/options_helper.h +++ b/options/options_helper.h @@ -42,6 +42,9 @@ static std::map {kCompactionStopStyleSimilarSize, "kCompactionStopStyleSimilarSize"}, {kCompactionStopStyleTotalSize, "kCompactionStopStyleTotalSize"}}; +static std::unordered_map checksum_type_string_map = + {{"kNoChecksum", kNoChecksum}, {"kCRC32c", kCRC32c}, {"kxxHash", kxxHash}}; + #ifndef ROCKSDB_LITE Status GetMutableOptionsFromStrings( @@ -609,9 +612,6 @@ static std::unordered_map static std::unordered_map encoding_type_string_map = {{"kPlain", kPlain}, {"kPrefix", kPrefix}}; -static std::unordered_map checksum_type_string_map = - {{"kNoChecksum", kNoChecksum}, {"kCRC32c", kCRC32c}, {"kxxHash", kxxHash}}; - static std::unordered_map compaction_style_string_map = { {"kCompactionStyleLevel", kCompactionStyleLevel},