Dedup IsFileSectorAligned() to fix unity build. (#5812)

Summary:
Unity build fails because of name conflict of IsFileSectorAligned() after recent refactoring. Consolidate the function.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5812

Test Plan: make unity. At least the failure goes away. Also "make all", "make release" and see no regression in normal cases.

Differential Revision: D17411403

fbshipit-source-id: 09d5653471ae2c3a4d898e120a024f7dd08d9c9d
main
sdong 5 years ago committed by Facebook Github Bot
parent 68626249c3
commit 811e403f57
  1. 5
      file/read_write_util.cc
  2. 3
      file/read_write_util.h
  3. 10
      file/readahead_raf.cc
  4. 10
      file/sequence_file_reader.cc

@ -58,4 +58,9 @@ bool ReadOneLine(std::istringstream* iss, SequentialFile* seq_file,
return *has_data || has_complete_line;
}
#ifndef NDEBUG
bool IsFileSectorAligned(const size_t off, size_t sector_size) {
return off % sector_size == 0;
}
#endif // NDEBUG
} // namespace rocksdb

@ -26,4 +26,7 @@ extern Status NewWritableFile(Env* env, const std::string& fname,
bool ReadOneLine(std::istringstream* iss, SequentialFile* seq_file,
std::string* output, bool* has_data, Status* result);
#ifndef NDEBUG
bool IsFileSectorAligned(const size_t off, size_t sector_size);
#endif // NDEBUG
} // namespace rocksdb

@ -11,19 +11,11 @@
#include <algorithm>
#include <mutex>
#include "file/read_write_util.h"
#include "util/aligned_buffer.h"
#include "util/rate_limiter.h"
namespace rocksdb {
#ifndef NDEBUG
namespace {
bool IsFileSectorAligned(const size_t off, size_t sector_size) {
return off % sector_size == 0;
}
} // namespace
#endif
namespace {
class ReadaheadRandomAccessFile : public RandomAccessFile {
public:

@ -12,6 +12,7 @@
#include <algorithm>
#include <mutex>
#include "file/read_write_util.h"
#include "monitoring/histogram.h"
#include "monitoring/iostats_context_imp.h"
#include "port/port.h"
@ -21,15 +22,6 @@
#include "util/rate_limiter.h"
namespace rocksdb {
#ifndef NDEBUG
namespace {
bool IsFileSectorAligned(const size_t off, size_t sector_size) {
return off % sector_size == 0;
}
} // namespace
#endif
Status SequentialFileReader::Read(size_t n, Slice* result, char* scratch) {
Status s;
if (use_direct_io()) {

Loading…
Cancel
Save