Skip to content

Commit b6d4d25

Browse files
authored
Merge branch 'unstable' into feat/set-ifeq-ifne-ifdeq-ifdne
2 parents a059ae3 + 94e4c8e commit b6d4d25

File tree

24 files changed

+428
-64
lines changed

24 files changed

+428
-64
lines changed

.github/workflows/kvrocks.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
docs_only: ${{ steps.result.outputs.docs_only }}
4141
steps:
4242
- uses: actions/checkout@v6
43-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
43+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d
4444
id: changes
4545
with:
4646
filters: .github/config/changes.yml
@@ -61,7 +61,7 @@ jobs:
6161
uses: crate-ci/typos@v1.45.0
6262
with:
6363
config: .github/config/typos.toml
64-
- uses: apache/skywalking-eyes/header@v0.7.0
64+
- uses: apache/skywalking-eyes/header@v0.8.0
6565
with:
6666
config: .github/config/licenserc.yml
6767

@@ -297,14 +297,14 @@ jobs:
297297
with:
298298
path: |
299299
~/local/bin/redis-cli
300-
key: ${{ runner.os }}-${{ runner.arch }}-redis-cli
300+
key: ${{ matrix.os }}-redis-cli
301301
- name: Cache redis server
302302
id: cache-redis-server
303303
uses: actions/cache@v5
304304
with:
305305
path: |
306306
~/local/bin/redis-server
307-
key: ${{ runner.os }}-${{ runner.arch }}-redis-server
307+
key: ${{ matrix.os }}-redis-server
308308
- name: Install redis
309309
if: ${{ steps.cache-redis.outputs.cache-hit != 'true' || steps.cache-redis-server.outputs.cache-hit != 'true' }}
310310
run: |

CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,11 @@ option(ASAN_WITH_LSAN "enable leak sanitizer while address sanitizer is enabled"
3030
option(ENABLE_STATIC_LIBSTDCXX "link kvrocks with static library of libstd++ instead of shared library" ON)
3131
option(ENABLE_LUAJIT "enable use of luaJIT instead of lua" ON)
3232
option(ENABLE_OPENSSL "enable openssl to support tls connection" OFF)
33-
option(ENABLE_LTO "enable link-time optimization" ON)
33+
option(ENABLE_LTO "enable link-time optimization" OFF)
3434
set(SYMBOLIZE_BACKEND "" CACHE STRING "symbolization backend library for cpptrace (libbacktrace, libdwarf, or empty)")
3535
set(PORTABLE 0 CACHE STRING "build a portable binary (disable arch-specific optimizations)")
3636
option(ENABLE_NEW_ENCODING "enable new encoding (#1033) for storing 64bit size and expire time in milliseconds" ON)
3737

38-
# to save build time in debug mode
39-
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
40-
set(ENABLE_LTO OFF)
41-
endif()
42-
4338
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
4439
cmake_policy(SET CMP0135 NEW)
4540
endif()
@@ -144,7 +139,6 @@ endif()
144139

145140
if (CMAKE_HOST_APPLE)
146141
set(DISABLE_JEMALLOC ON)
147-
set(ENABLE_LTO OFF)
148142
endif ()
149143

150144
if(NOT DISABLE_JEMALLOC)
@@ -298,11 +292,6 @@ else()
298292
target_compile_definitions(kvrocks_objs PUBLIC METADATA_ENCODING_VERSION=0)
299293
endif()
300294

301-
# disable LTO on GCC <= 9 due to an ICE
302-
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10))
303-
set(ENABLE_LTO OFF)
304-
endif()
305-
306295
if(ENABLE_LTO)
307296
include(CheckIPOSupported)
308297
check_ipo_supported(RESULT ipo_result OUTPUT ipo_output LANGUAGES CXX)

cmake/lua.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ include_guard()
2020
include(cmake/utils.cmake)
2121

2222
FetchContent_DeclareGitHubWithMirror(lua
23-
RocksLabs/lua f458c3d797db31155fa0c156d5301716df48cb8c
24-
MD5=c7c4deb9f750d8f2bef0044a701df85c
23+
RocksLabs/lua c77781d0c23df021a903a9a6199d301ec559e9cd
24+
MD5=8e9f463af29c0fe17baea52f21e5b790
2525
)
2626

2727
FetchContent_GetProperties(lua)

kvrocks.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,19 @@ rocksdb.compression snappy
923923
# compression library as mentioned above)
924924
rocksdb.compression_level 32767
925925

926+
# Maximum per-SST dictionary size for block compression. Set to 0 to disable
927+
# dictionary compression.
928+
#
929+
# Default: 0
930+
rocksdb.compression_max_dict_bytes 0
931+
932+
# Maximum amount of training data used by the ZSTD dictionary trainer. This is
933+
# most useful when rocksdb.compression is set to zstd and rocksdb.compression_max_dict_bytes
934+
# is non-zero.
935+
#
936+
# Default: 0
937+
rocksdb.compression_zstd_max_train_bytes 0
938+
926939
# If non-zero, we perform bigger reads when doing compaction. If you're
927940
# running RocksDB on spinning disks, you should set this to at least 2MB.
928941
# That way RocksDB's compaction is doing sequential instead of random reads.

src/commands/cmd_stream.cc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -566,17 +566,13 @@ class CommandXGroup : public Commander {
566566
}
567567

