Plasma GitLab Archive
Projects Blog Knowledge

Module Nn_commit


module Nn_commit: sig .. end
Two-phase commit protocol

val commit_e : (bool -> unit) ->
Nn_db.modification Queue.t ->
Nn_state.shared_state_t -> bool Uq_engines.engine
commit_e post_commit journal shared_state:

Writes the modifications to the local database and all slaves, and commits the update. The bool arg says whether the commit was successful. If false, the transaction is guaranteed to be rolled back. The commit engine may also enter an error state. This is considered as a critical violation of the protocol.

If the queue of modification is empty, the local transaction is committed, and no remote operations are involved. (This means that the user only submitted read requests and no writes.)

If there are modifications, a new revision string is created and appended to the journal before anything is written.

Commits are serialized (using finish_transaction_serialized).

As side effects, the function may disable slaves, and even (self-)disable the coordinator.

The function also invokes post_commit when the commit or rollback is done. The bool arg is the same as in the result.

val trans_e : Nn_state.shared_state_t ->
Nn_state.view_t list ->
'a Uq_engines.engine -> 'a Uq_engines.final_state Uq_engines.engine
let e' = trans_e sh vl e: Runs the engine e until it is finished, and if e was successful, the modifications of the views vl are taken as the modifications to be done in the transaction, and the transaction is committed.

If e is not successful, the views and the db transaction are rolled back.

The returned engine e' is `Done(st) when the transaction is over (after commit or rollback). st reflects the final state of e.

e' reaches an error state only if the commit fails (critical error).

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml