Skip to content
Snippets Groups Projects
Commit a453cf42 authored by Sami Hiltunen's avatar Sami Hiltunen
Browse files

Synchronize transaction beginning with log application

Begin is called to start a new transaction. Transaction should see
all data that was committed prior to the transaction beginning. As
it is currently, Begin has no synchronization with the log entry
application. It's possible that a transaction begins before all
committed data has been applied to the repository and thus available
for the transaction to read. This commit addresses the problem by
waiting for committed data to be applied before the transaction can
begin.

When Begin is called, it determines the transaction's read index. The
read index is a log index at which the data is to be read at. When a
transaction begins, we thus have to ensure all of the data logged prior
to the transaction starting has been applied to the repository. This
is achieved by the TransactionManager maintaining notification channels
which it broadcasts log entry application to all waiters. These channels
are listened on in Begin, and used to block the transaction from
beginning prior to the committed data being applied. This guarantees
the transaction will read all data committed prior to its start.

As the Begin now waits for all data to be available, we no longer have
to wait for a log entry to be applied prior to releasing a Commit call.
The writer will is guaranteed to see the data it wrote when it begins a
new transaction. Tests are updated to reflect this.
parent ee71e76a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment