Build blob file reader/writer classes in LITE mode as well (#7272)

Summary:
The patch makes sure that the functionality required for the new integrated
BlobDB implementation (most importantly, the classes related to reading and
writing blob files) is also built in LITE mode by removing the corresponding
`#ifndef`s.

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

Test Plan: Ran `make check` in both regular and LITE mode.

Reviewed By: zhichao-cao

Differential Revision: D23173280

Pulled By: ltamasi

fbshipit-source-id: 1596bd1a76409a8a6d83d8f1dbfe08bfdea7ffe6
main
Levi Tamasi 4 years ago committed by Facebook GitHub Bot
parent 1760637539
commit 9b083cb11c
  1. 2
      db/blob/blob_index.h
  2. 2
      db/blob/blob_log_format.cc
  3. 3
      db/blob/blob_log_format.h
  4. 2
      db/blob/blob_log_reader.cc
  5. 3
      db/blob/blob_log_reader.h
  6. 2
      db/blob/blob_log_writer.cc
  7. 3
      db/blob/blob_log_writer.h
  8. 6
      db/flush_job_test.cc
  9. 5
      db/version_edit.cc

@ -3,7 +3,6 @@
// COPYING file in the root directory) and Apache 2.0 License // COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory). // (found in the LICENSE.Apache file in the root directory).
#pragma once #pragma once
#ifndef ROCKSDB_LITE
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -176,4 +175,3 @@ class BlobIndex {
}; };
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -3,7 +3,6 @@
// COPYING file in the root directory) and Apache 2.0 License // COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory). // (found in the LICENSE.Apache file in the root directory).
// //
#ifndef ROCKSDB_LITE
#include "db/blob/blob_log_format.h" #include "db/blob/blob_log_format.h"
@ -144,4 +143,3 @@ Status BlobLogRecord::CheckBlobCRC() const {
} }
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -7,8 +7,6 @@
#pragma once #pragma once
#ifndef ROCKSDB_LITE
#include <memory> #include <memory>
#include <utility> #include <utility>
@ -126,4 +124,3 @@ struct BlobLogRecord {
}; };
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -3,7 +3,6 @@
// COPYING file in the root directory) and Apache 2.0 License // COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory). // (found in the LICENSE.Apache file in the root directory).
// //
#ifndef ROCKSDB_LITE
#include "db/blob/blob_log_reader.h" #include "db/blob/blob_log_reader.h"
@ -102,4 +101,3 @@ Status BlobLogReader::ReadRecord(BlobLogRecord* record, ReadLevel level,
} }
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -5,8 +5,6 @@
// //
#pragma once #pragma once
#ifndef ROCKSDB_LITE
#include <memory> #include <memory>
#include <string> #include <string>
@ -77,4 +75,3 @@ class BlobLogReader {
}; };
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -2,7 +2,6 @@
// This source code is licensed under both the GPLv2 (found in the // This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License // COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory). // (found in the LICENSE.Apache file in the root directory).
#ifndef ROCKSDB_LITE
#include "db/blob/blob_log_writer.h" #include "db/blob/blob_log_writer.h"
@ -139,4 +138,3 @@ Status BlobLogWriter::EmitPhysicalRecord(const std::string& headerbuf,
} }
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -4,8 +4,6 @@
// (found in the LICENSE.Apache file in the root directory). // (found in the LICENSE.Apache file in the root directory).
#pragma once #pragma once
#ifndef ROCKSDB_LITE
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <string> #include <string>
@ -82,4 +80,3 @@ class BlobLogWriter {
}; };
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE

@ -179,7 +179,6 @@ TEST_F(FlushJobTest, NonEmpty) {
inserted_keys.insert({internal_key.Encode().ToString(), "9999a"}); inserted_keys.insert({internal_key.Encode().ToString(), "9999a"});
} }
#ifndef ROCKSDB_LITE
// Note: the first two blob references will not be considered when resolving // Note: the first two blob references will not be considered when resolving
// the oldest blob file referenced (the first one is inlined TTL, while the // the oldest blob file referenced (the first one is inlined TTL, while the
// second one is TTL and thus points to a TTL blob file). // second one is TTL and thus points to a TTL blob file).
@ -208,7 +207,6 @@ TEST_F(FlushJobTest, NonEmpty) {
inserted_keys.emplace_hint(inserted_keys.end(), inserted_keys.emplace_hint(inserted_keys.end(),
internal_key.Encode().ToString(), blob_index); internal_key.Encode().ToString(), blob_index);
} }
#endif
autovector<MemTable*> to_delete; autovector<MemTable*> to_delete;
cfd->imm()->Add(new_mem, &to_delete); cfd->imm()->Add(new_mem, &to_delete);
@ -239,12 +237,8 @@ TEST_F(FlushJobTest, NonEmpty) {
ASSERT_EQ(ToString(0), file_meta.smallest.user_key().ToString()); ASSERT_EQ(ToString(0), file_meta.smallest.user_key().ToString());
ASSERT_EQ("9999a", file_meta.largest.user_key().ToString()); ASSERT_EQ("9999a", file_meta.largest.user_key().ToString());
ASSERT_EQ(1, file_meta.fd.smallest_seqno); ASSERT_EQ(1, file_meta.fd.smallest_seqno);
#ifndef ROCKSDB_LITE
ASSERT_EQ(10006, file_meta.fd.largest_seqno); ASSERT_EQ(10006, file_meta.fd.largest_seqno);
ASSERT_EQ(17, file_meta.oldest_blob_file_number); ASSERT_EQ(17, file_meta.oldest_blob_file_number);
#else
ASSERT_EQ(10000, file_meta.fd.largest_seqno);
#endif
mock_table_factory_->AssertSingleFile(inserted_keys); mock_table_factory_->AssertSingleFile(inserted_keys);
job_context.Clean(); job_context.Clean();
} }

@ -38,7 +38,6 @@ void FileMetaData::UpdateBoundaries(const Slice& key, const Slice& value,
fd.smallest_seqno = std::min(fd.smallest_seqno, seqno); fd.smallest_seqno = std::min(fd.smallest_seqno, seqno);
fd.largest_seqno = std::max(fd.largest_seqno, seqno); fd.largest_seqno = std::max(fd.largest_seqno, seqno);
#ifndef ROCKSDB_LITE
if (value_type == kTypeBlobIndex) { if (value_type == kTypeBlobIndex) {
BlobIndex blob_index; BlobIndex blob_index;
const Status s = blob_index.DecodeFrom(value); const Status s = blob_index.DecodeFrom(value);
@ -65,10 +64,6 @@ void FileMetaData::UpdateBoundaries(const Slice& key, const Slice& value,
oldest_blob_file_number = blob_index.file_number(); oldest_blob_file_number = blob_index.file_number();
} }
} }
#else
(void)value;
(void)value_type;
#endif
} }
void VersionEdit::Clear() { void VersionEdit::Clear() {

Loading…
Cancel
Save