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
This commit is contained in:
Yi Wu 2017-10-17 08:49:11 -07:00 committed by Facebook Github Bot
parent 731895214b
commit 8e63cad078
5 changed files with 17 additions and 28 deletions

View File

@ -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}" == '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 [ "${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}" == '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}" == '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' ]; 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 - 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

View File

@ -343,27 +343,7 @@ LITE_BUILD_COMMANDS="[
$CLEANUP_ENV, $CLEANUP_ENV,
{ {
'name':'Build RocksDB debug version', 'name':'Build RocksDB debug version',
'shell':'$LITE make J=1 static_lib || $CONTRUN_NAME=lite_static_lib $TASK_CREATION_TOOL', 'shell':'$LITE make J=1 all check || $CONTRUN_NAME=lite $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',
'user':'root', 'user':'root',
$PARSER $PARSER
}, },
@ -748,9 +728,6 @@ case $1 in
lite) lite)
echo $LITE_BUILD_COMMANDS echo $LITE_BUILD_COMMANDS
;; ;;
lite_test)
echo $LITE_UNIT_TEST_COMMANDS
;;
stress_crash) stress_crash)
echo $STRESS_CRASH_TEST_COMMANDS echo $STRESS_CRASH_TEST_COMMANDS
;; ;;

View File

@ -123,7 +123,9 @@ class DBBlobIndexTest : public DBTestBase {
ASSERT_OK(Flush()); ASSERT_OK(Flush());
ASSERT_OK( ASSERT_OK(
dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr)); dbfull()->CompactRange(CompactRangeOptions(), nullptr, nullptr));
#ifndef ROCKSDB_LITE
ASSERT_EQ("0,1", FilesPerLevel()); ASSERT_EQ("0,1", FilesPerLevel());
#endif // !ROCKSDB_LITE
break; break;
} }
} }

View File

@ -2316,15 +2316,21 @@ TEST_F(DBTest2, ReduceLevel) {
Put("foo", "bar"); Put("foo", "bar");
Flush(); Flush();
MoveFilesToLevel(6); MoveFilesToLevel(6);
#ifndef ROCKSDB_LITE
ASSERT_EQ("0,0,0,0,0,0,1", FilesPerLevel()); ASSERT_EQ("0,0,0,0,0,0,1", FilesPerLevel());
#endif // !ROCKSDB_LITE
CompactRangeOptions compact_options; CompactRangeOptions compact_options;
compact_options.change_level = true; compact_options.change_level = true;
compact_options.target_level = 1; compact_options.target_level = 1;
dbfull()->CompactRange(compact_options, nullptr, nullptr); dbfull()->CompactRange(compact_options, nullptr, nullptr);
#ifndef ROCKSDB_LITE
ASSERT_EQ("0,1", FilesPerLevel()); ASSERT_EQ("0,1", FilesPerLevel());
#endif // !ROCKSDB_LITE
options.num_levels = 3; options.num_levels = 3;
Reopen(options); Reopen(options);
#ifndef ROCKSDB_LITE
ASSERT_EQ("0,1", FilesPerLevel()); ASSERT_EQ("0,1", FilesPerLevel());
#endif // !ROCKSDB_LITE
} }
// Test that ReadCallback is actually used in both memtbale and sst tables // Test that ReadCallback is actually used in both memtbale and sst tables
@ -2358,14 +2364,18 @@ TEST_F(DBTest2, ReadCallbackTest) {
} }
Flush(); Flush();
MoveFilesToLevel(6); MoveFilesToLevel(6);
#ifndef ROCKSDB_LITE
ASSERT_EQ("0,0,0,0,0,0,2", FilesPerLevel()); ASSERT_EQ("0,0,0,0,0,0,2", FilesPerLevel());
#endif // !ROCKSDB_LITE
for (; i < 30; i++) { for (; i < 30; i++) {
Put(key, value + std::to_string(i)); Put(key, value + std::to_string(i));
auto snapshot = dbfull()->GetSnapshot(); auto snapshot = dbfull()->GetSnapshot();
snapshots.push_back(snapshot); snapshots.push_back(snapshot);
} }
Flush(); Flush();
#ifndef ROCKSDB_LITE
ASSERT_EQ("1,0,0,0,0,0,2", FilesPerLevel()); ASSERT_EQ("1,0,0,0,0,0,2", FilesPerLevel());
#endif // !ROCKSDB_LITE
// And also add some values to the memtable // And also add some values to the memtable
for (; i < 40; i++) { for (; i < 40; i++) {
Put(key, value + std::to_string(i)); Put(key, value + std::to_string(i));

View File

@ -42,6 +42,9 @@ static std::map<CompactionStopStyle, std::string>
{kCompactionStopStyleSimilarSize, "kCompactionStopStyleSimilarSize"}, {kCompactionStopStyleSimilarSize, "kCompactionStopStyleSimilarSize"},
{kCompactionStopStyleTotalSize, "kCompactionStopStyleTotalSize"}}; {kCompactionStopStyleTotalSize, "kCompactionStopStyleTotalSize"}};
static std::unordered_map<std::string, ChecksumType> checksum_type_string_map =
{{"kNoChecksum", kNoChecksum}, {"kCRC32c", kCRC32c}, {"kxxHash", kxxHash}};
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
Status GetMutableOptionsFromStrings( Status GetMutableOptionsFromStrings(
@ -609,9 +612,6 @@ static std::unordered_map<std::string, BlockBasedTableOptions::IndexType>
static std::unordered_map<std::string, EncodingType> encoding_type_string_map = static std::unordered_map<std::string, EncodingType> encoding_type_string_map =
{{"kPlain", kPlain}, {"kPrefix", kPrefix}}; {{"kPlain", kPlain}, {"kPrefix", kPrefix}};
static std::unordered_map<std::string, ChecksumType> checksum_type_string_map =
{{"kNoChecksum", kNoChecksum}, {"kCRC32c", kCRC32c}, {"kxxHash", kxxHash}};
static std::unordered_map<std::string, CompactionStyle> static std::unordered_map<std::string, CompactionStyle>
compaction_style_string_map = { compaction_style_string_map = {
{"kCompactionStyleLevel", kCompactionStyleLevel}, {"kCompactionStyleLevel", kCompactionStyleLevel},