Skip to content

Support RDB Short Read in RedisJSON (a.k.a diskless-load) - #397

Merged
oshadmi merged 29 commits into
masterfrom
omer-short-read
Aug 22, 2021
Merged

oshadmi merged 29 commits into
masterfrom
omer-short-read

Conversation

@oshadmi

@oshadmi oshadmi commented Jun 18, 2021

Copy link
Copy Markdown
Collaborator

No description provided.

@rafie rafie changed the title Support RDB Short Read in RedisJSON (a.k.a diskless-load) [WIP] Support RDB Short Read in RedisJSON (a.k.a diskless-load) Jun 21, 2021
@rafie
rafie marked this pull request as draft June 21, 2021 08:30
@oshadmi oshadmi changed the title [WIP] Support RDB Short Read in RedisJSON (a.k.a diskless-load) Support RDB Short Read in RedisJSON (a.k.a diskless-load) Jul 28, 2021
@oshadmi
oshadmi requested a review from gkorland July 28, 2021 08:20
Comment thread src/redisjson.rs Resolved
Comment thread src/backward.rs Resolved
Comment thread src/backward.rs Resolved
Comment thread src/backward.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread src/redisjson.rs Resolved
Comment thread src/redisjson.rs Resolved
@oshadmi
oshadmi requested review from MeirShpilraien and removed request for MeirShpilraien August 6, 2021 16:21
Comment thread Cargo.toml Outdated
redis-module = { version="0.22", features = ["experimental-api"]}
jsonpath_lib = { git = "https://github.com/RedisJSON/jsonpath.git", branch = "generic_json_path" }
#redis-module = { version="0.22", features = ["experimental-api"]}
redis-module = { git = "https://github.com/RedisLabsModules/redismodule-rs.git", branch = "omer-short-read", features = ["experimental-api"] }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Make sure to change that before merge ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sure, we need to bump redis-module version and use the new one here.

Comment thread src/lib.rs Resolved

@MeirShpilraien MeirShpilraien left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some small comments, we also need tests (as we have on search).

gavrie
gavrie previously requested changes Aug 12, 2021
Comment thread src/backward.rs Resolved
Comment thread system-setup.py
Comment on lines 50 to +52
self.pip_install("toml")
self.pip_install("awscli")
self.pip_install("gevent")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be cleaner to list the deps inside requirements.txt instead of hardcoding. You could add another separate requirements.txt file in addition to the one from the tests.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this is out of the scope of this PR, which is using the existing setup/install "machinery" and I believe changes should be aligned in other repositories as well.
In addition, it should also support none-pip-based packages, so the requirements.txt would be only part of the setup and therefore seems a bit misleading to me, and pip-install commands are interleaved with other commands and logic, so it might need more than a single requirements file.

WDYT - Should we have issues for moving Python packages to requirements.txt file(s)?

Comment thread tests/pytest/common.py Resolved
Comment thread tests/pytest/test_short_read.py Resolved
Comment thread tests/pytest/test_short_read.py Outdated
return self.decoder(self.sockf.readline())

def send_bulk_header(self, data_len):
self.sockf.write(self.encoder('$%d\r\n' % data_len))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As a rule, byte strings in Python (as well as in Rust...) should have the b'...' prefix. Plain strings are considered Unicode in Python 3, which is not what you want.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In this specific method, the string interpolation (format) is used to easily construct the control string for a RESP Bulk String $<LEN>\r\n, then encode the string as bytes.
There's no mix of control string of type str with raw data of type bytes.
Seems OK to me.
I also removed unused methods, including send_bulk_header.

In other methods, such as send_bulk, which may mix str and bytes, I've committed some improvement for the formatting, using the binary % (modulo) operator to construct the bytes

Comment thread src/lib.rs Resolved
Comment thread tests/pytest/test_short_read.py Resolved
Comment thread tests/pytest/test_short_read.py Resolved
Comment thread src/redisjson.rs Resolved

@MeirShpilraien MeirShpilraien left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Look good, some comments

Use Context api set_module_options
Use and log the random seed

@oshadmi oshadmi left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

👍🏼 Thanks for the review!

Comment thread tests/pytest/test_short_read.py Resolved
@oshadmi
oshadmi requested a review from MeirShpilraien August 18, 2021 19:29
MeirShpilraien
MeirShpilraien previously approved these changes Aug 22, 2021
Comment thread Cargo.toml
jsonpath_lib = { git = "https://github.com/RedisJSON/jsonpath.git", branch = "generic_json_path" }
#redis-module = { version="0.22", features = ["experimental-api"]}
redis-module = { git = "https://github.com/RedisLabsModules/redismodule-rs.git", branch = "omer-short-read", features = ["experimental-api"] }
redis-module = { version="0.23", features = ["experimental-api"]}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We need to also bump it on hdt...

@oshadmi
oshadmi marked this pull request as ready for review August 22, 2021 15:47
@oshadmi
oshadmi dismissed gavrie’s stale review August 22, 2021 15:50

Suggested fix should be done in a separate PR (to list deps in requirements.txt)

@oshadmi
oshadmi merged commit 3d51c06 into master Aug 22, 2021
@oshadmi
oshadmi deleted the omer-short-read branch August 22, 2021 15:51
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.

5 participants