-
Notifications
You must be signed in to change notification settings - Fork 466
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
Extract a rand sample helper and support negative sample count in "Set" #2113
Extract a rand sample helper and support negative sample count in "Set" #2113
Conversation
f07c2ea
to
9a3e127
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I just wondering whether @PragmaTwice will advise to rename sample_helper.h
to something with _util.h
suffix like random_util/random_sample_util/sample_util
:)
dd87b99
to
6c22327
Compare
batch->Put(metadata_cf_handle_, ns_key, bytes); | ||
// Avoid to write an empty op-log if just random select some members. | ||
if (!pop) return rocksdb::Status::OK(); | ||
// Avoid to write an empty op-log if the set is empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know whether we can do this optimization, would it affect replication?
if (!s.ok()) { | ||
return s; | ||
} | ||
switch (type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a dcheck. Previously, code called with append_field_with_index
. However, GetAll
is already called with "type", so it's not neccessary to clean up or set it again
Quality Gate failedFailed conditions |
I am fine since this file is not in common dir. |
This patch: