chore: get rid of kv_args and replace it with slices to full_args (#3101)

* Revert "Revert "chore: get rid of kv_args and replace it with slices to full_… (#3024)"

This reverts commit 25e6930ac3.

Fixing the performance bug caused by applying equality operator
on two spans inside ShardArgs::Iterator::operator==

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-06-05 14:25:26 +03:00 committed by GitHub
parent 1fb250b64f
commit 9f09104c61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 233 additions and 185 deletions

View file

@ -1543,12 +1543,14 @@ void JsonFamily::MGet(CmdArgList args, ConnectionContext* cntx) {
continue;
vector<OptString>& res = mget_resp[sid];
for (size_t j = 0; j < res.size(); ++j) {
if (!res[j])
ShardArgs shard_args = transaction->GetShardArgs(sid);
unsigned src_index = 0;
for (auto it = shard_args.begin(); it != shard_args.end(); ++it, ++src_index) {
if (!res[src_index])
continue;
uint32_t indx = transaction->ReverseArgIndex(sid, j);
results[indx] = std::move(res[j]);
uint32_t dst_indx = it.index();
results[dst_indx] = std::move(res[src_index]);
}
}
@ -2091,8 +2093,7 @@ void JsonFamily::Register(CommandRegistry* registry) {
constexpr size_t kMsetFlags = CO::WRITE | CO::DENYOOM | CO::FAST | CO::INTERLEAVED_KEYS;
registry->StartFamily();
*registry << CI{"JSON.GET", CO::READONLY | CO::FAST, -2, 1, 1, acl::JSON}.HFUNC(Get);
*registry << CI{"JSON.MGET", CO::READONLY | CO::FAST | CO::REVERSE_MAPPING, -3, 1, -2, acl::JSON}
.HFUNC(MGet);
*registry << CI{"JSON.MGET", CO::READONLY | CO::FAST, -3, 1, -2, acl::JSON}.HFUNC(MGet);
*registry << CI{"JSON.TYPE", CO::READONLY | CO::FAST, 3, 1, 1, acl::JSON}.HFUNC(Type);
*registry << CI{"JSON.STRLEN", CO::READONLY | CO::FAST, 3, 1, 1, acl::JSON}.HFUNC(StrLen);
*registry << CI{"JSON.OBJLEN", CO::READONLY | CO::FAST, 3, 1, 1, acl::JSON}.HFUNC(ObjLen);