mirror of https://github.com/facebook/rocksdb.git
Lint everything
Summary: ``` arc2 lint --everything ``` run the linter on the whole code repo to fix exisitng lint issues Test Plan: make check -j64 Reviewers: sdong, rven, anthony, kradhakrishnan, yhchiang Reviewed By: yhchiang Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D50769
This commit is contained in:
parent
dac5b248b1
commit
a163cc2d5a
|
@ -377,7 +377,7 @@ DEFINE_int32(random_access_max_buffer_size, 1024 * 1024,
|
||||||
"Maximum windows randomaccess buffer size");
|
"Maximum windows randomaccess buffer size");
|
||||||
|
|
||||||
DEFINE_int32(writable_file_max_buffer_size, 1024 * 1024,
|
DEFINE_int32(writable_file_max_buffer_size, 1024 * 1024,
|
||||||
"Maximum write buffer for Writeable File");
|
"Maximum write buffer for Writable File");
|
||||||
|
|
||||||
DEFINE_int32(skip_table_builder_flush, false, "Skip flushing block in "
|
DEFINE_int32(skip_table_builder_flush, false, "Skip flushing block in "
|
||||||
"table builder ");
|
"table builder ");
|
||||||
|
|
|
@ -533,4 +533,3 @@ int main(int argc, char** argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,3 @@
|
||||||
#elif defined(OS_WIN)
|
#elif defined(OS_WIN)
|
||||||
#include "port/win/port_win.h"
|
#include "port/win/port_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,11 @@
|
||||||
#else
|
#else
|
||||||
#define PLATFORM_IS_LITTLE_ENDIAN false
|
#define PLATFORM_IS_LITTLE_ENDIAN false
|
||||||
#endif
|
#endif
|
||||||
#elif defined(OS_FREEBSD)
|
#elif defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || \
|
||||||
|
defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID)
|
||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
|
#define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
|
||||||
#elif defined(OS_OPENBSD) || defined(OS_NETBSD) ||\
|
|
||||||
defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID)
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/endian.h>
|
|
||||||
#else
|
#else
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -159,4 +156,3 @@ extern int GetMaxOpenFiles();
|
||||||
|
|
||||||
} // namespace port
|
} // namespace port
|
||||||
} // namespace rocksdb
|
} // namespace rocksdb
|
||||||
|
|
||||||
|
|
|
@ -970,8 +970,7 @@ class WinWritableFile : public WritableFile {
|
||||||
virtual Status PositionedAppend(const Slice& data, uint64_t offset) override {
|
virtual Status PositionedAppend(const Slice& data, uint64_t offset) override {
|
||||||
Status s;
|
Status s;
|
||||||
|
|
||||||
SSIZE_T ret = pwrite(hFile_, data.data(),
|
SSIZE_T ret = pwrite(hFile_, data.data(), data.size(), offset);
|
||||||
data.size(), offset);
|
|
||||||
|
|
||||||
// Error break
|
// Error break
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ bool CondVar::TimedWait(uint64_t abs_time_us) {
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
||||||
// MSVC++ library implements wait_until in terms of wait_for so
|
// MSVC++ library implements wait_until in terms of wait_for so
|
||||||
// we need to convert absoulte wait into relative wait.
|
// we need to convert absolute wait into relative wait.
|
||||||
microseconds usAbsTime(abs_time_us);
|
microseconds usAbsTime(abs_time_us);
|
||||||
|
|
||||||
microseconds usNow(
|
microseconds usNow(
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
// Logger implementation that can be shared by all environments
|
// Logger implementation that can be shared by all environments
|
||||||
// where enough posix functionality is available.
|
// where enough posix functionality is available.
|
||||||
|
|
||||||
|
#include "port/win/win_logger.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -21,7 +23,6 @@
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
#include "port/win/win_logger.h"
|
|
||||||
#include "port/sys_time.h"
|
#include "port/sys_time.h"
|
||||||
#include "util/iostats_context_imp.h"
|
#include "util/iostats_context_imp.h"
|
||||||
|
|
||||||
|
@ -53,8 +54,9 @@ void WinLogger::close() { CloseHandle(file_); }
|
||||||
void WinLogger::Flush() {
|
void WinLogger::Flush() {
|
||||||
if (flush_pending_) {
|
if (flush_pending_) {
|
||||||
flush_pending_ = false;
|
flush_pending_ = false;
|
||||||
// With Windows API writes go to OS buffers directly so no fflush needed unlike
|
// With Windows API writes go to OS buffers directly so no fflush needed
|
||||||
// with C runtime API. We don't flush all the way to disk for perf reasons.
|
// unlike with C runtime API. We don't flush all the way to disk
|
||||||
|
// for perf reasons.
|
||||||
}
|
}
|
||||||
|
|
||||||
last_flush_micros_ = env_->NowMicros();
|
last_flush_micros_ = env_->NowMicros();
|
||||||
|
@ -141,8 +143,9 @@ void WinLogger::Logv(const char* format, va_list ap) {
|
||||||
static_cast<uint64_t>(now_tv.tv_sec) * 1000000 + now_tv.tv_usec;
|
static_cast<uint64_t>(now_tv.tv_sec) * 1000000 + now_tv.tv_usec;
|
||||||
if (now_micros - last_flush_micros_ >= flush_every_seconds_ * 1000000) {
|
if (now_micros - last_flush_micros_ >= flush_every_seconds_ * 1000000) {
|
||||||
flush_pending_ = false;
|
flush_pending_ = false;
|
||||||
// With Windows API writes go to OS buffers directly so no fflush needed unlike
|
// With Windows API writes go to OS buffers directly so no fflush needed
|
||||||
// with C runtime API. We don't flush all the way to disk for perf reasons.
|
// unlike with C runtime API. We don't flush all the way to disk
|
||||||
|
// for perf reasons.
|
||||||
last_flush_micros_ = now_micros;
|
last_flush_micros_ = now_micros;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2592,7 +2592,7 @@ class Hunk {
|
||||||
// Print a unified diff header for one hunk.
|
// Print a unified diff header for one hunk.
|
||||||
// The format is
|
// The format is
|
||||||
// "@@ -<left_start>,<left_length> +<right_start>,<right_length> @@"
|
// "@@ -<left_start>,<left_length> +<right_start>,<right_length> @@"
|
||||||
// where the left/right parts are ommitted if unnecessary.
|
// where the left/right parts are omitted if unnecessary.
|
||||||
void PrintHeader(std::ostream* ss) const {
|
void PrintHeader(std::ostream* ss) const {
|
||||||
*ss << "@@ ";
|
*ss << "@@ ";
|
||||||
if (removes_) {
|
if (removes_) {
|
||||||
|
|
|
@ -297,7 +297,7 @@ void AssignEnvOptions(EnvOptions* env_options, const DBOptions& options) {
|
||||||
options.random_access_max_buffer_size;
|
options.random_access_max_buffer_size;
|
||||||
env_options->rate_limiter = options.rate_limiter.get();
|
env_options->rate_limiter = options.rate_limiter.get();
|
||||||
env_options->writable_file_max_buffer_size =
|
env_options->writable_file_max_buffer_size =
|
||||||
options.writable_file_max_buffer_size;
|
options.writable_file_max_buffer_size;
|
||||||
env_options->allow_fallocate = options.allow_fallocate;
|
env_options->allow_fallocate = options.allow_fallocate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1384,8 +1384,8 @@ Status GetTableFactoryFromMap(
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
} else if (factory_name == PlainTableFactory().Name()) {
|
} else if (factory_name == PlainTableFactory().Name()) {
|
||||||
PlainTableOptions pt_opt;
|
PlainTableOptions pt_opt;
|
||||||
s = GetPlainTableOptionsFromMap(PlainTableOptions(), opt_map,
|
s = GetPlainTableOptionsFromMap(PlainTableOptions(), opt_map, &pt_opt,
|
||||||
&pt_opt, true);
|
true);
|
||||||
if (!s.ok()) {
|
if (!s.ok()) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,10 +535,11 @@ TEST_F(OptionsTest, GetPlainTableOptionsFromString) {
|
||||||
&new_opt));
|
&new_opt));
|
||||||
|
|
||||||
// unrecognized EncodingType
|
// unrecognized EncodingType
|
||||||
ASSERT_NOK(GetPlainTableOptionsFromString(table_opt,
|
ASSERT_NOK(GetPlainTableOptionsFromString(
|
||||||
"user_key_len=66;bloom_bits_per_key=20;hash_table_ratio=0.5;"
|
table_opt,
|
||||||
"encoding_type=kPrefixXX",
|
"user_key_len=66;bloom_bits_per_key=20;hash_table_ratio=0.5;"
|
||||||
&new_opt));
|
"encoding_type=kPrefixXX",
|
||||||
|
&new_opt));
|
||||||
}
|
}
|
||||||
#endif // !ROCKSDB_LITE
|
#endif // !ROCKSDB_LITE
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,3 @@ std::shared_ptr<MergeOperator> MergeOperators::CreateStringAppendOperator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rocksdb
|
} // namespace rocksdb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ namespace rocksdb {
|
||||||
|
|
||||||
class StringAppendOperator : public AssociativeMergeOperator {
|
class StringAppendOperator : public AssociativeMergeOperator {
|
||||||
public:
|
public:
|
||||||
StringAppendOperator(char delim_char); /// Constructor: specify delimiter
|
// Constructor: specify delimiter
|
||||||
|
explicit StringAppendOperator(char delim_char);
|
||||||
|
|
||||||
virtual bool Merge(const Slice& key,
|
virtual bool Merge(const Slice& key,
|
||||||
const Slice* existing_value,
|
const Slice* existing_value,
|
||||||
|
@ -28,4 +29,3 @@ class StringAppendOperator : public AssociativeMergeOperator {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rocksdb
|
} // namespace rocksdb
|
||||||
|
|
||||||
|
|
|
@ -110,4 +110,3 @@ MergeOperators::CreateStringAppendTESTOperator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rocksdb
|
} // namespace rocksdb
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
* @author Deon Nicholas (dnicholas@fb.com)
|
* @author Deon Nicholas (dnicholas@fb.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ROCKSDB_LITE
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class RedisListIterator {
|
||||||
/// e) result_ will always contain data_[0..cur_byte_) and a header
|
/// e) result_ will always contain data_[0..cur_byte_) and a header
|
||||||
/// f) Whenever corrupt data is encountered or an invalid operation is
|
/// f) Whenever corrupt data is encountered or an invalid operation is
|
||||||
/// attempted, a RedisListException will immediately be thrown.
|
/// attempted, a RedisListException will immediately be thrown.
|
||||||
RedisListIterator(const std::string& list_data)
|
explicit RedisListIterator(const std::string& list_data)
|
||||||
: data_(list_data.data()),
|
: data_(list_data.data()),
|
||||||
num_bytes_(static_cast<uint32_t>(list_data.size())),
|
num_bytes_(static_cast<uint32_t>(list_data.size())),
|
||||||
cur_byte_(0),
|
cur_byte_(0),
|
||||||
|
@ -73,7 +73,6 @@ class RedisListIterator {
|
||||||
cur_elem_length_(0),
|
cur_elem_length_(0),
|
||||||
length_(0),
|
length_(0),
|
||||||
result_() {
|
result_() {
|
||||||
|
|
||||||
// Initialize the result_ (reserve enough space for header)
|
// Initialize the result_ (reserve enough space for header)
|
||||||
InitializeResult();
|
InitializeResult();
|
||||||
|
|
||||||
|
@ -269,7 +268,7 @@ class RedisListIterator {
|
||||||
data_+cur_byte_+ sizeof(uint32_t) + cur_elem_length_);
|
data_+cur_byte_+ sizeof(uint32_t) + cur_elem_length_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Will ThrowError() if neccessary.
|
/// Will ThrowError() if necessary.
|
||||||
/// Checks for common/ubiquitous errors that can arise after most operations.
|
/// Checks for common/ubiquitous errors that can arise after most operations.
|
||||||
/// This method should be called before any reading operation.
|
/// This method should be called before any reading operation.
|
||||||
/// If this function succeeds, then we are guaranteed to be in a valid state.
|
/// If this function succeeds, then we are guaranteed to be in a valid state.
|
||||||
|
|
Loading…
Reference in New Issue