Fix event plugin possible transaction reuse bug
With the previous design, it was possible for a proposal for an old
transaction to be replayed after the transaction had been completed and
deleted by another actor. This can result an outdated sequence number
from being reused and losing an old event. Previously proposals were
renamed to update/<uuid>/ which could happen at the wrong time after the
<uuid> dir was deleted. Fix this by introducing the 'next' directory. In
the new design, all actors must rename their next proposals to
<uuid>/next. This prevents outdated proposals for old transactions from
being used after the <uuid> dir is deleted.
Testing FsStoreTest with -j 100 and a count of 1000 shows that the
previous design would result in many reused ids, around 150 out of 100K
events. With the same settings, there were no errors with the new
Testing also show this to be compatible with the previous design. While
the previous and new designs cannot complete each other's transactions,
they do not interfere with each other. This should make a multi master
transition while both the old and new designs are running acceptable.
The new design is slower in the single threaded case due to the extra
directory being created and deleted. The new design appears to be faster
50% faster with 100 threads, possibly due to the bug fix preventing more
collisions, although it is hard to make an apples to apples comparison
due to the buggy nature of the previous design.
3 files changed