2929#include " server/error.h"
3030#include " server/journal/journal.h"
3131#include " server/search/doc_index.h"
32+ #include " server/sharding.h"
3233#include " server/string_family.h"
3334#include " server/tiered_storage.h"
3435#include " server/transaction.h"
@@ -1738,11 +1739,15 @@ void JsonFamily::Debug(CmdArgList args, const CommandContext& cmd_cntx) {
17381739
17391740 WrappedJsonPath json_path = GET_OR_SEND_UNEXPECTED (ParseJsonPath (path));
17401741
1741- auto cb = [&](Transaction* t, EngineShard* shard) {
1742- return OpMemory (t->GetOpArgs (shard), key, json_path);
1742+ ShardId sid = Shard (key, shard_set->size ());
1743+ auto cb = [&]() {
1744+ EngineShard* shard = EngineShard::tlocal ();
1745+ DbContext db_cntx{cmd_cntx.conn_cntx ->ns , cmd_cntx.conn_cntx ->conn_state .db_index };
1746+ OpArgs op_args{shard, nullptr , db_cntx};
1747+ return OpMemory (op_args, key, json_path);
17431748 };
17441749
1745- auto result = cmd_cntx. tx -> ScheduleSingleHopT ( std::move (cb));
1750+ auto result = shard_set-> Await (sid, std::move (cb));
17461751 auto * rb = static_cast <RedisReplyBuilder*>(builder);
17471752 reply_generic::Send (result, rb);
17481753 return ;
@@ -1755,11 +1760,15 @@ void JsonFamily::Debug(CmdArgList args, const CommandContext& cmd_cntx) {
17551760
17561761 WrappedJsonPath json_path = GET_OR_SEND_UNEXPECTED (ParseJsonPath (path));
17571762
1758- auto cb = [&](Transaction* t, EngineShard* shard) {
1759- return OpFields (t->GetOpArgs (shard), key, json_path);
1763+ ShardId sid = Shard (key, shard_set->size ());
1764+ auto cb = [&]() {
1765+ EngineShard* shard = EngineShard::tlocal ();
1766+ DbContext db_cntx{cmd_cntx.conn_cntx ->ns , cmd_cntx.conn_cntx ->conn_state .db_index };
1767+ OpArgs op_args{shard, nullptr , db_cntx};
1768+ return OpFields (op_args, key, json_path);
17601769 };
17611770
1762- auto result = cmd_cntx. tx -> ScheduleSingleHopT ( std::move (cb));
1771+ auto result = shard_set-> Await (sid, std::move (cb));
17631772 auto * rb = static_cast <RedisReplyBuilder*>(builder);
17641773 reply_generic::Send (result, rb);
17651774 return ;
@@ -2221,8 +2230,7 @@ void JsonFamily::Register(CommandRegistry* registry) {
22212230 *registry << CI{" JSON.ARRAPPEND" , CO::WRITE | CO::DENYOOM | CO::FAST, -4 , 1 , 1 , acl::JSON}.HFUNC (
22222231 ArrAppend);
22232232 *registry << CI{" JSON.ARRINDEX" , CO::READONLY | CO::FAST, -4 , 1 , 1 , acl::JSON}.HFUNC (ArrIndex);
2224- // TODO: Support negative first_key index to revive the debug sub-command
2225- *registry << CI{" JSON.DEBUG" , CO::READONLY | CO::FAST, -3 , 2 , 2 , acl::JSON}.HFUNC (Debug)
2233+ *registry << CI{" JSON.DEBUG" , CO::READONLY | CO::FAST, -2 , 0 , 0 , acl::JSON}.HFUNC (Debug)
22262234 << CI{" JSON.RESP" , CO::READONLY | CO::FAST, -2 , 1 , 1 , acl::JSON}.HFUNC (Resp)
22272235 << CI{" JSON.SET" , CO::WRITE | CO::DENYOOM | CO::FAST, -4 , 1 , 1 , acl::JSON}.HFUNC (Set)
22282236 << CI{" JSON.MSET" , kMsetFlags , -4 , 1 , -1 , acl::JSON}.HFUNC (MSet)
0 commit comments