Fix clang13 build error (#9374)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/9374

Test Plan: Add CI for clang13 build

Reviewed By: riversand963

Differential Revision: D33522867

Pulled By: jay-zhuang

fbshipit-source-id: 642756825cf0b51e35861fb847ebaee4611b76ca
main
Jay Zhuang 3 years ago committed by Facebook GitHub Bot
parent 1973fcba11
commit 9c6fb26033
  1. 22
      .circleci/config.yml
  2. 6
      db/compaction/compaction_picker_test.cc
  3. 3
      db/db_basic_test.cc
  4. 5
      db/db_test2.cc
  5. 1
      options/db_options.h
  6. 4
      utilities/env_mirror.cc

@ -83,6 +83,17 @@ commands:
echo "APT::Acquire::Retries \"10\";" | sudo tee -a /etc/apt/apt.conf.d/80-retries # llvm.org unreliable echo "APT::Acquire::Retries \"10\";" | sudo tee -a /etc/apt/apt.conf.d/80-retries # llvm.org unreliable
sudo apt-get update -y && sudo apt-get install -y clang-10 sudo apt-get update -y && sudo apt-get install -y clang-10
install-clang-13:
steps:
- run:
name: Install Clang 13
command: |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee -a /etc/apt/sources.list
echo "APT::Acquire::Retries \"10\";" | sudo tee -a /etc/apt/apt.conf.d/80-retries # llvm.org unreliable
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update -y && sudo apt-get install -y clang-13
install-gflags: install-gflags:
steps: steps:
- run: - run:
@ -396,6 +407,16 @@ jobs:
- run: CC=gcc-11 CXX=g++-11 V=1 SKIP_LINK=1 make -j16 all 2>&1 | .circleci/cat_ignore_eagain # Linking broken because libgflags compiled with newer ABI - run: CC=gcc-11 CXX=g++-11 V=1 SKIP_LINK=1 make -j16 all 2>&1 | .circleci/cat_ignore_eagain # Linking broken because libgflags compiled with newer ABI
- post-steps - post-steps
build-linux-clang-13-no_test_run:
machine:
image: ubuntu-2004:202010-01
resource_class: xlarge
steps:
- pre-steps
- install-clang-13
- run: CC=clang-13 CXX=clang++-13 USE_CLANG=1 make -j16 all 2>&1 | .circleci/cat_ignore_eagain
- post-steps
# This job is only to make sure the microbench tests are able to run, the benchmark result is not meaningful as the CI host is changing. # This job is only to make sure the microbench tests are able to run, the benchmark result is not meaningful as the CI host is changing.
build-linux-microbench: build-linux-microbench:
machine: machine:
@ -792,6 +813,7 @@ workflows:
build-linux-compilers-no_test_run: build-linux-compilers-no_test_run:
jobs: jobs:
- build-linux-clang-no_test_run - build-linux-clang-no_test_run
- build-linux-clang-13-no_test_run
- build-linux-gcc-4_8-no_test_run - build-linux-gcc-4_8-no_test_run
- build-linux-gcc-8-no_test_run - build-linux-gcc-8-no_test_run
- build-linux-gcc-9-no_test_run - build-linux-gcc-9-no_test_run

@ -964,13 +964,11 @@ TEST_F(CompactionPickerTest, NeedsCompactionFIFO) {
// verify whether compaction is needed based on the current // verify whether compaction is needed based on the current
// size of L0 files. // size of L0 files.
uint64_t current_size = 0;
for (int i = 1; i <= kFileCount; ++i) { for (int i = 1; i <= kFileCount; ++i) {
NewVersionStorage(1, kCompactionStyleFIFO); NewVersionStorage(1, kCompactionStyleFIFO);
Add(0, i, ToString((i + 100) * 1000).c_str(), Add(0, i, ToString((i + 100) * 1000).c_str(),
ToString((i + 100) * 1000 + 999).c_str(), ToString((i + 100) * 1000 + 999).c_str(), kFileSize, 0, i * 100,
kFileSize, 0, i * 100, i * 100 + 99); i * 100 + 99);
current_size += kFileSize;
UpdateVersionStorageInfo(); UpdateVersionStorageInfo();
ASSERT_EQ(fifo_compaction_picker.NeedsCompaction(vstorage_.get()), ASSERT_EQ(fifo_compaction_picker.NeedsCompaction(vstorage_.get()),
vstorage_->CompactionScore(0) >= 1); vstorage_->CompactionScore(0) >= 1);

@ -1892,7 +1892,6 @@ TEST_F(DBBasicTest, MultiGetBatchedValueSizeMultiLevelMerge) {
ASSERT_EQ(values.size(), keys.size()); ASSERT_EQ(values.size(), keys.size());
uint64_t curr_value_size = 0;
for (unsigned int j = 0; j < 26; ++j) { for (unsigned int j = 0; j < 26; ++j) {
int key = j + 10; int key = j + 10;
std::string value; std::string value;
@ -1909,11 +1908,9 @@ TEST_F(DBBasicTest, MultiGetBatchedValueSizeMultiLevelMerge) {
value.append(","); value.append(",");
value.append("val_mem_" + std::to_string(key)); value.append("val_mem_" + std::to_string(key));
} }
curr_value_size += value.size();
ASSERT_EQ(values[j], value); ASSERT_EQ(values[j], value);
ASSERT_OK(statuses[j]); ASSERT_OK(statuses[j]);
} }
// ASSERT_TRUE(curr_value_size <= read_options.value_size_hard_limit);
// All remaning keys status is set Status::Abort // All remaning keys status is set Status::Abort
for (unsigned int j = 26; j < 40; j++) { for (unsigned int j = 26; j < 40; j++) {

@ -2827,7 +2827,6 @@ TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) {
Close(); Close();
Reopen(options); Reopen(options);
uint64_t total_useful_bytes = 0;
std::set<int> read_keys; std::set<int> read_keys;
std::string value; std::string value;
// Iter1: Read half the DB, Read even keys // Iter1: Read half the DB, Read even keys
@ -2838,8 +2837,6 @@ TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) {
if (read_keys.find(i) == read_keys.end()) { if (read_keys.find(i) == read_keys.end()) {
auto internal_key = InternalKey(key, 0, ValueType::kTypeValue); auto internal_key = InternalKey(key, 0, ValueType::kTypeValue);
total_useful_bytes +=
GetEncodedEntrySize(internal_key.size(), value.size());
read_keys.insert(i); read_keys.insert(i);
} }
} }
@ -2866,8 +2863,6 @@ TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) {
if (read_keys.find(i) == read_keys.end()) { if (read_keys.find(i) == read_keys.end()) {
auto internal_key = InternalKey(key, 0, ValueType::kTypeValue); auto internal_key = InternalKey(key, 0, ValueType::kTypeValue);
total_useful_bytes +=
GetEncodedEntrySize(internal_key.size(), value.size());
read_keys.insert(i); read_keys.insert(i);
} }
} }

@ -116,7 +116,6 @@ struct ImmutableDBOptions {
struct MutableDBOptions { struct MutableDBOptions {
static const char* kName() { return "MutableDBOptions"; } static const char* kName() { return "MutableDBOptions"; }
MutableDBOptions(); MutableDBOptions();
explicit MutableDBOptions(const MutableDBOptions& options) = default;
explicit MutableDBOptions(const DBOptions& options); explicit MutableDBOptions(const DBOptions& options);
void Dump(Logger* log) const; void Dump(Logger* log) const;

@ -27,13 +27,17 @@ class SequentialFileMirror : public SequentialFile {
if (as == Status::OK()) { if (as == Status::OK()) {
char* bscratch = new char[n]; char* bscratch = new char[n];
Slice bslice; Slice bslice;
#ifndef NDEBUG
size_t off = 0; size_t off = 0;
#endif
size_t left = aslice.size(); size_t left = aslice.size();
while (left) { while (left) {
Status bs = b_->Read(left, &bslice, bscratch); Status bs = b_->Read(left, &bslice, bscratch);
#ifndef NDEBUG
assert(as == bs); assert(as == bs);
assert(memcmp(bscratch, scratch + off, bslice.size()) == 0); assert(memcmp(bscratch, scratch + off, bslice.size()) == 0);
off += bslice.size(); off += bslice.size();
#endif
left -= bslice.size(); left -= bslice.size();
} }
delete[] bscratch; delete[] bscratch;

Loading…
Cancel
Save