rabbitmq / ra

A Raft implementation for Erlang and Elixir that strives to be efficient and make it easier to use multiple Raft clusters in a single system.
Other
813 stars 96 forks source link

Make ra_log_reader:compact_seg_refs O(1) #351

Closed mkuratczyk closed 1 year ago

mkuratczyk commented 1 year ago

Compacting segment refs was slow on a very long queue (thousands of segments). The test had been modified as the new function doesn't support multiple duplicates, but this should never happen.

For 10k segments, this function completes in 0.000005s instead of almost 2 seconds.