Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: Roman Khabibov <roman.habibov@tarantool.org>,
	tarantool-patches@freelists.org,
	Konstantin Osipov <kostja.osipov@gmail.com>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH] net.box: ignore absence of _vcollation
Date: Wed, 31 Jul 2019 01:35:15 +0300	[thread overview]
Message-ID: <20190730223452.2vgivkmrptkslplc@tkn_work_nb> (raw)
In-Reply-To: <c6908e41-d461-57b0-ca3c-e60f436c5dd5@tarantool.org>

Kirill, I have acquired LGTMs from Kostja and Vlad (with the tiny comment
below, which I had fixed). Can you proceed with the change?

https://github.com/tarantool/tarantool/issues/4307
https://github.com/tarantool/tarantool/tree/Totktonada/gh-4307-net-box-fix-schema-fetch

WBR, Alexander Turenko.

> > diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> > index 2892bb3d3..31a8c16b7 100644
> > --- a/src/box/lua/net_box.lua
> > +++ b/src/box/lua/net_box.lua
> > @@ -754,6 +768,8 @@ local function create_transport(host, port, user, password, callback,
> >              if err then return error_sm(err, hdr) end
> >              dispatch_response_iproto(hdr, body_rpos, body_end)
> >              local id = hdr[IPROTO_SYNC_KEY]
> > +            -- trick: omit check for peer_has_vcollation: id is
> > +            -- not nil
> 
> Nit: usually we start comments with a capital letter and finish
> with a dot. Here and in other hunks. Other than that the patch
> LGTM.

I'm aware of that. I gave glance to comments around and they are
formatted from a small letter and w/o a period, so I formatted the new
code in the same way to make reading more comfortable. Now hovewer I see
that there is no consistency in this point across net_box.lua file. So I
agree with you: it worth to write new comments in our standard way.

Applied an incremental diff at end of the email.

I have applied the diff, rebased the branch upward current master and
force-pushed the branch.

> > +if _TARANTOOL >= '2.2.1' then                    \
> > +    return parts[1].collation == 'test'          \
> > +else                                             \
> > +    return parts[1].collation_id == collation_id \
> 
> I like this new test-run feature with '\', looks way better
> than setopt delimited, and looks like C.

Thanks!

----

diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 31a8c16b7..ea169637d 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -743,7 +743,7 @@ local function create_transport(host, port, user, password, callback,
             set_state('active')
             return iproto_sm(schema_version)
         end
-        -- _vcollation view was added in 2.2.0-389-g3e3ef182f
+        -- _vcollation view was added in 2.2.0-389-g3e3ef182f.
         local peer_has_vcollation = version_at_least(greeting.version_id,
                                                      2, 2, 1)
         local select1_id = new_request_id()
@@ -768,8 +768,8 @@ local function create_transport(host, port, user, password, callback,
             if err then return error_sm(err, hdr) end
             dispatch_response_iproto(hdr, body_rpos, body_end)
             local id = hdr[IPROTO_SYNC_KEY]
-            -- trick: omit check for peer_has_vcollation: id is
-            -- not nil
+            -- Trick: omit check for peer_has_vcollation: id is
+            -- not nil.
             if id == select1_id or id == select2_id or id == select3_id then
                 -- response to a schema query we've submitted
                 local status = hdr[IPROTO_STATUS_KEY]
@@ -791,7 +791,7 @@ local function create_transport(host, port, user, password, callback,
             end
         until response[select1_id] and response[select2_id] and
               (not peer_has_vcollation or response[select3_id])
-        -- trick: response[select3_id] is nil when the key is nil
+        -- Trick: response[select3_id] is nil when the key is nil.
         callback('did_fetch_schema', schema_version, response[select1_id],
                  response[select2_id], response[select3_id])
         set_state('active')
@@ -1286,8 +1286,8 @@ function remote_methods:_install_schema(schema_version, spaces, indices,
                 local pkcollationid = index[PARTS][k].collation
                 local pktype = index[PARTS][k][2] or index[PARTS][k].type
                 local pkfield = index[PARTS][k][1] or index[PARTS][k].field
-                -- resolve a collation name if a peer has
-                -- _vcollation view
+                -- Resolve a collation name if a peer has
+                -- _vcollation view.
                 local pkcollation = nil
                 if pkcollationid ~= nil and collations ~= nil then
                     pkcollation = collations[pkcollationid + 1][2]

      reply	other threads:[~2019-07-30 22:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 12:13 [tarantool-patches] " Roman Khabibov
2019-07-12  9:55 ` [tarantool-patches] " Kirill Yukhin
2019-07-19 12:16   ` Roman Khabibov
2019-07-20 19:07   ` Alexander Turenko
2019-07-24 21:27     ` Alexander Turenko
2019-07-24 22:43       ` Vladislav Shpilevoy
2019-07-30 10:58         ` Alexander Turenko
2019-07-30 12:08           ` Konstantin Osipov
2019-07-30 20:18           ` Vladislav Shpilevoy
2019-07-30 22:35             ` Alexander Turenko [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=20190730223452.2vgivkmrptkslplc@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=kostja.osipov@gmail.com \
    --cc=kyukhin@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH] net.box: ignore absence of _vcollation' \
    /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