Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, olegrok@tarantool.org,
	yaroslav.dynnikov@tarantool.org
Subject: [Tarantool-patches] [PATCH vshard 3/6] storage: introduce vshard.storage._call('info')
Date: Fri,  2 Jul 2021 00:09:33 +0200	[thread overview]
Message-ID: <6cb2d3736f1fe03f7a398af2f4d7846c2abaf4e0.1625177221.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1625177221.git.v.shpilevoy@tarantool.org>

Internal info function returns data needed by the routers. Now it
is only is_master flag. This is required for master discovery.

In future the function is supposed to get more attributes. For instance,
instance's own part of its config, bucket generation or bucket sequence number.

Needed for #75
---
 test/storage/storage.result   | 14 ++++++++++++++
 test/storage/storage.test.lua |  7 +++++++
 test/upgrade/upgrade.result   |  1 +
 vshard/storage/init.lua       |  7 +++++++
 4 files changed, 29 insertions(+)

diff --git a/test/storage/storage.result b/test/storage/storage.result
index 5372059..acae98f 100644
--- a/test/storage/storage.result
+++ b/test/storage/storage.result
@@ -938,6 +938,20 @@ assert(lstorage.bucket_are_all_rw())
 vshard.storage.internal.errinj.ERRINJ_NO_RECOVERY = false
 ---
 ...
+--
+-- Internal info function.
+--
+vshard.storage._call('info')
+---
+- is_master: true
+...
+_ = test_run:switch('storage_1_b')
+---
+...
+vshard.storage._call('info')
+---
+- is_master: false
+...
 _ = test_run:switch("default")
 ---
 ...
diff --git a/test/storage/storage.test.lua b/test/storage/storage.test.lua
index d1f3f50..99ef2c4 100644
--- a/test/storage/storage.test.lua
+++ b/test/storage/storage.test.lua
@@ -292,6 +292,13 @@ box.space._bucket:update(10, {{'=', 2, vshard.consts.BUCKET.ACTIVE}})
 assert(lstorage.bucket_are_all_rw())
 vshard.storage.internal.errinj.ERRINJ_NO_RECOVERY = false
 
+--
+-- Internal info function.
+--
+vshard.storage._call('info')
+_ = test_run:switch('storage_1_b')
+vshard.storage._call('info')
+
 _ = test_run:switch("default")
 test_run:drop_cluster(REPLICASET_2)
 test_run:drop_cluster(REPLICASET_1)
diff --git a/test/upgrade/upgrade.result b/test/upgrade/upgrade.result
index 8280e5b..8e59807 100644
--- a/test/upgrade/upgrade.result
+++ b/test/upgrade/upgrade.result
@@ -162,6 +162,7 @@ vshard.storage._call ~= nil
 vshard.storage._call('test_api', 1, 2, 3)
  | ---
  | - - bucket_recv
+ |   - info
  |   - rebalancer_apply_routes
  |   - rebalancer_request_state
  |   - storage_map
diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
index e13a24e..465abc5 100644
--- a/vshard/storage/init.lua
+++ b/vshard/storage/init.lua
@@ -2549,6 +2549,12 @@ local function storage_map(rid, name, args)
     return true, res
 end
 
+local function storage_service_info()
+    return {
+        is_master = this_is_master(),
+    }
+end
+
 local service_call_api
 
 local function service_call_test_api(...)
@@ -2562,6 +2568,7 @@ service_call_api = setmetatable({
     storage_ref = storage_ref,
     storage_unref = storage_unref,
     storage_map = storage_map,
+    info = storage_service_info,
     test_api = service_call_test_api,
 }, {__serialize = function(api)
     local res = {}
-- 
2.24.3 (Apple Git-128)


  parent reply	other threads:[~2021-07-01 22:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 22:09 [Tarantool-patches] [PATCH vshard 0/6] Master discovery Vladislav Shpilevoy via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 1/6] replicaset: introduce netbox_wait_connected() Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:46   ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 2/6] test: sort some table prints Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:46   ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-07-02 11:46   ` [Tarantool-patches] [PATCH vshard 3/6] storage: introduce vshard.storage._call('info') Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 4/6] config: introduce master 'auto' replicaset option Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:47   ` Oleg Babin via Tarantool-patches
2021-07-02 21:32     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:23       ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 5/6] router: introduce automatic master discovery Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:48   ` Oleg Babin via Tarantool-patches
2021-07-02 21:35     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:24       ` Oleg Babin via Tarantool-patches
2021-07-05 20:53         ` Vladislav Shpilevoy via Tarantool-patches
2021-07-06  8:54           ` Oleg Babin via Tarantool-patches
2021-07-06 21:19             ` Vladislav Shpilevoy via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 6/6] router: update master using a hint from storage Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:49   ` Oleg Babin via Tarantool-patches
2021-07-02 21:36     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:24       ` Oleg Babin via Tarantool-patches
2021-07-05 20:53         ` Vladislav Shpilevoy via Tarantool-patches
2021-07-06  8:55           ` Oleg Babin via Tarantool-patches
2021-07-02 21:36 ` [Tarantool-patches] [PATCH vshard 7/6] util: truncate too long fiber name Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:23   ` Oleg Babin via Tarantool-patches
2021-08-03 21:55 ` [Tarantool-patches] [PATCH vshard 0/6] Master discovery Vladislav Shpilevoy via Tarantool-patches

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=6cb2d3736f1fe03f7a398af2f4d7846c2abaf4e0.1625177221.git.v.shpilevoy@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=olegrok@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --cc=yaroslav.dynnikov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH vshard 3/6] storage: introduce vshard.storage._call('\''info'\'')' \
    /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