Add a new invariant to reserved space.v1.4.5
commit4d56a660e33adf3234994e48795a9555521c95f1
authorKeith Rarick <kr@xph.us>
Mon, 10 May 2010 21:31:47 +0000 (10 14:31 -0700)
committerKeith Rarick <kr@xph.us>
Mon, 10 May 2010 21:31:47 +0000 (10 14:31 -0700)
tree96ac05d99cbbe4287450793ef5d63341745cdc15
parent50e0ca22048e70266da01807b8322011038136c7
Add a new invariant to reserved space.

A DELETE record can be written at any time, including times when we are
unable to shuffle reserved bytes around. So, to make sure that we don't
lose any reserved bytes, the current binlog must always have reserved
space for some number of complete DELETE records. This lets us fill up
the current binlog exactly with no lost reserved bytes. The only time we
are able to shuffle things around to maintain this property is when
reserving bytes.

We used to try to accomplish this by checking the reserved size of the
current_binlog after each reservation, but that isn't sufficient. The
next binlog can become current and run out of space without any
reservations taking place. This would force us to lose bytes.

Now we check that the current_binlog and *all future binlog* reservation
sizes are suitable to become the current binlog and fill up exactly.

Closes gh-38.
binlog.c
sh-tests/binlog-allocation.sh [new file with mode: 0755]