Skip to content

Commit

Permalink
Merge branch 'unstable' into aleksraiden-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Oct 3, 2024
2 parents 8ed9607 + b6b4cbe commit 6108d61
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/kvrocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ jobs:
run: apt install -y python3-redis

- name: Run kvrocks2redis Test
# FIXME: https://github.com/apache/kvrocks/issues/2574
if: ${{ !startsWith(matrix.image, 'archlinux') }}
shell: bash
run: |
$HOME/local/bin/redis-server --daemonize yes
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,6 @@ REDIS_REGISTER_COMMANDS(Hash, MakeCmdAttr<CommandHGet>("hget", 3, "read-only", 1
MakeCmdAttr<CommandHGetAll>("hgetall", 2, "read-only slow", 1, 1, 1),
MakeCmdAttr<CommandHScan>("hscan", -3, "read-only", 1, 1, 1),
MakeCmdAttr<CommandHRangeByLex>("hrangebylex", -4, "read-only", 1, 1, 1),
MakeCmdAttr<CommandHRandField>("hrandfield", -2, "read-only", 1, 1, 1), )
MakeCmdAttr<CommandHRandField>("hrandfield", -2, "read-only slow", 1, 1, 1), )

} // namespace redis
4 changes: 2 additions & 2 deletions src/commands/cmd_key.cc
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ REDIS_REGISTER_COMMANDS(Key, MakeCmdAttr<CommandTTL>("ttl", 2, "read-only", 1, 1
MakeCmdAttr<CommandRename>("rename", 3, "write", 1, 2, 1),
MakeCmdAttr<CommandRenameNX>("renamenx", 3, "write", 1, 2, 1),
MakeCmdAttr<CommandCopy>("copy", -3, "write", 1, 2, 1),
MakeCmdAttr<CommandSort<false>>("sort", -2, "write", 1, 1, 1),
MakeCmdAttr<CommandSort<true>>("sort_ro", -2, "read-only", 1, 1, 1))
MakeCmdAttr<CommandSort<false>>("sort", -2, "write slow", 1, 1, 1),
MakeCmdAttr<CommandSort<true>>("sort_ro", -2, "read-only slow", 1, 1, 1))

} // namespace redis
3 changes: 2 additions & 1 deletion src/commands/cmd_search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ class CommandFTDrop : public Commander {
};

