From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Serge Petrenko <sergepetrenko@tarantool.org> Cc: tarantool-patches@freelists.org, Georgy Kirichenko <georgy@tarantool.org> Subject: Re: [PATCH] replication: move cluster id match check to replica Date: Thu, 7 Feb 2019 13:14:51 +0300 [thread overview] Message-ID: <20190207101451.hajah3gf2woe6qr7@esperanza> (raw) In-Reply-To: <330D09EB-772C-4943-A9C0-77BF4A1889F5@tarantool.org> Pushed to 2.1 with some minor changes: diff --git a/src/box/applier.cc b/src/box/applier.cc index 045c6910..512d05df 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -410,7 +410,7 @@ applier_subscribe(struct applier *applier) * In case of successful subscribe, the server * responds with its current vclock. * - * Tarantool 2.1.1 also sends its cluster id to + * Tarantool > 2.1.1 also sends its cluster id to * the replica, and replica has to check whether * its and master's cluster ids match. */ @@ -423,7 +423,7 @@ applier_subscribe(struct applier *applier) * assume that it has done all the checks. * In this case cluster_id will remain zero. */ - if (!tt_uuid_is_equal(&cluster_id, &uuid_nil) && + if (!tt_uuid_is_nil(&cluster_id) && !tt_uuid_is_equal(&cluster_id, &REPLICASET_UUID)) { tnt_raise(ClientError, ER_REPLICASET_UUID_MISMATCH, tt_uuid_str(&cluster_id), diff --git a/src/box/box.cc b/src/box/box.cc index 8a8c0816..e12a1cba 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1609,11 +1609,11 @@ box_process_subscribe(struct ev_io *io, struct xrow_header *header) * the replica how many rows we have in stock for it, * and identify ourselves with our own replica id. * - * Since Tarantool version 2.1.1 master doesn't check - * that replica and master have the same cluster id. - * It sends its cluster id to replica instead, and replica - * checks that its cluster id matches master's one. - * Older versions will just ignore the additional field. + * Tarantool > 2.1.1 master doesn't check that replica + * has the same cluster id. Instead it sends its cluster + * id to replica, and replica checks that its cluster id + * matches master's one. Older versions will just ignore + * the additional field. */ struct xrow_header row; xrow_encode_subscribe_response_xc(&row, diff --git a/test/replication/misc.result b/test/replication/misc.result index 2401ac5c..ab827c50 100644 --- a/test/replication/misc.result +++ b/test/replication/misc.result @@ -634,7 +634,7 @@ test_run:cmd("stop server replica") _ = box.space._schema:replace{'cluster', tostring(uuid.new())} --- ... --- master believes replica is in cluster, but their cluster UUIDS differ. +-- master believes replica is in cluster, but their cluster UUIDs differ. test_run:cmd("start server replica") --- - true @@ -647,7 +647,6 @@ box.info.replication[2].downstream.status --- - stopped ... -test_run:cmd("restart server default with cleanup=1") test_run:cmd("stop server replica") --- - true @@ -660,3 +659,9 @@ test_run:cmd("delete server replica") --- - true ... +test_run:cleanup_cluster() +--- +... +box.schema.user.revoke('guest', 'replication') +--- +... diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua index a1ddf75a..eda5310b 100644 --- a/test/replication/misc.test.lua +++ b/test/replication/misc.test.lua @@ -255,12 +255,13 @@ box.info.replication[2].downstream.status -- change master's cluster uuid and check that replica doesn't connect. test_run:cmd("stop server replica") _ = box.space._schema:replace{'cluster', tostring(uuid.new())} --- master believes replica is in cluster, but their cluster UUIDS differ. +-- master believes replica is in cluster, but their cluster UUIDs differ. test_run:cmd("start server replica") test_run:wait_log("replica", "REPLICASET_UUID_MISMATCH", nil, 1.0) box.info.replication[2].downstream.status -test_run:cmd("restart server default with cleanup=1") test_run:cmd("stop server replica") test_run:cmd("cleanup server replica") test_run:cmd("delete server replica") +test_run:cleanup_cluster() +box.schema.user.revoke('guest', 'replication')
prev parent reply other threads:[~2019-02-07 10:14 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-31 13:25 Serge Petrenko 2019-01-31 13:30 ` Serge Petrenko 2019-02-06 10:48 ` Vladimir Davydov 2019-02-06 14:51 ` Serge Petrenko 2019-02-07 10:14 ` Vladimir Davydov [this message]
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=20190207101451.hajah3gf2woe6qr7@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=georgy@tarantool.org \ --cc=sergepetrenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH] replication: move cluster id match check to replica' \ /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