Skip to content
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

feat: Catch up ZRANGE options #1428

Merged
merged 14 commits into from
May 7, 2023
Merged

feat: Catch up ZRANGE options #1428

merged 14 commits into from
May 7, 2023

Conversation

tisonkun
Copy link
Member

@tisonkun tisonkun commented May 7, 2023

This closes #1117.

I'll add tests later.

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun requested a review from PragmaTwice May 7, 2023 04:50
@tisonkun tisonkun changed the title Zrange feat: Catch up ZRANGE options May 7, 2023
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
bool with_scores_ = false;
};
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (range_type_ == kZRangeAuto || range_type_ == kZRangeRank) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This staff can be later refactor to dedup. But I keep it as is so that we don't introduce too much unstable in one PR

Copy link
Contributor

@torwig torwig left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -557,7 +558,7 @@ rocksdb::Status ZSet::Remove(const Slice &user_key, const std::vector<Slice> &me
return storage_->Write(storage_->DefaultWriteOptions(), batch->GetWriteBatch());
}

rocksdb::Status ZSet::RemoveRangeByScore(const Slice &user_key, ZRangeSpec spec, int *ret) {
rocksdb::Status ZSet::RemoveRangeByScore(const Slice &user_key, CommonRangeScoreSpec &spec, int *ret) {
Copy link
Member

Choose a reason for hiding this comment

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

rocksdb::Status ZSet::RemoveRangeByScore(const Slice &user_key, const CommonRangeScoreSpec &spec, int *ret) {

?

Copy link
Member Author

@tisonkun tisonkun May 7, 2023

Choose a reason for hiding this comment

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

Good to have. Perhaps we focus on the functionality in this PR, and unless the style is regression or quite unacceptable, I can gather them to do in a follow-up.

Copy link
Member Author

Choose a reason for hiding this comment

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

After a closer look, it writes:

spec.removed = true;

so that we cannot use const here. But it comes to me a smell we can investigate further later.

Copy link
Member

Choose a reason for hiding this comment

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

i guess we can just pass-by-value. I guess copying it is lightweight :)

@tisonkun
Copy link
Member Author

tisonkun commented May 7, 2023

All existing tests passed without change. Merging as no regression...

I'm preparing a follow-up to clean up code a bit.

@tisonkun tisonkun merged commit a66ad9a into apache:unstable May 7, 2023
@tisonkun tisonkun deleted the zrange branch May 7, 2023 08:23
@tisonkun tisonkun mentioned this pull request May 7, 2023
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.

Support more ZRANGE options
3 participants