You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "jihuayu (via GitHub)" <gi...@apache.org> on 2023/12/25 07:04:20 UTC

[I] Using `GET` to get json type key will not return error. [kvrocks]

jihuayu opened a new issue, #1969:
URL: https://github.com/apache/kvrocks/issues/1969

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
   
   
   ### Version
   
   unstable 
   
   ### Minimal reproduce step
   
   Using `GET` to get json type key will not return error.
   I writed below test case.
   
   ```go
   t.Run("GET JSON type key", func(t *testing.T) {
   	require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", ` {"x":1,"y":2} `).Err())
   	require.EqualValues(t, "\x00{\"x\":1,\"y\":2}", rdb.Get(ctx, "a").Val())
   })
   ```
   
   ### What did you expect to see?
   
   test failed
   
   ### What did you see instead?
   
   test Passed
   
   ### Anything Else?
   
   Maybe is this line problem.https://github.com/apache/kvrocks/blob/unstable/src/types/redis_string.cc#L86
   ```C++
   if (metadata.Type() != kRedisString && metadata.size > 0) {
       return rocksdb::Status::InvalidArgument(kErrMsgWrongType);
     }
   ```
   Why do we need to check `metadata.size > 0`?
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Using `GET` to get json type key will not return error. [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu closed issue #1969: Using `GET` to get json type key will not return error.
URL: https://github.com/apache/kvrocks/issues/1969


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Using `GET` to get json type key will not return error. [kvrocks]

Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on issue #1969:
URL: https://github.com/apache/kvrocks/issues/1969#issuecomment-1868829978

   @jihuayu Good catch!
   
   > Why do we need to check metadata.size > 0?
   
   For example, we need to regard it as a non-existing key if all subkeys are deleted in a list(same as the hash/set/zset). But some types allows the empty subkey list like stream/bloomfilter. Can refer: [subkey](https://github.com/apache/kvrocks/blob/unstable/src/storage/redis_db.cc#L62)
   
   The better way is to use `GetMetadata` to replace the decode function in `redis_string`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Using `GET` to get json type key will not return error. [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on issue #1969:
URL: https://github.com/apache/kvrocks/issues/1969#issuecomment-1873663052

   Fixed after https://github.com/apache/kvrocks/pull/1971


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org