Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH 1/1] swim: deliver incarnation update on URI reconfig
@ 2019-06-18 22:32 Vladislav Shpilevoy
  2019-06-19 18:14 ` [tarantool-patches] " Konstantin Osipov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy @ 2019-06-18 22:32 UTC (permalink / raw)
  To: tarantool-patches; +Cc: kostja

URI reconfiguration causes incarnation increment in order to
forcefully rewrite old value on remote instances. But that update
was not delivered to a user via triggers. The patch fixes that.
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/swim-cfg-uri-trigger

 src/lib/swim/swim.c   |  2 ++
 test/swim/swim.result |  5 +++--
 test/unit/swim.c      | 22 ++++++++++++++++++++--
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 00234d1df..2b37d41e0 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -1960,6 +1960,8 @@ swim_cfg(struct swim *swim, const char *uri, double heartbeat_rate,
 	}
 	if (! swim_inaddr_eq(&addr, &swim->self->addr)) {
 		swim->self->incarnation++;
+		swim_on_member_update(swim, swim->self,
+				      SWIM_EV_NEW_INCARNATION);
 		swim_update_member_addr(swim, swim->self, &addr);
 	}
 	if (gc_mode != SWIM_GC_DEFAULT)
diff --git a/test/swim/swim.result b/test/swim/swim.result
index 535c8c969..cceee2595 100644
--- a/test/swim/swim.result
+++ b/test/swim/swim.result
@@ -1293,10 +1293,11 @@ m_list
 ...
 e_list
 ---
-- - is_new_payload: true
+- - is_update: true
+    is_new_payload: true
     is_new_uri: true
     is_new: true
-    is_update: true
+    is_new_incarnation: true
 ...
 ctx_list
 ---
diff --git a/test/unit/swim.c b/test/unit/swim.c
index 0e33d691c..0977e0969 100644
--- a/test/unit/swim.c
+++ b/test/unit/swim.c
@@ -998,7 +998,7 @@ swim_cluster_delete_f(va_list ap)
 static void
 swim_test_triggers(void)
 {
-	swim_start_test(21);
+	swim_start_test(22);
 	struct swim_cluster *cluster = swim_cluster_new(2);
 	swim_cluster_set_ack_timeout(cluster, 1);
 	struct trigger_ctx tctx, tctx2;
@@ -1085,11 +1085,29 @@ swim_test_triggers(void)
 		fiber_sleep(0);
 	note("now all the triggers are done and deleted");
 
-	free(t1);
 	free(t2);
 	if (tctx.ctx.member != NULL)
 		swim_member_unref(tctx.ctx.member);
 
+	/* Check that recfg fires incarnation update trigger. */
+	s1 = swim_new();
+	struct tt_uuid uuid = uuid_nil;
+	uuid.time_low = 1;
+	fail_if(swim_cfg(s1, "127.0.0.1:1", -1, -1, -1, &uuid) != 0);
+
+	memset(&tctx, 0, sizeof(tctx));
+	trigger_add(swim_trigger_list_on_member_event(s1), t1);
+	fail_if(swim_cfg(s1, "127.0.0.1:2", -1, -1, -1, NULL) != 0);
+	while (tctx.ctx.events == 0)
+		fiber_sleep(0);
+	is(tctx.ctx.events, SWIM_EV_NEW_URI | SWIM_EV_NEW_INCARNATION,
+	   "local URI update warns about incarnation update");
+	swim_delete(s1);
+
+	if (tctx.ctx.member != NULL)
+		swim_member_unref(tctx.ctx.member);
+	free(t1);
+
 	swim_finish_test();
 }
 
-- 
2.20.1 (Apple Git-117)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] swim: deliver incarnation update on URI reconfig
  2019-06-18 22:32 [tarantool-patches] [PATCH 1/1] swim: deliver incarnation update on URI reconfig Vladislav Shpilevoy
@ 2019-06-19 18:14 ` Konstantin Osipov
  2019-06-19 20:30   ` Vladislav Shpilevoy
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Osipov @ 2019-06-19 18:14 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/06/19 11:14]:
> URI reconfiguration causes incarnation increment in order to
> forcefully rewrite old value on remote instances. But that update
> was not delivered to a user via triggers. The patch fixes that.

lgtm


-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] swim: deliver incarnation update on URI reconfig
  2019-06-19 18:14 ` [tarantool-patches] " Konstantin Osipov
@ 2019-06-19 20:30   ` Vladislav Shpilevoy
  0 siblings, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2019-06-19 20:30 UTC (permalink / raw)
  To: Konstantin Osipov; +Cc: tarantool-patches

Pushed to the master.

On 19/06/2019 20:14, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/06/19 11:14]:
>> URI reconfiguration causes incarnation increment in order to
>> forcefully rewrite old value on remote instances. But that update
>> was not delivered to a user via triggers. The patch fixes that.
> 
> lgtm
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-19 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 22:32 [tarantool-patches] [PATCH 1/1] swim: deliver incarnation update on URI reconfig Vladislav Shpilevoy
2019-06-19 18:14 ` [tarantool-patches] " Konstantin Osipov
2019-06-19 20:30   ` Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox