From: Serge Petrenko <sergepetrenko@tarantool.org> To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v2 2/6] relay: introduce on_status_update trigger Date: Wed, 23 Dec 2020 14:59:20 +0300 [thread overview] Message-ID: <5d956009946130bbecf19c4f8bd634f1fa53b0bd.1608724239.git.sergepetrenko@tarantool.org> (raw) In-Reply-To: <cover.1608724238.git.sergepetrenko@tarantool.org> The trigger is fired from tx_status_update(), which is the notification for tx that relay's vclock is updated. The trigger will be used to collect synchronous transactions quorum for old leader's transactions. Part of #5435 --- src/box/relay.cc | 12 ++++++++++++ src/box/relay.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/box/relay.cc b/src/box/relay.cc index e16ac5a6b..dbad8a680 100644 --- a/src/box/relay.cc +++ b/src/box/relay.cc @@ -146,6 +146,8 @@ struct relay { alignas(CACHELINE_SIZE) /** Known relay vclock. */ struct vclock vclock; + /** Triggers fired once tx knows the new relay vclock. */ + struct rlist on_status_update; /** * True if the relay needs Raft updates. It can live fine * without sending Raft updates, if it is a relay to an @@ -173,6 +175,12 @@ relay_vclock(const struct relay *relay) return &relay->tx.vclock; } +void +relay_on_status_update(struct relay *relay, struct trigger *trigger) +{ + trigger_add(&relay->tx.on_status_update, trigger); +} + double relay_last_row_time(const struct relay *relay) { @@ -201,6 +209,7 @@ relay_new(struct replica *replica) diag_create(&relay->diag); stailq_create(&relay->pending_gc); relay->state = RELAY_OFF; + rlist_create(&relay->tx.on_status_update); return relay; } @@ -423,6 +432,9 @@ tx_status_update(struct cmsg *msg) txn_limbo_ack(&txn_limbo, status->relay->replica->id, vclock_get(&status->vclock, instance_id)); } + + trigger_run(&status->relay->tx.on_status_update, status->relay); + static const struct cmsg_hop route[] = { {relay_status_update, NULL} }; diff --git a/src/box/relay.h b/src/box/relay.h index b32e2ea2a..4e6ecaffb 100644 --- a/src/box/relay.h +++ b/src/box/relay.h @@ -93,6 +93,10 @@ relay_vclock(const struct relay *relay); double relay_last_row_time(const struct relay *relay); +/** Set a trigger on relay vclock update as seen by tx. */ +void +relay_on_status_update(struct relay *relay, struct trigger *trigger); + /** * Send a Raft update request to the relay channel. It is not * guaranteed that it will be delivered. The connection may break. -- 2.24.3 (Apple Git-128)
next prev parent reply other threads:[~2020-12-23 11:59 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-23 11:59 [Tarantool-patches] [PATCH v2 0/6] make clear_synchro_queue commit everything Serge Petrenko 2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 1/6] box: add a single execution guard to clear_synchro_queue Serge Petrenko 2020-12-23 11:59 ` Serge Petrenko [this message] 2020-12-23 17:25 ` [Tarantool-patches] [PATCH v2 2/6] relay: introduce on_status_update trigger Vladislav Shpilevoy 2020-12-24 16:11 ` Serge Petrenko 2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 3/6] txn_limbo: introduce txn_limbo_last_synchro_entry method Serge Petrenko 2020-12-23 17:25 ` Vladislav Shpilevoy 2020-12-24 16:13 ` Serge Petrenko 2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 4/6] box: rework clear_synchro_queue to commit everything Serge Petrenko 2020-12-23 17:28 ` Vladislav Shpilevoy 2020-12-24 16:12 ` Serge Petrenko 2020-12-24 17:35 ` Vladislav Shpilevoy 2020-12-24 21:02 ` Serge Petrenko 2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 5/6] test: fix replication/election_qsync_stress test Serge Petrenko 2020-12-23 11:59 ` [Tarantool-patches] [PATCH v2 6/6] txn_limbo: ignore CONFIRM/ROLLBACK for a foreign master Serge Petrenko 2020-12-23 17:28 ` Vladislav Shpilevoy 2020-12-24 16:13 ` Serge Petrenko 2020-12-25 10:04 ` [Tarantool-patches] [PATCH v2 0/6] make clear_synchro_queue commit everything Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5d956009946130bbecf19c4f8bd634f1fa53b0bd.1608724239.git.sergepetrenko@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 2/6] relay: introduce on_status_update trigger' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox