Pessimistic Mode and Transactions and 2PC

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Pessimistic Mode and Transactions and 2PC

John Wilson
Hi,

Assume the following:


   - I have a transaction coordinator and two primary nodes with 0 backup
   nodes.
   - Persistence store is enabled.
   - I'm running a transaction in pessimistic mode with serializable
   isolation.

I have these questions:

   1. What exactly happens during the prepare phase? Only acquiring locks
   on the two primary nodes? Or do the primary nodes themselves, in addition
   to acquiring locks, write to their respective WAL a TxRecord with a "begin
   prepare" info?
   2. Assume locks have been acquired successfully, would the nodes then
   write a "prepared" TxRecord to WAL before returning a "Yes" vote to
   coordinator?
   3. When the coordinator sends a commit message, would each node write
   the key-values to the DataRecord and a commit to the TxRecord before
   returning to coordinator?


Overall, I'm trying to understand what happens exactly during prepare and
commit phases and when the key-values involved in the transaction are
actually written; as well as the exact updates that are written to the WAL
files in each phase.

appreciate your response.

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: Pessimistic Mode and Transactions and 2PC

Dmitriy Pavlov
Hi John,

Are these questions related to some contribution?

Sincerely,
Dmitriy Pavlov

ср, 8 авг. 2018 г. в 3:18, John Wilson <[hidden email]>:

> Hi,
>
> Assume the following:
>
>
>    - I have a transaction coordinator and two primary nodes with 0 backup
>    nodes.
>    - Persistence store is enabled.
>    - I'm running a transaction in pessimistic mode with serializable
>    isolation.
>
> I have these questions:
>
>    1. What exactly happens during the prepare phase? Only acquiring locks
>    on the two primary nodes? Or do the primary nodes themselves, in
> addition
>    to acquiring locks, write to their respective WAL a TxRecord with a
> "begin
>    prepare" info?
>    2. Assume locks have been acquired successfully, would the nodes then
>    write a "prepared" TxRecord to WAL before returning a "Yes" vote to
>    coordinator?
>    3. When the coordinator sends a commit message, would each node write
>    the key-values to the DataRecord and a commit to the TxRecord before
>    returning to coordinator?
>
>
> Overall, I'm trying to understand what happens exactly during prepare and
> commit phases and when the key-values involved in the transaction are
> actually written; as well as the exact updates that are written to the WAL
> files in each phase.
>
> appreciate your response.
>
> Thanks,
>
Reply | Threaded
Open this post in threaded view
|

Re: Pessimistic Mode and Transactions and 2PC

John Wilson
No they are not. I just want to understand.

On Wednesday, August 8, 2018, Dmitriy Pavlov <[hidden email]> wrote:

> Hi John,
>
> Are these questions related to some contribution?
>
> Sincerely,
> Dmitriy Pavlov
>
> ср, 8 авг. 2018 г. в 3:18, John Wilson <[hidden email]>:
>
> > Hi,
> >
> > Assume the following:
> >
> >
> >    - I have a transaction coordinator and two primary nodes with 0 backup
> >    nodes.
> >    - Persistence store is enabled.
> >    - I'm running a transaction in pessimistic mode with serializable
> >    isolation.
> >
> > I have these questions:
> >
> >    1. What exactly happens during the prepare phase? Only acquiring locks
> >    on the two primary nodes? Or do the primary nodes themselves, in
> > addition
> >    to acquiring locks, write to their respective WAL a TxRecord with a
> > "begin
> >    prepare" info?
> >    2. Assume locks have been acquired successfully, would the nodes then
> >    write a "prepared" TxRecord to WAL before returning a "Yes" vote to
> >    coordinator?
> >    3. When the coordinator sends a commit message, would each node write
> >    the key-values to the DataRecord and a commit to the TxRecord before
> >    returning to coordinator?
> >
> >
> > Overall, I'm trying to understand what happens exactly during prepare and
> > commit phases and when the key-values involved in the transaction are
> > actually written; as well as the exact updates that are written to the
> WAL
> > files in each phase.
> >
> > appreciate your response.
> >
> > Thanks,
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Pessimistic Mode and Transactions and 2PC

Ilya Lantukh
Hi John,

1. There is no "begin prepare" record, nodes acquire locks on TX keys and
then transfer local TX to PREPARED state.
2. TxRecord is logged when local TX state changes to PREPARED, COMMITED or
ROLLED_BACK before sending a response to what you call "coordinator" (in
Ignite we use the term "near node", because the term "coordinator" is
already used in another case).
3. Yes.

Hope this helps.

On Wed, Aug 8, 2018 at 6:29 PM, John Wilson <[hidden email]> wrote:

> No they are not. I just want to understand.
>
> On Wednesday, August 8, 2018, Dmitriy Pavlov <[hidden email]>
> wrote:
>
> > Hi John,
> >
> > Are these questions related to some contribution?
> >
> > Sincerely,
> > Dmitriy Pavlov
> >
> > ср, 8 авг. 2018 г. в 3:18, John Wilson <[hidden email]>:
> >
> > > Hi,
> > >
> > > Assume the following:
> > >
> > >
> > >    - I have a transaction coordinator and two primary nodes with 0
> backup
> > >    nodes.
> > >    - Persistence store is enabled.
> > >    - I'm running a transaction in pessimistic mode with serializable
> > >    isolation.
> > >
> > > I have these questions:
> > >
> > >    1. What exactly happens during the prepare phase? Only acquiring
> locks
> > >    on the two primary nodes? Or do the primary nodes themselves, in
> > > addition
> > >    to acquiring locks, write to their respective WAL a TxRecord with a
> > > "begin
> > >    prepare" info?
> > >    2. Assume locks have been acquired successfully, would the nodes
> then
> > >    write a "prepared" TxRecord to WAL before returning a "Yes" vote to
> > >    coordinator?
> > >    3. When the coordinator sends a commit message, would each node
> write
> > >    the key-values to the DataRecord and a commit to the TxRecord before
> > >    returning to coordinator?
> > >
> > >
> > > Overall, I'm trying to understand what happens exactly during prepare
> and
> > > commit phases and when the key-values involved in the transaction are
> > > actually written; as well as the exact updates that are written to the
> > WAL
> > > files in each phase.
> > >
> > > appreciate your response.
> > >
> > > Thanks,
> > >
> >
>



--
Best regards,
Ilya