List:Internals« Previous MessageNext Message »
From:Ann W. Harrison Date:November 9 2009 10:48pm
Subject:Re: how does one know if their storage engine supports replication?
View as plain text  
Zardosht Kasheff wrote:
> 
> What is this two phase commit that the engine must implement? I am
> only aware of a function in the handlerton named commit. Is there any
> documentation for this online?
> 

Sergei has given you a pointer to the specification.  Here's
the Dummy's Guide to 2PC.

There's another function called "prepare".  When prepare is called,
the storage engine puts the transaction into a stable state from
which it can either rollback or commit.  That can be done in a
number of ways, but most systems force the transaction's changes
onto stable storage without allowing them to be seen by other 
transactions(*).  Then the engine calls either commit or rollback
and the engine either makes the changes visible or undoes them.

If there's a crash between prepare and commit, the server asks
the storage engine for the identifiers of transactions that
prepared but did not commit.  The server determines the state
of other related processing at recovery.  If any part failed,
the prepared transactions rollback.

The most commonly described use for a two-phase commit is
coordinating transactions that run on separate databases, but
it is also useful when coordinating a transactional and a non-
transactional operation.  In this case, if MySQL is about to
commit an InnoDB transaction with logging, it first prepares
the transaction, then waits for the binlog operation to succeed,
then commits the transaction.  This avoids the awkward situation
where the master is committed and the log failed to record the
commit.

Best regards,

Ann







Thread
how does one know if their storage engine supports replication?Zardosht Kasheff9 Nov
  • Re: how does one know if their storage engine supports replication?Sergei Golubchik9 Nov
    • Re: how does one know if their storage engine supports replication?Mats Kindahl9 Nov
  • Re: how does one know if their storage engine supports replication?Mats Kindahl9 Nov
    • Re: how does one know if their storage engine supports replication?MARK CALLAGHAN9 Nov
      • Re: how does one know if their storage engine supports replication?Sergei Golubchik9 Nov
        • Re: how does one know if their storage engine supports replication?MARK CALLAGHAN9 Nov
          • Re: how does one know if their storage engine supports replication?Sergei Golubchik9 Nov
            • Re: how does one know if their storage engine supports replication?Ann W. Harrison9 Nov
              • Re: how does one know if their storage engine supports replication?Zardosht Kasheff9 Nov
                • Re: how does one know if their storage engine supports replication?Sergei Golubchik9 Nov
                • Re: how does one know if their storage engine supports replication?Ann W. Harrison9 Nov
        • Re: how does one know if their storage engine supports replication?Paul McCullagh11 Nov
  • RE: how does one know if their storage engine supports replication?Thomas Jones-Low9 Nov
  • Re: how does one know if their storage engine supports replication?Ann W. Harrison9 Nov
Re: how does one know if their storage engine supports replication?Paul McCullagh11 Nov