educative.io

How is the bloom filter persisted? and what happens when it's full?

Is bloom filter persisted to a DB or a log file? What happen when server crashes? Does it try to restore the filter? Given the simplicity, it should be easy to do so IMO but not sure how it’s done in practice.
Also, when the filter is filled with 1, is there any strategy to rehash/expand it?

Thanks,

Bloom filters can be persisted to DB or a file. For example, Cassandra maintains a Bloom filter for each SSTable and stores each bloom filter in a file along with SSTable. See details: https://www.educative.io/courses/grokking-adv-system-design-intvw/g7lXQpRwlzr#bloom-filters

I see. But is it going to repopulate or expand once it’s already filled with 1s?
Thanks,

Bloom filter can’t expand. We can allocate a new bloom filter and recalculate everything. Therefore choosing the size is quite important and you should have good understanding of the data. If a Bloom filters is all filled with 1s, there will be more false positives and the performance will degrade.