REDIS_REGISTER_COMMANDS(Search,
MakeCmdAttr<CommandFTCreate>("ft.create", -2, "write exclusive no-multi no-script", 0, 0, 0),
MakeCmdAttr<CommandFTCreate>("ft.create", -2, "write exclusive no-multi no-script slow", 0, 0,
0),
MakeCmdAttr<CommandFTSearchSQL>("ft.searchsql", -2, "read-only", 0, 0, 0),
MakeCmdAttr<CommandFTSearch>("ft.search", -3, "read-only", 0, 0, 0),
MakeCmdAttr<CommandFTExplainSQL>("ft.explainsql", -2, "read-only", 0, 0, 0),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ REDIS_REGISTER_COMMANDS(Server, MakeCmdAttr<CommandAuth>("auth", 2, "read-only o
MakeCmdAttr<CommandRole>("role", 1, "read-only ok-loading", 0, 0, 0),
MakeCmdAttr<CommandConfig>("config", -2, "read-only", 0, 0, 0, GenerateConfigFlag),
MakeCmdAttr<CommandNamespace>("namespace", -3, "read-only", 0, 0, 0),
MakeCmdAttr<CommandKeys>("keys", 2, "read-only", 0, 0, 0),
MakeCmdAttr<CommandKeys>("keys", 2, "read-only slow", 0, 0, 0),
MakeCmdAttr<CommandFlushDB>("flushdb", 1, "write no-dbsize-check", 0, 0, 0),
MakeCmdAttr<CommandFlushAll>("flushall", 1, "write no-dbsize-check", 0, 0, 0),
MakeCmdAttr<CommandDBSize>("dbsize", -1, "read-only", 0, 0, 0),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ REDIS_REGISTER_COMMANDS(Set, MakeCmdAttr<CommandSAdd>("sadd", -3, "write", 1, 1,
MakeCmdAttr<CommandSIsMember>("sismember", 3, "read-only", 1, 1, 1),
MakeCmdAttr<CommandSMIsMember>("smismember", -3, "read-only", 1, 1, 1),
MakeCmdAttr<CommandSPop>("spop", -2, "write", 1, 1, 1),
MakeCmdAttr<CommandSRandMember>("srandmember", -2, "read-only", 1, 1, 1),
MakeCmdAttr<CommandSRandMember>("srandmember", -2, "read-only slow", 1, 1, 1),
MakeCmdAttr<CommandSMove>("smove", 4, "write", 1, 2, 1),
MakeCmdAttr<CommandSDiff>("sdiff", -2, "read-only slow", 1, -1, 1),
MakeCmdAttr<CommandSUnion>("sunion", -2, "read-only slow", 1, -1, 1),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_txn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CommandUnwatch : public Commander {

REDIS_REGISTER_COMMANDS(Txn, MakeCmdAttr<CommandMulti>("multi", 1, "multi", 0, 0, 0),
MakeCmdAttr<CommandDiscard>("discard", 1, "multi", 0, 0, 0),
MakeCmdAttr<CommandExec>("exec", 1, "exclusive multi", 0, 0, 0),
MakeCmdAttr<CommandExec>("exec", 1, "exclusive multi slow", 0, 0, 0),
MakeCmdAttr<CommandWatch>("watch", -2, "multi", 1, -1, 1),
MakeCmdAttr<CommandUnwatch>("unwatch", 1, "multi", 0, 0, 0), )

Expand Down
16 changes: 9 additions & 7 deletions src/types/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ struct JsonValue {
Mul = 2,
};

static const size_t default_max_nesting_depth = 1024;

JsonValue() = default;
explicit JsonValue(jsoncons::basic_json<char> value) : value(std::move(value)) {}

static StatusOr<JsonValue> FromString(std::string_view str, int max_nesting_depth = std::numeric_limits<int>::max()) {
static StatusOr<JsonValue> FromString(std::string_view str, int max_nesting_depth = default_max_nesting_depth) {
jsoncons::json val;

jsoncons::json_options options;
Expand All @@ -69,7 +71,7 @@ struct JsonValue {
return JsonValue(std::move(val));
}

static StatusOr<JsonValue> FromCBOR(std::string_view str, int max_nesting_depth = std::numeric_limits<int>::max()) {
static StatusOr<JsonValue> FromCBOR(std::string_view str, int max_nesting_depth = default_max_nesting_depth) {
jsoncons::json val;

jsoncons::cbor::cbor_options options;
Expand All @@ -84,13 +86,13 @@ struct JsonValue {
return JsonValue(std::move(val));
}

StatusOr<std::string> Dump(int max_nesting_depth = std::numeric_limits<int>::max()) const {
StatusOr<std::string> Dump(int max_nesting_depth = default_max_nesting_depth) const {
std::string res;
GET_OR_RET(Dump(&res, max_nesting_depth));
return res;
}

Status Dump(std::string *buffer, int max_nesting_depth = std::numeric_limits<int>::max()) const {
Status Dump(std::string *buffer, int max_nesting_depth = default_max_nesting_depth) const {
jsoncons::json_options options;
options.max_nesting_depth(max_nesting_depth);

Expand All @@ -104,13 +106,13 @@ struct JsonValue {
return Status::OK();
}

StatusOr<std::string> DumpCBOR(int max_nesting_depth = std::numeric_limits<int>::max()) const {
StatusOr<std::string> DumpCBOR(int max_nesting_depth = default_max_nesting_depth) const {
std::string res;
GET_OR_RET(DumpCBOR(&res, max_nesting_depth));
return res;
}

Status DumpCBOR(std::string *buffer, int max_nesting_depth = std::numeric_limits<int>::max()) const {
Status DumpCBOR(std::string *buffer, int max_nesting_depth = default_max_nesting_depth) const {
jsoncons::cbor::cbor_options options;
options.max_nesting_depth(max_nesting_depth);

Expand Down Expand Up @@ -221,7 +223,7 @@ struct JsonValue {
}

StatusOr<std::vector<size_t>> GetBytes(std::string_view path, JsonStorageFormat format,
int max_nesting_depth = std::numeric_limits<int>::max()) const {
int max_nesting_depth = default_max_nesting_depth) const {
std::vector<size_t> results;
Status s;
try {
Expand Down

0 comments on commit 6108d61

Please sign in to comment.