Skip to content

Conversation

@MeirShpilraien
Copy link

The PR adds support for active defrag on RedisJSON. A pre condition for this PR is that the following PR's will be megred:

The PR register defrag function on the json datatype and uses the new capability of ISON to defrag the key.

Notice:

  • Increamental defrag of the json key is not support. In order to support it we need to implement the free_effort callback. This is not trivial and even if it was it would have cause the json object to potentially be freed when the GIL is not hold, which violate the assumption of our shared string implementation (it is not thread safe). We leave it for future improvment.

  • If we run on a Redis version that do not support the defrag start callback, we can still partially support defrag. In that case the IJSON object will be defraged but the shared strings dictionatrywill not be reinitialize. This basically means that shared strings will not be defraged.

Tests were added to cover the new functionality.

(cherry picked from commit 6539e1e)

The PR adds support for active defrag on RedisJSON. A pre condition for this PR is that the following PR's will be megred:

* [Redis defrad module API extentions](redis/redis#13509)
* [redismodule-rs support for active defrag API](RedisLabsModules/redismodule-rs#387)
* [IJSON support for defrag](RedisJSON/ijson#1)

The PR register defrag function on the json datatype and uses the new capability of ISON to defrag the key.

**Notice**:

* Increamental defrag of the json key is **not** support. In order to support it we need to implement the free_effort callback. This is not trivial and even if it was it would have cause the json object to potentially be freed when the GIL is not hold, which violate the assumption of our shared string implementation (it is not thread safe). We leave it for future improvment.

* If we run on a Redis version that do not support the defrag start callback, we can still partially support defrag. In that case the IJSON object will be defraged but the shared strings dictionatrywill not be reinitialize. This basically means that shared strings will not be defraged.

Tests were added to cover the new functionality.

(cherry picked from commit 6539e1e)
@codecov
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 74.24242% with 17 lines in your changes missing coverage. Please review.

Project coverage is 78.38%. Comparing base (d5dd1c1) to head (5361ce7).
Report is 1 commits behind head on 2.8.

Files with missing lines Patch % Lines
redis_json/src/defrag.rs 73.84% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              2.8    #1269      +/-   ##
==========================================
- Coverage   78.45%   78.38%   -0.07%     
==========================================
  Files          14       15       +1     
  Lines        3941     4007      +66     
==========================================
+ Hits         3092     3141      +49     
- Misses        849      866      +17     

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

@MeirShpilraien MeirShpilraien merged commit 17077cd into 2.8 Sep 16, 2024
@MeirShpilraien MeirShpilraien deleted the meir-RED-134847-cherrypick-json-defrag-suppor branch September 16, 2024 12:52
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.

3 participants