@@ -670,6 +670,33 @@ TEST_F(RdbTest, SBF) {
670670 EXPECT_THAT (Run ({" BF.EXISTS" , " k" , " 1" }), IntArg (1 ));
671671}
672672
673+ TEST_F (RdbTest, SBFLargeFilterChunking) {
674+ max_memory_limit = 200000000 ;
675+
676+ // Using this set of parameters for the BF.RESERVE command resulted in a
677+ // filter size large enough to require chunking (> 64 MB).
678+ const double error_rate = 0.001 ;
679+ const size_t capacity = 50'000'000 ;
680+ const size_t num_items = 100 ;
681+
682+ size_t collisions = 0 ;
683+
684+ Run ({" BF.RESERVE" , " large_key" , std::to_string (error_rate), std::to_string (capacity)});
685+ for (size_t i = 0 ; i < num_items; i++) {
686+ auto res = Run ({" BF.ADD" , " large_key" , absl::StrCat (" item" , i)});
687+ if (*res.GetInt () == 0 )
688+ collisions++;
689+ }
690+ EXPECT_LT (static_cast <double >(collisions) / num_items, error_rate);
691+
692+ Run ({" debug" , " reload" });
693+ EXPECT_EQ (Run ({" type" , " large_key" }), " MBbloom--" );
694+
695+ for (size_t i = 0 ; i < num_items; i++) {
696+ EXPECT_THAT (Run ({" BF.EXISTS" , " large_key" , absl::StrCat (" item" , i)}), IntArg (1 ));
697+ }
698+ }
699+
673700TEST_F (RdbTest, RestoreSearchIndexNameStartingWithColon) {
674701 // Create an index with a name that starts with ':' and add a sample document
675702 EXPECT_EQ (Run ({" FT.CREATE" , " :Order:index" , " ON" , " HASH" , " PREFIX" , " 1" , " :Order:" , " SCHEMA" ,
0 commit comments