Skip to content

Package review PR #1

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

Closed
wants to merge 90 commits into from
Closed

Package review PR #1

wants to merge 90 commits into from

Conversation

KarthikSubbarao
Copy link
Member

@KarthikSubbarao KarthikSubbarao commented Apr 29, 2024

This is a PR which merges current changes in unstable into an empty branch in order to help with a review code of the entire codebase.

@KarthikSubbarao KarthikSubbarao force-pushed the unstable branch 3 times, most recently from 61aa1fb to 0e4d4d1 Compare April 30, 2024 18:14
@KarthikSubbarao KarthikSubbarao changed the title Package review Package review PR May 1, 2024
@KarthikSubbarao KarthikSubbarao self-assigned this May 1, 2024
Comment on lines 276 to 296
let mut result = Vec::new();
match value {
Some(bf) => {
for item in input_args.iter().take(argc).skip(idx) {
result.push(RedisValue::Integer(bf.add_item(item.as_slice())));
}
Ok(RedisValue::Array(result))
}
None => {
if nocreate {
return Err(RedisError::Str("ERR not found"));
}
let mut bf = BloomFilterType::new_reserved(fp_rate, capacity, expansion);
for item in input_args.iter().take(argc).skip(idx) {
result.push(RedisValue::Integer(bf.add_item(item.as_slice())));
}
match filter_key.set_value(&BLOOM_FILTER_TYPE, bf) {
Ok(_) => Ok(RedisValue::Array(result)),
Err(_) => Err(RedisError::Str(ERROR)),
}
}
Copy link

Choose a reason for hiding this comment

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

Could we check the bloom filter exists or not first and then insert the data in a single flow. Don't like the code duplication around insertion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can create a separate function for multi adds and call it from both flows. I wanted to handle both through the same flow, however it will be out of reference scope and result in a moved error

pub struct BloomFilterType {
pub expansion: u32,
pub fp_rate: f32,
pub filters: Vec<BloomFilter>,
Copy link

Choose a reason for hiding this comment

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

Does the underlying support scalable bloom filters or do we need to support this mechanism?

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 particular library does not have auto scaling

https://docs.rs/bloomfilter/1.0.13/bloomfilter/struct.Bloom.html

Comment on lines 74 to 79
let new_capacity = filter.capacity * self.expansion;
let mut new_filter = BloomFilter::new(self.fp_rate, new_capacity);
// Add item.
new_filter.bloom.set(item);
new_filter.num_items += 1;
self.filters.push(new_filter);
Copy link

Choose a reason for hiding this comment

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

Shouldn't we fail the request if the expansion is much higher than we can support?

Copy link
Member Author

Choose a reason for hiding this comment

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

expansion really means expansion_rate. I can rename this variable if that would help clarify this.

I don't think there is a limit on the number of sub filters an object can have. But (if we want) we can define a config for this to either silently fail expansion (by allowing a set) beyond a limit of X sub filters per object OR explicitly return an error (without a set).

Copy link
Member Author

Choose a reason for hiding this comment

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

One other aspect we should handle this checking / rejecting based on memory overhead of every operation that creates a new BloomFilter object (BF.ADD, BF.MADD, BD.RESERVE, BF.INSERT, RDB Load). Before any of these operations, we should probably check the memory usage and reject the operations if there is not sufficient space. We have a mechanism to compute the estimated additional memory overhead per creation.

KarthikSubbarao pushed a commit that referenced this pull request Aug 23, 2024
Signed-off-by: Viktor Söderqvist <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
… objects. Update RDB load/save

Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
Signed-off-by: Karthik Subbarao <[email protected]>
KarthikSubbarao and others added 7 commits January 11, 2025 20:01
Signed-off-by: KarthikSubbarao <[email protected]>
…om filter can reach the desired size (#41)

* Adding optional arg to BF.INSERT to allow users to check if their bloom filter can reach the desired size

Signed-off-by: zackcam <[email protected]>

* Fixing ATLEASTCAPACITY calculation as well as adding MAXCAPACITY functionality for info

Signed-off-by: zackcam <[email protected]>

---------

Signed-off-by: zackcam <[email protected]>
…ity caluclation matches actual capacity (#43)

Signed-off-by: zackcam <[email protected]>
…44)

file as it can be taken from a dependency and moving metric increments
to after creates

Signed-off-by: zackcam <[email protected]>
YueTang-Vanessa and others added 8 commits March 10, 2025 10:11
… as (#49)

adding asan capability to ./build.sh. Updating version of valkey-module
as well so memory leak no longer occurs

Signed-off-by: zackcam <[email protected]>
compatible with non scaling filters as well

Signed-off-by: zackcam <[email protected]>
…t platforms + Define default/unstable version, stage + add placeholder release notes (#52)

Signed-off-by: KarthikSubbarao <[email protected]>
* Cleaning up Valkey_test_case. Removing ValkeyInfo and ValkeyClient. Making waits consistent. Adding cleanup for AOF folder/files

Signed-off-by: zackcam <[email protected]>

* Adding functionality for integration tests to work for pytest 6 and 7

Signed-off-by: zackcam <[email protected]>

* Decoupling server start from valkey_test_case.py and instead setting it for valkey_bloom_test_case.py

Signed-off-by: zackcam <[email protected]>

* Removing unneccesary args in startup and duplicate function

Signed-off-by: zackcam <[email protected]>

---------

Signed-off-by: zackcam <[email protected]>
@KarthikSubbarao KarthikSubbarao force-pushed the unstable branch 2 times, most recently from 391d947 to 5d514e0 Compare March 28, 2025 18:55
zackcam and others added 3 commits March 28, 2025 20:33
…github and removing it locally (#56)

Signed-off-by: zackcam <[email protected]>
* Adding bloom command json files. These files contain base information about bloom comamnds which will be used by the valkey website

Signed-off-by: zackcam <[email protected]>

* Update summaries for bloom commands to be more descriptive

Taking feedback and applying suggested changes to the summaries of bloom commands

Co-authored-by: KarthikSubbarao <[email protected]>
Signed-off-by: zackcam <[email protected]>

* Apply suggestions from code review

Signed-off-by: KarthikSubbarao <[email protected]>

* Update .gitignore

Signed-off-by: KarthikSubbarao <[email protected]>

---------

Signed-off-by: zackcam <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
Co-authored-by: KarthikSubbarao <[email protected]>
* Cleaning up usage of valkey-test-framework, small updates to build scripts, and cmd handler

Signed-off-by: Karthik Subbarao <[email protected]>

* Update tests

Signed-off-by: Karthik Subbarao <[email protected]>

---------

Signed-off-by: Karthik Subbarao <[email protected]>
… so exit does not need to be called (#58)

Signed-off-by: zackcam <[email protected]>
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.

7 participants