You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by ti...@apache.org on 2022/10/05 10:25:46 UTC
[incubator-kvrocks] branch unstable updated: Update to ubuntu 20.04, tcl 8.6 and cpplint 1.6.1 in GitHub Actions (#943)
This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new b91c6e8 Update to ubuntu 20.04, tcl 8.6 and cpplint 1.6.1 in GitHub Actions (#943)
b91c6e8 is described below
commit b91c6e883d8f6724532661bc9c0931b08585d1a6
Author: Aleks Lozovyuk <al...@gmail.com>
AuthorDate: Wed Oct 5 13:25:39 2022 +0300
Update to ubuntu 20.04, tcl 8.6 and cpplint 1.6.1 in GitHub Actions (#943)
Co-authored-by: Yaroslav Stepanchuk <to...@gmail.com>
---
.github/workflows/kvrocks.yaml | 54 +++++++--------
src/compact_filter.cc | 5 +-
src/compact_filter.h | 8 +--
src/config.cc | 18 ++---
src/config.h | 6 +-
src/encoding.h | 3 +-
src/lock_manager.h | 8 +--
src/parse_util.h | 3 +-
src/redis_bitmap.h | 6 +-
src/redis_bitmap_string.cc | 2 +-
src/redis_cmd.cc | 142 +++++++++++++++++++--------------------
src/redis_cmd.h | 16 ++---
src/redis_connection.h | 8 +--
src/redis_hash.cc | 12 ++--
src/redis_hash.h | 6 +-
src/redis_metadata.cc | 13 ++--
src/redis_metadata.h | 6 +-
src/redis_reply.cc | 1 +
src/redis_reply.h | 5 +-
src/redis_request.cc | 21 +++---
src/redis_request.h | 5 +-
src/redis_stream.cc | 8 ++-
src/redis_stream.h | 4 +-
src/redis_stream_base.h | 6 +-
src/replication.cc | 18 ++---
src/replication.h | 15 +++--
src/server.cc | 20 +++---
src/slot_import.h | 7 +-
src/slot_migrate.h | 27 ++++----
src/status.h | 9 +--
src/storage.cc | 32 ++++-----
src/storage.h | 19 +++---
src/table_properties_collector.h | 7 +-
src/tls_util.cc | 12 ++--
src/tls_util.h | 6 +-
src/util.cc | 37 +++++-----
src/util.h | 11 +--
src/worker.cc | 22 +++---
src/worker.h | 17 +++--
39 files changed, 331 insertions(+), 294 deletions(-)
diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml
index 4040536..19ad86a 100644
--- a/.github/workflows/kvrocks.yaml
+++ b/.github/workflows/kvrocks.yaml
@@ -13,7 +13,7 @@
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
-# under the License.
+# under the License.
name: CI
@@ -55,7 +55,7 @@ jobs:
with:
go-version: 1.19.x
- name: Setup dependencies
- run: pip install cpplint==1.5.0
+ run: pip install cpplint==1.6.1
- name: Lint and check code
run: |
./x.py check cpplint
@@ -79,73 +79,73 @@ jobs:
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_openssl: -DENABLE_OPENSSL=ON
- name: Ubuntu GCC
- os: ubuntu-18.04
+ os: ubuntu-20.04
compiler: gcc
with_openssl: -DENABLE_OPENSSL=ON
- name: Ubuntu Clang
- os: ubuntu-18.04
+ os: ubuntu-20.04
compiler: clang
with_openssl: -DENABLE_OPENSSL=ON
- name: Ubuntu GCC ASan
- os: ubuntu-18.04
+ os: ubuntu-20.04
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_sanitizer: -DENABLE_ASAN=ON
with_openssl: -DENABLE_OPENSSL=ON
compiler: gcc
+ - name: Ubuntu Clang ASan
+ os: ubuntu-20.04
+ with_sanitizer: -DENABLE_ASAN=ON
+ without_jemalloc: -DDISABLE_JEMALLOC=ON
+ with_openssl: -DENABLE_OPENSSL=ON
+ compiler: clang
- name: Ubuntu GCC TSan
- os: ubuntu-18.04
+ os: ubuntu-20.04
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_openssl: -DENABLE_OPENSSL=ON
with_sanitizer: -DENABLE_TSAN=ON
compiler: gcc
runtime_env_vars: TSAN_OPTIONS="suppressions=$(realpath ./tests/tsan-suppressions)"
- - name: Ubuntu Clang ASan
- os: ubuntu-18.04
- with_sanitizer: -DENABLE_ASAN=ON
- without_jemalloc: -DDISABLE_JEMALLOC=ON
- with_openssl: -DENABLE_OPENSSL=ON
- compiler: clang
- name: Ubuntu Clang TSan
- os: ubuntu-18.04
+ os: ubuntu-20.04
with_sanitizer: -DENABLE_TSAN=ON
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_openssl: -DENABLE_OPENSSL=ON
compiler: clang
runtime_env_vars: TSAN_OPTIONS="suppressions=$(realpath ./tests/tsan-suppressions)"
- name: Ubuntu GCC Ninja
- os: ubuntu-18.04
+ os: ubuntu-20.04
with_ninja: --ninja
with_openssl: -DENABLE_OPENSSL=ON
compiler: gcc
- name: Ubuntu GCC Ninja without Jemalloc
- os: ubuntu-18.04
+ os: ubuntu-20.04
with_ninja: --ninja
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_openssl: -DENABLE_OPENSSL=ON
compiler: gcc
- - name: Ubuntu GCC with luajit
- os: ubuntu-18.04
+ - name: Ubuntu GCC with luaJIT
+ os: ubuntu-20.04
with_openssl: -DENABLE_OPENSSL=ON
with_luajit: -DUSE_LUAJIT=ON
compiler: gcc
- - name: Ubuntu GCC without OpenSSL
- os: ubuntu-18.04
- compiler: gcc
- name: Ubuntu GCC ASan with luaJIT
- os: ubuntu-18.04
+ os: ubuntu-20.04
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_luajit: -DUSE_LUAJIT=ON
with_sanitizer: -DENABLE_ASAN=ON
with_openssl: -DENABLE_OPENSSL=ON
compiler: gcc
- name: Ubuntu GCC TSan with luaJIT
- os: ubuntu-18.04
+ os: ubuntu-20.04
without_jemalloc: -DDISABLE_JEMALLOC=ON
with_luajit: -DUSE_LUAJIT=ON
with_sanitizer: -DENABLE_TSAN=ON
with_openssl: -DENABLE_OPENSSL=ON
compiler: gcc
-
+ - name: Ubuntu GCC without OpenSSL
+ os: ubuntu-20.04
+ compiler: gcc
+
runs-on: ${{ matrix.os }}
steps:
- name: Cache redis
@@ -167,16 +167,16 @@ jobs:
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
- sudo apt install -y tcl8.5 ninja-build tcl-tls
+ sudo apt install -y tcl8.6 ninja-build tcl-tls
echo "NPROC=$(nproc)" >> $GITHUB_ENV
- name: Install redis
if: steps.cache-redis.outputs.cache-hit != 'true'
run: |
- curl -O https://download.redis.io/releases/redis-6.2.6.tar.gz
- tar -xzvf redis-6.2.6.tar.gz
+ curl -O https://download.redis.io/releases/redis-6.2.7.tar.gz
+ tar -xzvf redis-6.2.7.tar.gz
mkdir -p $HOME/local/bin
- pushd redis-6.2.6 && BUILD_TLS=yes make -j$NPROC redis-cli && mv src/redis-cli $HOME/local/bin/ && popd
+ pushd redis-6.2.7 && BUILD_TLS=yes make -j$NPROC redis-cli && mv src/redis-cli $HOME/local/bin/ && popd
- name: Checkout Code Base
uses: actions/checkout@v3
diff --git a/src/compact_filter.cc b/src/compact_filter.cc
index 60e5740..0786a81 100644
--- a/src/compact_filter.cc
+++ b/src/compact_filter.cc
@@ -19,9 +19,12 @@
*/
#include "compact_filter.h"
+
+#include <glog/logging.h>
+
#include <string>
#include <utility>
-#include <glog/logging.h>
+
#include "redis_bitmap.h"
namespace Engine {
diff --git a/src/compact_filter.h b/src/compact_filter.h
index f296252..478ed76 100644
--- a/src/compact_filter.h
+++ b/src/compact_filter.h
@@ -20,12 +20,12 @@
#pragma once
-#include <vector>
+#include <rocksdb/compaction_filter.h>
+#include <rocksdb/db.h>
+
#include <memory>
#include <string>
-
-#include <rocksdb/db.h>
-#include <rocksdb/compaction_filter.h>
+#include <vector>
#include "redis_metadata.h"
#include "storage.h"
diff --git a/src/config.cc b/src/config.cc
index ea72084..b583283 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -18,9 +18,14 @@
*
*/
+#include "config.h"
+
+#include <rocksdb/env.h>
+
#include <fcntl.h>
-#include <string.h>
#include <strings.h>
+
+#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>
@@ -29,18 +34,13 @@
#include <limits>
#include <algorithm>
#include <cctype>
-#include <glog/logging.h>
-#include <rocksdb/env.h>
-#include "config.h"
#include "config_type.h"
+#include "config_util.h"
+#include "server.h"
+#include "status.h"
#include "tls_util.h"
#include "util.h"
-#include "status.h"
-#include "cron.h"
-#include "server.h"
-#include "log_collector.h"
-#include "config_util.h"
const char *kDefaultNamespace = "__namespace";
diff --git a/src/config.h b/src/config.h
index 5c5ec3e..09734af 100644
--- a/src/config.h
+++ b/src/config.h
@@ -19,6 +19,8 @@
*/
#pragma once
+
+#include <rocksdb/options.h>
#include <sys/resource.h>
#include <map>
@@ -27,11 +29,9 @@
#include <string>
#include <vector>
-#include <rocksdb/options.h>
-
#include "config_type.h"
-#include "status.h"
#include "cron.h"
+#include "status.h"
// forward declaration
class Server;
diff --git a/src/encoding.h b/src/encoding.h
index af9ce75..cfe71f8 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -20,9 +20,10 @@
#pragma once
+#include <rocksdb/slice.h>
+
#include <unistd.h>
#include <string>
-#include <rocksdb/slice.h>
bool GetFixed8(rocksdb::Slice *input, uint8_t *value);
bool GetFixed16(rocksdb::Slice *input, uint16_t *value);
diff --git a/src/lock_manager.h b/src/lock_manager.h
index fa3eee8..41908d5 100644
--- a/src/lock_manager.h
+++ b/src/lock_manager.h
@@ -20,12 +20,12 @@
#pragma once
+#include <rocksdb/db.h>
+
+#include <functional>
#include <mutex>
-#include <vector>
#include <string>
-#include <functional>
-
-#include <rocksdb/db.h>
+#include <vector>
class LockManager {
public:
diff --git a/src/parse_util.h b/src/parse_util.h
index 0718540..c23ebb6 100644
--- a/src/parse_util.h
+++ b/src/parse_util.h
@@ -24,7 +24,8 @@
#include <limits>
#include <string>
#include <tuple>
-#include <status.h>
+
+#include "status.h"
namespace details {
diff --git a/src/redis_bitmap.h b/src/redis_bitmap.h
index a85250e..a4aa594 100644
--- a/src/redis_bitmap.h
+++ b/src/redis_bitmap.h
@@ -20,12 +20,12 @@
#pragma once
-#include "redis_db.h"
-#include "redis_metadata.h"
-
#include <string>
#include <vector>
+#include "redis_db.h"
+#include "redis_metadata.h"
+
#if defined(__sparc__) || defined(__arm__)
#define USE_ALIGNED_ACCESS
#endif
diff --git a/src/redis_bitmap_string.cc b/src/redis_bitmap_string.cc
index acb2f73..f5b0b3f 100644
--- a/src/redis_bitmap_string.cc
+++ b/src/redis_bitmap_string.cc
@@ -19,7 +19,7 @@
*/
#include "redis_bitmap_string.h"
-#include <vector>
+
#include <glog/logging.h>
#include "redis_string.h"
diff --git a/src/redis_cmd.cc b/src/redis_cmd.cc
index 92023e6..ab5dcb4 100644
--- a/src/redis_cmd.cc
+++ b/src/redis_cmd.cc
@@ -18,47 +18,43 @@
*
*/
-#include <arpa/inet.h>
+#include "redis_cmd.h"
+
+#include <glog/logging.h>
+
#include <fcntl.h>
#include <sys/socket.h>
#include <algorithm>
-#include <cctype>
#include <climits>
#include <cmath>
#include <chrono>
#include <vector>
#include <thread>
#include <utility>
-#include <memory>
-#include <glog/logging.h>
+#include "cluster.h"
+#include "log_collector.h"
+#include "parse_util.h"
+#include "redis_bitmap.h"
+#include "redis_connection.h"
#include "redis_db.h"
-#include "redis_cmd.h"
+#include "redis_geo.h"
#include "redis_hash.h"
-#include "redis_bitmap.h"
#include "redis_list.h"
+#include "redis_pubsub.h"
#include "redis_reply.h"
-#include "redis_request.h"
-#include "redis_connection.h"
#include "redis_set.h"
-#include "redis_string.h"
-#include "redis_zset.h"
-#include "redis_geo.h"
-#include "redis_pubsub.h"
-#include "redis_sortedint.h"
#include "redis_slot.h"
+#include "redis_sortedint.h"
#include "redis_stream.h"
-#include "replication.h"
-#include "util.h"
-#include "storage.h"
-#include "worker.h"
-#include "server.h"
-#include "log_collector.h"
-#include "cluster.h"
+#include "redis_string.h"
+#include "redis_zset.h"
#include "scripting.h"
+#include "server.h"
#include "slot_import.h"
#include "slot_migrate.h"
-#include "parse_util.h"
+#include "storage.h"
+#include "util.h"
namespace Redis {
@@ -67,11 +63,11 @@ const char *kCursorPrefix = "_";
const char *errInvalidSyntax = "syntax error";
const char *errInvalidExpireTime = "invalid expire time";
const char *errWrongNumOfArguments = "wrong number of arguments";
-const char *errValueNotInterger = "value is not an integer or out of range";
+const char *errValueNotInteger = "value is not an integer or out of range";
const char *errAdministorPermissionRequired = "administor permission required to perform the command";
const char *errValueMustBePositive = "value is out of range, must be positive";
const char *errNoSuchKey = "no such key";
-const char *errUnbalacedStreamList =
+const char *errUnbalancedStreamList =
"Unbalanced XREAD list of streams: for each stream key an ID or '$' must be specified.";
const char *errTimeoutIsNegative = "timeout is negative";
const char *errLimitOptionNotAllowed = "syntax error, LIMIT cannot be used without the special ~ option";
@@ -383,7 +379,7 @@ class CommandGetRange: public Commander {
start_ = std::stoi(args[2]);
stop_ = std::stoi(args[3]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -421,7 +417,7 @@ class CommandSetRange: public Commander {
try {
offset_ = std::stoi(args[2]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -485,21 +481,21 @@ class CommandSet : public Commander {
} else if (opt == "ex" && !ttl_ && !last_arg) {
auto parse_result = ParseInt<int>(args_[++i], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
ttl_ = *parse_result;
if (ttl_ <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
} else if (opt == "exat" && !ttl_ && !expire_ && !last_arg) {
auto parse_result = ParseInt<int64_t>(args_[++i], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
expire_ = *parse_result;
if (expire_ <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
} else if (opt == "pxat" && !ttl_ && !expire_ && !last_arg) {
auto parse_result = ParseInt<uint64_t>(args[++i], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
uint64_t expire_ms = *parse_result;
if (expire_ms <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
@@ -513,7 +509,7 @@ class CommandSet : public Commander {
std::string s = args_[++i];
auto parse_result = ParseInt<int64_t>(s, 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
ttl_ms = *parse_result;
if (ttl_ms <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
@@ -575,7 +571,7 @@ class CommandSetEX : public Commander {
try {
ttl_ = std::stoi(args[2]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (ttl_ <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
return Commander::Parse(args);
@@ -597,7 +593,7 @@ class CommandPSetEX : public Commander {
Status Parse(const std::vector<std::string> &args) override {
auto ttl_ms = ParseInt<int64_t>(args[2], 10);
if (!ttl_ms) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (*ttl_ms <= 0) return Status(Status::RedisParseErr, errInvalidExpireTime);
if (*ttl_ms > 0 && *ttl_ms < 1000) {
@@ -709,7 +705,7 @@ class CommandIncrBy : public Commander {
Status Parse(const std::vector<std::string> &args) override {
auto parse_result = ParseInt<int64_t>(args[2], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
increment_ = *parse_result;
return Commander::Parse(args);
@@ -734,7 +730,7 @@ class CommandIncrByFloat : public Commander {
try {
increment_ = std::stod(args[2]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -757,7 +753,7 @@ class CommandDecrBy : public Commander {
Status Parse(const std::vector<std::string> &args) override {
auto parse_result = ParseInt<int64_t>(args[2], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
increment_ = *parse_result;
return Commander::Parse(args);
@@ -917,12 +913,12 @@ class CommandBitCount : public Commander {
if (args.size() == 4) {
auto parse_start = ParseInt<int64_t>(args[2], 10);
if (!parse_start) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
start_ = *parse_start;
auto parse_stop = ParseInt<int64_t>(args[3], 10);
if (!parse_stop) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
stop_ = *parse_stop;
}
@@ -948,14 +944,14 @@ class CommandBitPos: public Commander {
if (args.size() >= 4) {
auto parse_start = ParseInt<int64_t>(args[3], 10);
if (!parse_start) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
start_ = *parse_start;
}
if (args.size() >= 5) {
auto parse_stop = ParseInt<int64_t>(args[4], 10);
if (!parse_stop) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
stop_given_ = true;
stop_ = *parse_stop;
@@ -1115,7 +1111,7 @@ class CommandExpire : public Commander {
}
seconds_ += now;
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -1142,7 +1138,7 @@ class CommandPExpire : public Commander {
rocksdb::Env::Default()->GetCurrentTime(&now);
auto ttl_ms = ParseInt<int64_t>(args[2], 10);
if (!ttl_ms) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (*ttl_ms > 0 && *ttl_ms < 1000) {
seconds_ = 1;
@@ -1180,7 +1176,7 @@ class CommandExpireAt : public Commander {
return Status(Status::RedisParseErr, "the expire time was overflow");
}
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -1204,7 +1200,7 @@ class CommandPExpireAt : public Commander {
Status Parse(const std::vector<std::string> &args) override {
auto parse_result = ParseInt<int64_t>(args[2], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (*parse_result/1000 >= INT32_MAX) {
return Status(Status::RedisParseErr, "the expire time was overflow");
@@ -1338,7 +1334,7 @@ class CommandHIncrBy : public Commander {
Status Parse(const std::vector<std::string> &args) override {
auto parse_result = ParseInt<int64_t>(args[3], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
increment_ = *parse_result;
return Commander::Parse(args);
@@ -1364,7 +1360,7 @@ class CommandHIncrByFloat : public Commander {
try {
increment_ = std::stod(args[3]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -1501,7 +1497,7 @@ class CommandHRange : public Commander {
}
if (args.size() == 6) {
auto parse_result = ParseInt<int64_t>(args_[5], 10);
- if (!parse_result)return Status(Status::RedisParseErr, errValueNotInterger);
+ if (!parse_result)return Status(Status::RedisParseErr, errValueNotInteger);
limit_ = *parse_result;
}
return Commander::Parse(args);
@@ -1592,7 +1588,7 @@ class CommandPop : public Commander {
}
auto v = ParseInt<int32_t>(args[2], 10);
if (!v) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (*v < 0) {
return Status(Status::RedisParseErr, errValueMustBePositive);
@@ -1803,7 +1799,7 @@ class CommandLRem : public Commander {
try {
count_ = std::stoi(args[2]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
@@ -1857,7 +1853,7 @@ class CommandLRange : public Commander {
start_ = std::stoi(args[2]);
stop_ = std::stoi(args[3]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -1896,7 +1892,7 @@ class CommandLIndex : public Commander {
try {
index_ = std::stoi(args[2]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -1925,7 +1921,7 @@ class CommandLSet : public Commander {
try {
index_ = std::stoi(args[2]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -1950,7 +1946,7 @@ class CommandLTrim : public Commander {
start_ = std::stoi(args[2]);
stop_ = std::stoi(args[3]);
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -2126,7 +2122,7 @@ class CommandSPop : public Commander {
with_count_ = true;
}
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -2162,7 +2158,7 @@ class CommandSRandMember : public Commander {
count_ = std::stoi(args[2]);
}
} catch (std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -2441,7 +2437,7 @@ class CommandZPop : public Commander {
try {
count_ = std::stoi(args[2]);
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
}
return Commander::Parse(args);
@@ -2485,7 +2481,7 @@ class CommandZRange : public Commander {
start_ = std::stoi(args[2]);
stop_ = std::stoi(args[3]);
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (args.size() > 4 && (Util::ToLower(args[4]) == "withscores")) {
with_scores_ = true;
@@ -2548,7 +2544,7 @@ class CommandZRangeByLex : public Commander {
spec_.count = std::stoi(args[6]);
}
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -2599,7 +2595,7 @@ class CommandZRangeByScore : public Commander {
}
}
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -2694,7 +2690,7 @@ class CommandZRemRangeByRank : public Commander {
start_ = std::stoi(args[2]);
stop_ = std::stoi(args[3]);
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -2822,7 +2818,7 @@ class CommandZUnionStore : public Commander {
try {
numkeys_ = std::stoi(args[2]);
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (numkeys_ > args.size() - 3) {
return Status(Status::RedisParseErr, errInvalidSyntax);
@@ -3254,7 +3250,7 @@ class CommandSortedintAdd : public Commander {
ids_.emplace_back(id);
}
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -3283,7 +3279,7 @@ class CommandSortedintRem : public Commander {
ids_.emplace_back(id);
}
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -3327,7 +3323,7 @@ class CommandSortedintExists : public Commander {
ids.emplace_back(std::stoull(args_[i]));
}
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
std::vector<int> exists;
@@ -3363,7 +3359,7 @@ class CommandSortedintRange : public Commander {
cursor_id_ = std::stoull(args[5]);
}
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
return Commander::Parse(args);
}
@@ -3418,7 +3414,7 @@ class CommandSortedintRangeByValue : public Commander {
spec_.offset = std::stoi(args[5]);
spec_.count = std::stoi(args[6]);
} catch (const std::exception &e) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
}
return Commander::Parse(args);
@@ -4039,7 +4035,7 @@ class CommandClient : public Commander {
} else if (!strcasecmp(args[i].c_str(), "id") && moreargs) {
auto parse_result = ParseInt<uint64_t>(args[i+1], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
id_ = *parse_result;
} else if (!strcasecmp(args[i].c_str(), "skipme") && moreargs) {
@@ -5010,7 +5006,7 @@ class CommandXAdd : public Commander {
max_len_ = std::stoull(args[max_len_idx]);
with_max_len_ = true;
} catch (const std::exception &) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
i += eq_sign_found ? 3 : 2;
@@ -5184,7 +5180,7 @@ class CommandXInfo : public Commander {
try {
count_ = std::stoull(args[5]);
} catch (const std::exception &) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
}
}
@@ -5301,7 +5297,7 @@ class CommandXRange : public Commander {
with_count_ = true;
count_ = std::stoull(args[5]);
} catch (const std::exception &) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
}
@@ -5392,7 +5388,7 @@ class CommandXRevRange : public Commander {
with_count_ = true;
count_ = std::stoull(args[5]);
} catch (const std::exception &) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
}
@@ -5463,7 +5459,7 @@ class CommandXRead : public Commander {
with_count_ = true;
auto parse_result = ParseInt<uint64_t>(args[i+1], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
count_ = *parse_result;
i += 2;
@@ -5478,7 +5474,7 @@ class CommandXRead : public Commander {
block_ = true;
auto parse_result = ParseInt<int64_t>(args[i+1], 10);
if (!parse_result) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
if (*parse_result < 0) {
return Status(Status::RedisParseErr, errTimeoutIsNegative);
@@ -5496,7 +5492,7 @@ class CommandXRead : public Commander {
}
if ((args.size() - streams_word_idx - 1) % 2 != 0) {
- return Status(Status::RedisParseErr, errUnbalacedStreamList);
+ return Status(Status::RedisParseErr, errUnbalancedStreamList);
}
size_t number_of_streams = (args.size() - streams_word_idx - 1) / 2;
@@ -5764,7 +5760,7 @@ class CommandXTrim : public Commander {
try {
max_len_ = std::stoull(args[max_len_idx]);
} catch (const std::exception &) {
- return Status(Status::RedisParseErr, errValueNotInterger);
+ return Status(Status::RedisParseErr, errValueNotInteger);
}
} else if (trim_strategy == "minid") {
strategy_ = StreamTrimStrategy::MinID;
diff --git a/src/redis_cmd.h b/src/redis_cmd.h
index db36709..8bdddf8 100644
--- a/src/redis_cmd.h
+++ b/src/redis_cmd.h
@@ -20,20 +20,20 @@
#pragma once
-#include <list>
-#include <map>
-#include <string>
-#include <vector>
-#include <thread>
-#include <utility>
-#include <memory>
-
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <glog/logging.h>
#include <rocksdb/types.h>
#include <rocksdb/utilities/backup_engine.h>
+#include <list>
+#include <map>
+#include <memory>
+#include <string>
+#include <thread>
+#include <utility>
+#include <vector>
+
#include "redis_reply.h"
#include "status.h"
diff --git a/src/redis_connection.h b/src/redis_connection.h
index c4c2d3f..78c0b2d 100644
--- a/src/redis_connection.h
+++ b/src/redis_connection.h
@@ -20,13 +20,13 @@
#pragma once
-#include <vector>
+#include <event2/buffer.h>
+
#include <deque>
+#include <memory>
#include <string>
#include <utility>
-#include <memory>
-
-#include <event2/buffer.h>
+#include <vector>
#include "redis_cmd.h"
#include "redis_request.h"
diff --git a/src/redis_hash.cc b/src/redis_hash.cc
index 968eed1..5405f85 100644
--- a/src/redis_hash.cc
+++ b/src/redis_hash.cc
@@ -19,13 +19,15 @@
*/
#include "redis_hash.h"
-#include <cctype>
-#include <utility>
+
+#include <rocksdb/status.h>
+
#include <algorithm>
-#include <limits>
+#include <cctype>
#include <cmath>
-#include <iostream>
-#include <rocksdb/status.h>
+#include <limits>
+#include <utility>
+
#include "db_util.h"
#include "parse_util.h"
diff --git a/src/redis_hash.h b/src/redis_hash.h
index 9667f78..c80ad01 100644
--- a/src/redis_hash.h
+++ b/src/redis_hash.h
@@ -20,13 +20,13 @@
#pragma once
+#include <rocksdb/status.h>
+
#include <string>
#include <vector>
-#include <rocksdb/status.h>
-
-#include "redis_db.h"
#include "encoding.h"
+#include "redis_db.h"
#include "redis_metadata.h"
typedef struct FieldValue {
diff --git a/src/redis_metadata.cc b/src/redis_metadata.cc
index 5c1f4d3..e8af1fd 100644
--- a/src/redis_metadata.cc
+++ b/src/redis_metadata.cc
@@ -19,14 +19,17 @@
*/
#include "redis_metadata.h"
-#include "redis_slot.h"
-#include <time.h>
-#include <stdlib.h>
+
+#include <rocksdb/env.h>
#include <sys/time.h>
-#include <vector>
#include <atomic>
-#include <rocksdb/env.h>
+#include <ctime>
+#include <cstdlib>
+#include <vector>
+
+#include "redis_slot.h"
+
// 52 bit for microseconds and 11 bit for counter
const int VersionCounterBits = 11;
diff --git a/src/redis_metadata.h b/src/redis_metadata.h
index f7a6f32..1904f7f 100644
--- a/src/redis_metadata.h
+++ b/src/redis_metadata.h
@@ -20,11 +20,11 @@
#pragma once
+#include <rocksdb/status.h>
+
+#include <atomic>
#include <string>
#include <vector>
-#include <atomic>
-
-#include <rocksdb/status.h>
#include "encoding.h"
#include "redis_stream_base.h"
diff --git a/src/redis_reply.cc b/src/redis_reply.cc
index f9dcc1e..a030319 100644
--- a/src/redis_reply.cc
+++ b/src/redis_reply.cc
@@ -19,6 +19,7 @@
*/
#include "redis_reply.h"
+
#include <numeric>
namespace Redis {
diff --git a/src/redis_reply.h b/src/redis_reply.h
index e049ef1..8305c8b 100644
--- a/src/redis_reply.h
+++ b/src/redis_reply.h
@@ -20,11 +20,12 @@
#pragma once
-#include <string>
-#include <vector>
#include <event2/buffer.h>
#include <rocksdb/status.h>
+#include <string>
+#include <vector>
+
#define CRLF "\r\n"
namespace Redis {
diff --git a/src/redis_request.cc b/src/redis_request.cc
index 47ff509..16dfeb7 100644
--- a/src/redis_request.cc
+++ b/src/redis_request.cc
@@ -18,21 +18,22 @@
*
*/
-#include <chrono>
-#include <utility>
-#include <memory>
+#include "redis_request.h"
+
#include <glog/logging.h>
#include <rocksdb/perf_context.h>
-#include <rocksdb/iostats_context.h>
-#include "util.h"
-#include "redis_reply.h"
-#include "redis_request.h"
-#include "redis_connection.h"
-#include "server.h"
-#include "redis_slot.h"
+#include <chrono>
+#include <memory>
+#include <utility>
+
#include "event_util.h"
#include "parse_util.h"
+#include "redis_connection.h"
+#include "redis_reply.h"
+#include "redis_slot.h"
+#include "server.h"
+#include "util.h"
namespace Redis {
const size_t PROTO_INLINE_MAX_SIZE = 16 * 1024L;
diff --git a/src/redis_request.h b/src/redis_request.h
index b8d658e..cba47a1 100644
--- a/src/redis_request.h
+++ b/src/redis_request.h
@@ -20,10 +20,11 @@
#pragma once
+#include <event2/buffer.h>
+
#include <deque>
-#include <vector>
#include <string>
-#include <event2/buffer.h>
+#include <vector>
#include "status.h"
diff --git a/src/redis_stream.cc b/src/redis_stream.cc
index bc402e5..5299bf0 100644
--- a/src/redis_stream.cc
+++ b/src/redis_stream.cc
@@ -20,13 +20,12 @@
#include "redis_stream.h"
+#include <rocksdb/status.h>
+
#include <memory>
#include <utility>
#include <vector>
-#include <glog/logging.h>
-#include <rocksdb/status.h>
-
#include "db_util.h"
@@ -431,6 +430,9 @@ rocksdb::Status Stream::GetStreamInfo(const rocksdb::Slice &stream_name, bool fu
options.end = metadata.last_entry_id;
options.with_count = true;
options.count = need_entries;
+ options.reverse = false;
+ options.exclude_start = false;
+ options.exclude_end = false;
s = range(ns_key, metadata, options, &info->entries);
if (!s.ok()) {
diff --git a/src/redis_stream.h b/src/redis_stream.h
index a9bd072..c83d498 100644
--- a/src/redis_stream.h
+++ b/src/redis_stream.h
@@ -20,11 +20,11 @@
#pragma once
+#include <rocksdb/status.h>
+
#include <string>
#include <vector>
-#include <rocksdb/status.h>
-
#include "redis_db.h"
#include "redis_metadata.h"
diff --git a/src/redis_stream_base.h b/src/redis_stream_base.h
index 39c3d09..44232b0 100644
--- a/src/redis_stream_base.h
+++ b/src/redis_stream_base.h
@@ -20,13 +20,13 @@
#pragma once
+#include <rocksdb/status.h>
+
#include <memory>
#include <string>
#include <utility>
#include <vector>
-#include <rocksdb/status.h>
-
#include "status.h"
namespace Redis {
@@ -113,10 +113,10 @@ struct StreamRangeOptions {
StreamEntryID start;
StreamEntryID end;
uint64_t count;
+ bool with_count = false;
bool reverse = false;
bool exclude_start = false;
bool exclude_end = false;
- bool with_count = false;
};
struct StreamInfo {
diff --git a/src/replication.cc b/src/replication.cc
index af5dff8..84ad3e0 100644
--- a/src/replication.cc
+++ b/src/replication.cc
@@ -20,24 +20,24 @@
#include "replication.h"
-#include <signal.h>
#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <future>
-#include <string>
-#include <thread>
-#include <algorithm>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <glog/logging.h>
+#include <algorithm>
+#include <csignal>
+#include <future>
+#include <string>
+#include <thread>
+
+#include "event_util.h"
#include "redis_reply.h"
#include "rocksdb_crc32c.h"
-#include "util.h"
-#include "status.h"
#include "server.h"
-#include "event_util.h"
+#include "status.h"
+#include "util.h"
Status FeedSlaveThread::Start() {
try {
diff --git a/src/replication.h b/src/replication.h
index 5632e1a..3e60713 100644
--- a/src/replication.h
+++ b/src/replication.h
@@ -20,18 +20,19 @@
#pragma once
-#include <thread>
-#include <vector>
-#include <utility>
+#include <event2/bufferevent.h>
+
+#include <deque>
#include <memory>
-#include <tuple>
#include <string>
-#include <deque>
-#include <event2/bufferevent.h>
+#include <thread>
+#include <tuple>
+#include <utility>
+#include <vector>
+#include "redis_connection.h"
#include "status.h"
#include "storage.h"
-#include "redis_connection.h"
class Server;
diff --git a/src/server.cc b/src/server.cc
index 6818d6d..484f810 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -20,25 +20,27 @@
#include "server.h"
+#include <glog/logging.h>
+#include <rocksdb/convenience.h>
+
#include <fcntl.h>
#include <sys/statvfs.h>
#include <sys/utsname.h>
#include <sys/resource.h>
+
#include <memory>
#include <utility>
-#include <glog/logging.h>
-#include <rocksdb/convenience.h>
-#include <tls_util.h>
-#include "util.h"
-#include "worker.h"
-#include "version.h"
+#include "config.h"
+#include "compaction_checker.h"
+#include "redis_connection.h"
#include "redis_db.h"
#include "redis_request.h"
-#include "redis_connection.h"
-#include "compaction_checker.h"
-#include "config.h"
#include "scripting.h"
+#include "tls_util.h"
+#include "util.h"
+#include "version.h"
+#include "worker.h"
std::atomic<int>Server::unix_time_ = {0};
diff --git a/src/slot_import.h b/src/slot_import.h
index 75e5447..fc0d825 100644
--- a/src/slot_import.h
+++ b/src/slot_import.h
@@ -20,13 +20,14 @@
#pragma once
+#include <glog/logging.h>
+
+#include <mutex>
#include <string>
#include <vector>
-#include <mutex>
-#include <glog/logging.h>
-#include "redis_db.h"
#include "config.h"
+#include "redis_db.h"
#include "server.h"
enum ImportStatus{
diff --git a/src/slot_migrate.h b/src/slot_migrate.h
index e8c6864..ac0fca3 100644
--- a/src/slot_migrate.h
+++ b/src/slot_migrate.h
@@ -20,27 +20,28 @@
#pragma once
-#include <string>
-#include <vector>
-#include <thread>
+#include <glog/logging.h>
+#include <rocksdb/db.h>
+#include <rocksdb/status.h>
+#include <rocksdb/transaction_log.h>
+#include <rocksdb/write_batch.h>
+
#include <chrono>
#include <map>
#include <memory>
-#include <rocksdb/status.h>
-#include <rocksdb/write_batch.h>
-#include <rocksdb/db.h>
-#include <rocksdb/transaction_log.h>
-#include <glog/logging.h>
+#include <string>
+#include <thread>
+#include <vector>
-#include "redis_db.h"
#include "config.h"
+#include "encoding.h"
+#include "redis_db.h"
+#include "redis_slot.h"
#include "server.h"
-#include "stats.h"
-#include "util.h"
#include "slot_import.h"
-#include "encoding.h"
+#include "stats.h"
#include "status.h"
-#include "redis_slot.h"
+#include "util.h"
#define CLUSTER_SLOTS HASH_SLOTS_SIZE
diff --git a/src/status.h b/src/status.h
index 89b0872..231bfd7 100644
--- a/src/status.h
+++ b/src/status.h
@@ -20,13 +20,14 @@
#pragma once
+#include <glog/logging.h>
+
+#include <algorithm>
+#include <memory>
#include <string>
#include <type_traits>
-#include <utility>
-#include <memory>
-#include <algorithm>
#include <tuple>
-#include <glog/logging.h>
+#include <utility>
class Status {
public:
diff --git a/src/storage.cc b/src/storage.cc
index 73da1e0..6ad4346 100644
--- a/src/storage.cc
+++ b/src/storage.cc
@@ -20,31 +20,33 @@
#include "storage.h"
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <iostream>
-#include <memory>
-#include <random>
-#include <algorithm>
#include <event2/buffer.h>
#include <glog/logging.h>
+#include <rocksdb/convenience.h>
+#include <rocksdb/env.h>
#include <rocksdb/filter_policy.h>
-#include <rocksdb/sst_file_manager.h>
-#include <rocksdb/utilities/table_properties_collectors.h>
#include <rocksdb/rate_limiter.h>
-#include <rocksdb/env.h>
+#include <rocksdb/sst_file_manager.h>
#include <rocksdb/utilities/checkpoint.h>
-#include <rocksdb/convenience.h>
+#include <rocksdb/utilities/table_properties_collectors.h>
-#include "server.h"
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <algorithm>
+#include <iostream>
+#include <memory>
+#include <random>
+
+#include "compact_filter.h"
#include "config.h"
+#include "event_listener.h"
+#include "event_util.h"
#include "redis_db.h"
-#include "rocksdb_crc32c.h"
#include "redis_metadata.h"
-#include "event_listener.h"
-#include "compact_filter.h"
+#include "rocksdb_crc32c.h"
+#include "server.h"
#include "table_properties_collector.h"
-#include "event_util.h"
namespace Engine {
diff --git a/src/storage.h b/src/storage.h
index 1ba5eee..cee9a12 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -20,22 +20,23 @@
#pragma once
-#include <inttypes.h>
-#include <utility>
-#include <memory>
-#include <string>
-#include <vector>
-#include <atomic>
+#include <event2/bufferevent.h>
#include <rocksdb/db.h>
#include <rocksdb/options.h>
#include <rocksdb/table.h>
#include <rocksdb/utilities/backup_engine.h>
-#include <event2/bufferevent.h>
-#include "status.h"
-#include "lock_manager.h"
+#include <atomic>
+#include <cinttypes>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "config.h"
+#include "lock_manager.h"
#include "rw_lock.h"
+#include "status.h"
const int kReplIdLength = 16;
diff --git a/src/table_properties_collector.h b/src/table_properties_collector.h
index e683d54..c5ab953 100644
--- a/src/table_properties_collector.h
+++ b/src/table_properties_collector.h
@@ -20,11 +20,12 @@
#pragma once
-#include <utility>
-#include <string>
-#include <memory>
#include <rocksdb/table_properties.h>
+#include <memory>
+#include <string>
+#include <utility>
+
class CompactOnExpiredCollector : public rocksdb::TablePropertiesCollector {
public:
explicit CompactOnExpiredCollector(const std::string &cf_name, float trigger_threshold)
diff --git a/src/tls_util.cc b/src/tls_util.cc
index 6d63d4a..93c75da 100644
--- a/src/tls_util.cc
+++ b/src/tls_util.cc
@@ -21,14 +21,18 @@
#ifdef ENABLE_OPENSSL
#include "tls_util.h"
-#include <pthread.h>
-#include <bitset>
-#include <string>
-#include <mutex>
+
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/opensslv.h>
+
+#include <pthread.h>
+
+#include <bitset>
+#include <mutex>
+#include <string>
+
#include "config.h"
#if OPENSSL_VERSION_NUMBER < 0x10100000L
diff --git a/src/tls_util.h b/src/tls_util.h
index 16a29fa..98c14b6 100644
--- a/src/tls_util.h
+++ b/src/tls_util.h
@@ -22,9 +22,11 @@
#ifdef ENABLE_OPENSSL
-#include <memory>
#include <openssl/ssl.h>
-#include <config.h>
+
+#include <memory>
+
+#include "config.h"
#include "event_util.h"
void InitSSL();
diff --git a/src/util.cc b/src/util.cc
index 7c80ab9..56be9a2 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -19,32 +19,35 @@
*/
#define __STDC_FORMAT_MACROS
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <poll.h>
-#include <errno.h>
-#include <pthread.h>
-#include <fcntl.h>
-#include <math.h>
-#include <string>
-#include <algorithm>
+
#include <event2/util.h>
#include <event2/buffer.h>
#include <glog/logging.h>
+
#ifdef __linux__
#include <sys/sendfile.h>
#endif
+#include <fcntl.h>
+#include <netdb.h>
+#include <netinet/tcp.h>
+#include <poll.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <cerrno>
+#include <cmath>
+#include <string>
-#include "util.h"
-#include "status.h"
#include "event_util.h"
#include "parse_util.h"
+#include "status.h"
+#include "util.h"
#ifndef POLLIN
# define POLLIN 0x0001 /* There is data to read */
@@ -101,7 +104,7 @@ Status SockConnect(const std::string &host, uint32_t port, int *fd) {
}
const std::string Float2String(double d) {
- if (isinf(d)) {
+ if (std::isinf(d)) {
return d > 0 ? "inf" : "-inf";
}
diff --git a/src/util.h b/src/util.h
index 7a9a317..0f9a60d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -21,18 +21,19 @@
#pragma once
#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
+
#include <arpa/inet.h>
#include <cctype>
+#include <cinttypes>
+#include <chrono>
+#include <memory>
#include <string>
-#include <vector>
#include <utility>
-#include <memory>
-#include <chrono>
+#include <vector>
-#include "status.h"
#include "solarisfixes.h"
+#include "status.h"
namespace Util {
// sock util
diff --git a/src/worker.cc b/src/worker.cc
index 5657e9e..a829a76 100644
--- a/src/worker.cc
+++ b/src/worker.cc
@@ -20,17 +20,8 @@
#include "worker.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/un.h>
-#include <list>
-#include <cctype>
-#include <cstring>
-#include <utility>
-#include <algorithm>
-#include <glog/logging.h>
#include <event2/util.h>
+#include <glog/logging.h>
#ifdef ENABLE_OPENSSL
#include <event2/bufferevent_ssl.h>
@@ -38,6 +29,17 @@
#include <openssl/err.h>
#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+
+#include <algorithm>
+#include <cctype>
+#include <cstring>
+#include <list>
+#include <utility>
+
#include "redis_connection.h"
#include "redis_request.h"
#include "scripting.h"
diff --git a/src/worker.h b/src/worker.h
index 81c74bb..9edc6aa 100644
--- a/src/worker.h
+++ b/src/worker.h
@@ -20,22 +20,25 @@
#pragma once
+#include <event2/buffer.h>
+#include <event2/bufferevent.h>
+#include <event2/listener.h>
+#include <event2/util.h>
+
+#include <cstdint>
#include <cstring>
#include <iostream>
#include <map>
#include <memory>
-#include <thread>
#include <string>
+#include <thread>
#include <utility>
#include <vector>
-#include <event2/buffer.h>
-#include <event2/bufferevent.h>
-#include <event2/listener.h>
-#include <event2/util.h>
-#include "storage.h"
-#include "lua.hpp"
+#include <lua.hpp>
+
#include "redis_connection.h"
+#include "storage.h"
class Server;