Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Don't raise on box.cfg for instance_uuid and replicaset_uuid
@ 2018-05-28 12:53 Georgy Kirichenko
  2018-05-28 13:30 ` [tarantool-patches] " Vladislav Shpilevoy
  2018-05-29 16:44 ` Konstantin Osipov
  0 siblings, 2 replies; 3+ messages in thread
From: Georgy Kirichenko @ 2018-05-28 12:53 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Georgy Kirichenko

Handle cases if instance_uuid and replicaset_uuid are present in
box.cfg and have same values as already set.

Fixes #3421
---
Branch: https://github.com/tarantool/tarantool/tree/gh-3421-box-cfg-instance-uuid
Issue: https://github.com/tarantool/tarantool/issues/3421
 src/box/lua/load_cfg.lua | 14 ++++++++++++++
 test/box/cfg.result      | 15 +++++++++++++++
 test/box/cfg.test.lua    |  6 ++++++
 3 files changed, 35 insertions(+)

diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index d4f2128db..142c1bd04 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -183,6 +183,18 @@ local dynamic_cfg = {
     force_recovery          = function() end,
     replication_timeout     = private.cfg_set_replication_timeout,
     replication_connect_quorum = private.cfg_set_replication_connect_quorum,
+    instance_uuid           = function()
+        if box.cfg.instance_uuid ~= box.info.uuid then
+            box.error(box.error.CFG, 'instance_uuid',
+                      'Can\'t change instance uuid')
+        end
+    end,
+    replicaset_uuid           = function(new_value)
+        if box.cfg.replicaset_uuid ~= box.info.cluster.uuid then
+            box.error(box.error.CFG, 'replicaset_uuid',
+                      'Can\'t change replicaset uuid')
+        end
+    end,
 }
 
 local dynamic_cfg_skip_at_load = {
@@ -194,6 +206,8 @@ local dynamic_cfg_skip_at_load = {
     wal_dir_rescan_delay    = true,
     custom_proc_title       = true,
     force_recovery          = true,
+    instance_uuid           = true,
+    replicaset_uuid         = true,
 }
 
 local function convert_gb(size)
diff --git a/test/box/cfg.result b/test/box/cfg.result
index 67539cd17..d53e164ab 100644
--- a/test/box/cfg.result
+++ b/test/box/cfg.result
@@ -226,6 +226,21 @@ box.cfg{vinyl_write_threads = "threads"}
 ---
 - error: 'Incorrect value for option ''vinyl_write_threads'': should be of type number'
 ...
+box.cfg{instance_uuid = box.info.uuid}
+---
+...
+box.cfg{instance_uuid = '12345678-0123-5678-1234-abcdefabcdef'}
+---
+- error: 'Incorrect value for option ''instance_uuid'': Can''t change instance uuid'
+...
+box.cfg{replicaset_uuid = box.info.cluster.uuid}
+---
+...
+box.cfg{replicaset_uuid = '12345678-0123-5678-1234-abcdefabcdef'}
+---
+- error: 'Incorrect value for option ''replicaset_uuid'': Can''t change replicaset
+    uuid'
+...
 --------------------------------------------------------------------------------
 -- Test of default cfg options
 --------------------------------------------------------------------------------
diff --git a/test/box/cfg.test.lua b/test/box/cfg.test.lua
index a73ae395b..dbb463025 100644
--- a/test/box/cfg.test.lua
+++ b/test/box/cfg.test.lua
@@ -27,6 +27,12 @@ box.cfg{vinyl = "vinyl"}
 box.cfg{vinyl_write_threads = "threads"}
 
 
+box.cfg{instance_uuid = box.info.uuid}
+box.cfg{instance_uuid = '12345678-0123-5678-1234-abcdefabcdef'}
+
+box.cfg{replicaset_uuid = box.info.cluster.uuid}
+box.cfg{replicaset_uuid = '12345678-0123-5678-1234-abcdefabcdef'}
+
 --------------------------------------------------------------------------------
 -- Test of default cfg options
 --------------------------------------------------------------------------------
-- 
2.17.0

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

* [tarantool-patches] Re: [PATCH] Don't raise on box.cfg for instance_uuid and replicaset_uuid
  2018-05-28 12:53 [tarantool-patches] [PATCH] Don't raise on box.cfg for instance_uuid and replicaset_uuid Georgy Kirichenko
@ 2018-05-28 13:30 ` Vladislav Shpilevoy
  2018-05-29 16:44 ` Konstantin Osipov
  1 sibling, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2018-05-28 13:30 UTC (permalink / raw)
  To: tarantool-patches, Georgy Kirichenko

Hello. Thanks for the patch! See my 3 comments below.

1. Please, send a patch copy to ones who might review it.

On 28/05/2018 15:53, Georgy Kirichenko wrote:
> Handle cases if instance_uuid and replicaset_uuid are present in
> box.cfg and have same values as already set.
> 
> Fixes #3421
> ---
> Branch: https://github.com/tarantool/tarantool/tree/gh-3421-box-cfg-instance-uuid
> Issue: https://github.com/tarantool/tarantool/issues/3421
>   src/box/lua/load_cfg.lua | 14 ++++++++++++++
>   test/box/cfg.result      | 15 +++++++++++++++
>   test/box/cfg.test.lua    |  6 ++++++
>   3 files changed, 35 insertions(+)
> 
> diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
> index d4f2128db..142c1bd04 100644
> --- a/src/box/lua/load_cfg.lua
> +++ b/src/box/lua/load_cfg.lua
> @@ -183,6 +183,18 @@ local dynamic_cfg = {
>       force_recovery          = function() end,
>       replication_timeout     = private.cfg_set_replication_timeout,
>       replication_connect_quorum = private.cfg_set_replication_connect_quorum,
> +    instance_uuid           = function()
> +        if box.cfg.instance_uuid ~= box.info.uuid then
> +            box.error(box.error.CFG, 'instance_uuid',
> +                      'Can\'t change instance uuid')
> +        end
> +    end,
> +    replicaset_uuid           = function(new_value)
> +        if box.cfg.replicaset_uuid ~= box.info.cluster.uuid then
> +            box.error(box.error.CFG, 'replicaset_uuid',
> +                      'Can\'t change replicaset uuid')
> +        end
> +    end,

2. Please, use box.error.RELOAD_CFG like it is done for all
non-dynamic options.

>   }
>   
>   local dynamic_cfg_skip_at_load = {
> @@ -194,6 +206,8 @@ local dynamic_cfg_skip_at_load = {
>       wal_dir_rescan_delay    = true,
>       custom_proc_title       = true,
>       force_recovery          = true,
> +    instance_uuid           = true,
> +    replicaset_uuid         = true,

3. Why?

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

* [tarantool-patches] Re: [PATCH] Don't raise on box.cfg for instance_uuid and replicaset_uuid
  2018-05-28 12:53 [tarantool-patches] [PATCH] Don't raise on box.cfg for instance_uuid and replicaset_uuid Georgy Kirichenko
  2018-05-28 13:30 ` [tarantool-patches] " Vladislav Shpilevoy
@ 2018-05-29 16:44 ` Konstantin Osipov
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Osipov @ 2018-05-29 16:44 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Georgy Kirichenko

* Georgy Kirichenko <georgy@tarantool.org> [18/05/28 15:54]:
> Handle cases if instance_uuid and replicaset_uuid are present in
> box.cfg and have same values as already set.
> 
> Fixes #3421

I slightly refactored this patch and pushed it into 1.9 and 1.10


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

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

end of thread, other threads:[~2018-05-29 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-28 12:53 [tarantool-patches] [PATCH] Don't raise on box.cfg for instance_uuid and replicaset_uuid Georgy Kirichenko
2018-05-28 13:30 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-29 16:44 ` Konstantin Osipov

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