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

Make the result of SRANDMEMBER random #2032

Merged
merged 4 commits into from
Jan 23, 2024
Merged

Make the result of SRANDMEMBER random #2032

merged 4 commits into from
Jan 23, 2024

Conversation

wsehjk
Copy link
Contributor

@wsehjk wsehjk commented Jan 20, 2024

This pr is to resolve #2014.
I use Reservoir Sampling. When the number we want to select is larger than that of elements in the set, all elements are selected

src/types/redis_set.cc Outdated Show resolved Hide resolved
@jihuayu
Copy link
Member

jihuayu commented Jan 20, 2024

This pr is to solve #2014.

Hi @wsehjk, you can use resolve #2014 instead of solve #2014. It will make GitHub auto close issue when PR has been merged.

https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

@PragmaTwice PragmaTwice changed the title rand SRANDMEMBER Make the result of SRANDMEMBER random Jan 20, 2024
@PragmaTwice
Copy link
Member

Please use ./x.py format to format your code, otherwise the CI cannot pass.

src/types/redis_set.cc Outdated Show resolved Hide resolved
src/types/redis_set.cc Outdated Show resolved Hide resolved
@mapleFU
Copy link
Member

mapleFU commented Jan 20, 2024

Though a different sampling algorithm is used, general LGTM

src/common/status.h Outdated Show resolved Hide resolved
@jihuayu
Copy link
Member

jihuayu commented Jan 21, 2024

You can enable the GitHub action in your repo (It is free). So that you can find the CI failing issues earlier and more easily.

https://github.com/wsehjk/kvrocks/actions

@jihuayu
Copy link
Member

jihuayu commented Jan 21, 2024

It seems like the test run fails. Fix it, victory is within sight.

By the way, you don't need to use force push to make PR only one commit; simply use the Update branch Button is ok
image

@wsehjk
Copy link
Contributor Author

wsehjk commented Jan 22, 2024

It seems like the test run fails. Fix it, victory is within sight.

By the way, you don't need to use force push to make PR only one commit; simply use the Update branch Button is ok image

This is because the maintainer of last repo i have contributed required pr to be one commit, i think it still makes sense here.
Everytime dev branch lags behind the unstable branch, I rungit pull and git rebase unstable dev to catch up, then I have to use force-push....

Copy link
Member

@mapleFU mapleFU left a comment

Choose a reason for hiding this comment

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

LGTM

@git-hulk git-hulk merged commit 667c145 into apache:unstable Jan 23, 2024
29 of 30 checks passed
@wsehjk wsehjk deleted the dev branch January 30, 2024 15:37
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.

Improve the implementation of SRANDMEMBER
5 participants