Skip to content

[MOD-5769] Open RedisJSON key with flags #1095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 22, 2023
Merged

Conversation

DvirDukhan
Copy link
Collaborator

@DvirDukhan DvirDukhan commented Sep 21, 2023

This PR adds LLAPI functionality for opening a RedisJSON key with flags
this is mainly to be used in the RediSearch getKeyCommonJSON where NO_EFFECTS flag should be send, to abvoid key expiration (write path) while quering (read path).

@CLAassistant
Copy link

CLAassistant commented Sep 21, 2023

CLA assistant check
All committers have signed the CLA.

@DvirDukhan DvirDukhan changed the title wip Open RedisJSON key with flags Sep 21, 2023
@DvirDukhan DvirDukhan marked this pull request as ready for review September 21, 2023 20:14
@DvirDukhan DvirDukhan changed the title Open RedisJSON key with flags [MOD-5632] Open RedisJSON key with flags Sep 21, 2023
@DvirDukhan DvirDukhan changed the title [MOD-5632] Open RedisJSON key with flags [MOD-5769] Open RedisJSON key with flags Sep 21, 2023
@DvirDukhan DvirDukhan requested a review from oshadmi September 21, 2023 20:17
@DvirDukhan
Copy link
Collaborator Author

@oshadmi do we need a new LLAPI version here?

@@ -81,7 +81,7 @@ commands:
parameters:
redis_version:
type: string
default: "7"
default: "7.2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 7 mean latest 7.x, so when there is 7.4, for example, it would get it.
If we specifically change it to be 7.2, it would not get 7.4, or greater, unless we commit a change.

@@ -37,6 +37,7 @@ typedef struct RedisJSONAPI {
/* RedisJSON functions */
RedisJSON (*openKey)(RedisModuleCtx *ctx, RedisModuleString *key_name);
RedisJSON (*openKeyFromStr)(RedisModuleCtx *ctx, const char *path);
RedisJSON (*openKey_withFlags)(RedisModuleCtx *ctx, RedisModuleString *key_name, int flags);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to increment API version

@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Attention: 36 lines in your changes are missing coverage. Please review.

Comparison is base (ecede3c) 79.18% compared to head (01c679f) 78.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1095      +/-   ##
==========================================
- Coverage   79.18%   78.38%   -0.80%     
==========================================
  Files          15       15              
  Lines        3853     3873      +20     
==========================================
- Hits         3051     3036      -15     
- Misses        802      837      +35     
Files Coverage Δ
redis_json/src/manager.rs 50.00% <ø> (ø)
redis_json/src/lib.rs 88.57% <0.00%> (ø)
redis_json/src/ivalue_manager.rs 90.58% <0.00%> (-1.67%) ⬇️
redis_json/src/c_api.rs 3.80% <25.71%> (-4.03%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oshadmi oshadmi merged commit 1823d74 into master Oct 22, 2023
@oshadmi oshadmi deleted the dvirdu_open_key_with_flag branch October 22, 2023 19:14
@@ -25,9 +25,11 @@ ijson.workspace = true
serde_json.workspace = true
serde.workspace = true
libc = "0.2"
redis-module = "2.0"
redis-module ={ version = "^2.0.7", default-features = false, features = ["min-redis-compatibility-version-7-2"] }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to work on version less than 7.2?

Copy link
Collaborator

@oshadmi oshadmi Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think not.
We need to update ramp to "7.2"

min_redis_version: "7.1"

@adrianoamaral

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should consider attainment with the min grouped feature set. So, should follow 7, in this case, and be back-ported also for the preview version, but it won't be JSON 2.6, but 2.4

static REDISJSON_GETAPI_V3: &str = concat!("RedisJSON_V3", "\0");
static REDISJSON_GETAPI_V4: &str = concat!("RedisJSON_V4", "\0");
// The apiname argument of export_shared_api should be a string literal with static lifetime
static mut VEC_EXPORT_SHARED_API_NAME : Vec<CString> = Vec::new();
Copy link

@MeirShpilraien MeirShpilraien Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make it a static slice:

static VEC_EXPORT_SHARED_API_NAME: &'static str = &["RedisJSON_V1", ...];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why does it need to be static lifetime?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/redis/redis/blob/unstable/src/module.c#L10498-L10500

IMPORTANT: the apiname argument should be a string literal with static
lifetime. The API relies on the fact that it will always be valid in
the future.
int RM_ExportSharedAPI(RedisModuleCtx *ctx, const char *apiname, void *func) {

Copy link

@MeirShpilraien MeirShpilraien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy