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
This commit is contained in:
sdong 2019-09-16 20:40:44 -07:00 committed by Facebook Github Bot
parent 68626249c3
commit 811e403f57
4 changed files with 10 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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()) {