← Back to team overview

maria-developers team mailing list archive

Mdev-10715 -- Galera: Replicate MariaDB GTID to other nodes in the cluster


Hi Nirbyay, Serg, Kristian,

In this mail I am answering some questions raised by Kristian and blue
print for

this task.

1. Questions of Kristian

<knielsen> sachin_setiya_7: so maybe the problem is - that a node
broadcasts its write set before the commit order has been determined?

I do not think , this is the problem. Galera enforces the commit order.
Yes,  it broadcast write set in prepare phase. but it also

guarantees that t1->t2 order will be maintained in all participating N

<knielsen> sachin_setiya_7: how is the galera internal transaction id
allocated and broadcast?

I am here assuming that we are talking about gtid-sequence no.

Suppose our initial seqno is S. So basically at this time all N  have same
sequence no.

Some transaction T is executed at node Ni .It broadcast the writeset with

its current sequence no S.

At all Node Nj (including Ni).It receives this message. It checks some

Like it “totally ordered action”. If yes then Nj updates its sequence no to
+ 1.

Here is the relevant code.

      if (gu_likely(GCS_ACT_TORDERED  == rcvd->act.type &&

                    GCS_GROUP_PRIMARY == group->state   &&

                    group->nodes[sender_idx].status >= GCS_NODE_STATE_DONOR

                    !(group->frag_reset && local) &&

                    commonly_supported_version)) {

          /* Common situation -

           * increment and assign act_id only for totally ordered actions

           * and only in PRIM (skip messages while in state exchange) */

          rcvd->id = ++group->act_id_;


In function

static inline ssize_t

gcs_group_handle_act_msg (gcs_group_t*          const group,

                        const gcs_act_frag_t* const frg,

                        const gcs_recv_msg_t* const msg,

                        struct gcs_act_rcvd*  const rcvd,

                        bool commonly_supported_version)

So basically It is like certification(generated at each node ) but done in
quite early


Blueprint of task:- We can do something like galera GTID, we will take

sequence no from server. We will add one more variable in gcs_group_t

Named s_sequence_no and will increment it at each node. We also have to

Create a gtid event and append it to message received at Nj , so that on
late stages wsrep_apply_cb() can take care of gtid.

Please let me know what you think.

Sachin Setiya
Software Engineer at  MariaDB

Follow ups