568568
if (subcommand_ == "destroy") {
569-
uint64_t delete_cnt = 0;
570-
auto s = stream_db.DestroyGroup(ctx, stream_name_, group_name_, &delete_cnt);
569+
bool destroyed = false;
570+
auto s = stream_db.DestroyGroup(ctx, stream_name_, group_name_, &destroyed);
571571
if (!s.ok()) {
572572
return {Status::RedisExecErr, s.ToString()};
573573
}
574574

575-
if (delete_cnt > 0) {
576-
*output = redis::Integer(1);
577-
} else {
578-
*output = redis::Integer(0);
579-
}
575+
*output = redis::Integer(destroyed ? 1 : 0);
580576
}
581577

582578
if (subcommand_ == "createconsumer") {
@@ -1891,7 +1887,7 @@ REDIS_REGISTER_COMMANDS(Stream, MakeCmdAttr<CommandXAck>("xack", -4, "write no-d
18911887
MakeCmdAttr<CommandXInfo>("xinfo", -2, "read-only", NO_KEY),
18921888
MakeCmdAttr<CommandXPending>("xpending", -3, "read-only", 1, 1, 1),
18931889
MakeCmdAttr<CommandXRange>("xrange", -4, "read-only", 1, 1, 1),
1894-
MakeCmdAttr<CommandXRevRange>("xrevrange", -2, "read-only", 1, 1, 1),
1890+
MakeCmdAttr<CommandXRevRange>("xrevrange", -4, "read-only", 1, 1, 1),
18951891
MakeCmdAttr<CommandXRead>("xread", -4, "read-only blocking", CommandXRead::keyRangeGen),
18961892
MakeCmdAttr<CommandXReadGroup>("xreadgroup", -7, "write blocking",
18971893
CommandXReadGroup::keyRangeGen),

src/config/config.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ Config::Config() {
254254
new EnumField<rocksdb::CompressionType>(&rocks_db.compression, compression_types,
255255
rocksdb::CompressionType::kNoCompression)},
256256
{"rocksdb.compression_level", true, new IntField(&rocks_db.compression_level, 32767, INT_MIN, INT_MAX)},
257+
{"rocksdb.compression_max_dict_bytes", true,
258+
new UInt32Field(&rocks_db.compression_max_dict_bytes, 0, 0, UINT32_MAX)},
259+
{"rocksdb.compression_zstd_max_train_bytes", true,
260+
new UInt32Field(&rocks_db.compression_zstd_max_train_bytes, 0, 0, UINT32_MAX)},
257261
{"rocksdb.compression_start_level", false,
258262
new IntField(&rocks_db.compression_start_level, 2, 0, KVROCKS_MAX_LSM_LEVEL - 1)},
259263
{"rocksdb.block_size", true, new IntField(&rocks_db.block_size, 16384, 0, INT_MAX)},

src/config/config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ struct Config {
236236
rocksdb::CompressionType compression;
237237
int compression_start_level;
238238
int compression_level;
239+
uint32_t compression_max_dict_bytes;
240+
uint32_t compression_zstd_max_train_bytes;
239241
bool disable_auto_compactions;
240242
bool enable_blob_files;
241243
int min_blob_size;

src/storage/storage.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ rocksdb::Options Storage::InitRocksDBOptions() {
178178
options.write_buffer_size = config_->rocks_db.write_buffer_size * MiB;
179179
options.num_levels = KVROCKS_MAX_LSM_LEVEL;
180180
options.compression_opts.level = config_->rocks_db.compression_level;
181+
options.compression_opts.max_dict_bytes = config_->rocks_db.compression_max_dict_bytes;
182+
options.compression_opts.zstd_max_train_bytes = config_->rocks_db.compression_zstd_max_train_bytes;
181183
options.compression_per_level.resize(options.num_levels);
182184
options.wal_compression = config_->rocks_db.wal_compression;
183185
for (int i = 0; i < options.num_levels; ++i) {

src/types/redis_geo.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,6 @@ bool Geo::appendIfWithinShape(std::vector<GeoPoint> *geo_points, const GeoShape
421421

422422
bool Geo::sortGeoPointASC(const GeoPoint &gp1, const GeoPoint &gp2) { return gp1.dist < gp2.dist; }
423423

424-
bool Geo::sortGeoPointDESC(const GeoPoint &gp1, const GeoPoint &gp2) { return gp1.dist >= gp2.dist; }
424+
bool Geo::sortGeoPointDESC(const GeoPoint &gp1, const GeoPoint &gp2) { return gp1.dist > gp2.dist; }
425425

426426
} // namespace redis

src/types/redis_hash.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <random>
2929
#include <utility>
3030

31+
#include "common/string_util.h"
3132
#include "db_util.h"
3233
#include "parse_util.h"
3334
#include "sample_helper.h"
@@ -144,7 +145,7 @@ rocksdb::Status Hash::IncrByFloat(engine::Context &ctx, const Slice &user_key, c
144145
WriteBatchLogData log_data(kRedisHash);
145146
s = batch->PutLogData(log_data.Encode());
146147
if (!s.ok()) return s;
147-
s = batch->Put(sub_key, std::to_string(*new_value));
148+
s = batch->Put(sub_key, util::Float2String(*new_value));
148149
if (!s.ok()) return s;
149150
if (!exists) {
150151
metadata.size += 1;

0 commit comments

Comments
 (0)