[Tarantool-patches] [PATCH 1/1] applier: drop a couple of unnecessary arguments

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Aug 15 18:16:44 MSK 2020


Applier on_rollback and on_wal_write don't need any arguments -
they either work with a global state, or with the signaled applier
stored inside the trigger.

However into on_wal_write() and on_rollback() was passed the
transaction object, unused.

Even if it would be used, it should have been fixed, because soon
these triggers will be fired not only for traditional 'txn'
transactions. They will be used by the synchro request WAL writes
too - they don't have 'transactions'.

Part of #5129
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/applier_triggers_args
Issue: https://github.com/tarantool/tarantool/issues/5129

 src/box/applier.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index a953d293e..34cb0e4b9 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -802,8 +802,8 @@ applier_txn_rollback_cb(struct trigger *trigger, void *event)
 	diag_set_error(&replicaset.applier.diag,
 		       diag_last_error(diag_get()));
 
-	/* Broadcast the rollback event across all appliers. */
-	trigger_run(&replicaset.applier.on_rollback, event);
+	/* Broadcast the rollback across all appliers. */
+	trigger_run(&replicaset.applier.on_rollback, NULL);
 
 	/* Rollback applier vclock to the committed one. */
 	vclock_copy(&replicaset.applier.vclock, &replicaset.vclock);
@@ -814,8 +814,9 @@ static int
 applier_txn_wal_write_cb(struct trigger *trigger, void *event)
 {
 	(void) trigger;
-	/* Broadcast the commit event across all appliers. */
-	trigger_run(&replicaset.applier.on_wal_write, event);
+	(void) event;
+	/* Broadcast the WAL write across all appliers. */
+	trigger_run(&replicaset.applier.on_wal_write, NULL);
 	return 0;
 }
 
-- 
2.21.1 (Apple Git-122.3)



More information about the Tarantool-patches mailing list