You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logging::log_warning(format!("{}: Cannot load bloomfltr data type of version {} because it is higher than the loaded module's bloomfltr supported version {}",MODULE_NAME, encver,BLOOM_FILTER_TYPE_ENCODING_VERSION).as_str());
logging::log_warning(format!("{}: Cannot load bloomfltr data type of version {} because it is higher than the loaded module's bloomfltr supported version {}",MODULE_NAME, encver,BLOOM_TYPE_ENCODING_VERSION).as_str());
60
61
returnNone;
61
62
}
62
63
letOk(num_filters) = raw::load_unsigned(rdb)else{
@@ -79,7 +80,8 @@ impl ValkeyDataType for BloomFilterType {
79
80
// We start off with capacity as 1 to match the same expansion of the vector that would have occurred during bloom
80
81
// object creation and scaling as a result of BF.* operations.
81
82
letmut filters = Vec::with_capacity(1);
82
-
83
+
// Calculate the memory usage of the BloomFilter/s by summing up BloomFilter sizes as they are de-serialized.
84
+
letmut filters_memory_usage = 0;
83
85
for i in0..num_filters {
84
86
letOk(bitmap) = raw::load_string_buffer(rdb)else{
85
87
returnNone;
@@ -97,10 +99,17 @@ impl ValkeyDataType for BloomFilterType {
97
99
returnNone;
98
100
}
99
101
};
100
-
if !BloomFilter::validate_size(capacity asi64, new_fp_rate){
101
-
logging::log_warning("Failed to restore bloom object: Contains a filter larger than the max allowed size limit.");
102
+
let curr_filter_size = BloomFilter::compute_size(capacity asi64, new_fp_rate);
103
+
let curr_object_size = BloomObject::compute_size(filters.capacity())
104
+
+ filters_memory_usage
105
+
+ curr_filter_size;
106
+
if !BloomObject::validate_size(curr_object_size){
107
+
logging::log_warning(
108
+
"Failed to restore bloom object: Object larger than the allowed memory limit.",
109
+
);
102
110
returnNone;
103
111
}
112
+
filters_memory_usage += curr_filter_size;
104
113
// Only load num_items when it's the last filter
105
114
let num_items = if i == num_filters - 1{
106
115
match raw::load_unsigned(rdb){
@@ -118,7 +127,7 @@ impl ValkeyDataType for BloomFilterType {
0 commit comments