Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/3] upgrade: add missing sys triggers off and erasure
Date: Sat, 22 Feb 2020 17:17:05 +0100	[thread overview]
Message-ID: <193460a0-ad68-a587-9598-3fa833c4c68d@tarantool.org> (raw)
In-Reply-To: <20200221152023.GC51816@tarantool.org>

Hi! Thanks for the review!

On 21/02/2020 16:20, Nikita Pettik wrote:
> On 17 Feb 21:57, Vladislav Shpilevoy wrote:
> 
> LGTM
> 
>> +local function foreach_system_space(cb)
>> +    local max = box.schema.SYSTEM_ID_MAX
>> +    for id, space in pairs(box.space) do
> 
> Nit: I'd add brief comment explaining that here we are interested
> only in 'native' system spaces skipping sysviews etc.

Done. Also I decided not to break, when see a space id > SYSTEM_ID_MAX,
because box.space is not an array. And it is not safe to assume, that
all numeric indexes here are in ascending order.

diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
index bd28c1001..2f029d8c0 100644
--- a/src/box/lua/upgrade.lua
+++ b/src/box/lua/upgrade.lua
@@ -66,11 +66,18 @@ end
 local function foreach_system_space(cb)
     local max = box.schema.SYSTEM_ID_MAX
     for id, space in pairs(box.space) do
-        if type(id) == 'number' and
+        -- Check for number, because box.space contains each space
+        -- twice - by ID and by name. Here IDs are selected.
+        -- Engine is checked to be a 'native' space, because other
+        -- engines does not support DML, and does not have
+        -- triggers to turn off/on. These are 'service',
+        -- 'blackhole', and more may be added.
+        -- When id > max system id is met, break is not done,
+        -- because box.space is not an array, and it is not safe
+        -- to assume all its numeric indexes are returned in
+        -- ascending order.
+        if type(id) == 'number' and id <= max and
            (space.engine == 'memtx' or space.engine == 'vinyl') then
-            if id > max then
-                break
-            end
             cb(space)
         end
     end

  reply	other threads:[~2020-02-22 16:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 20:57 [Tarantool-patches] [PATCH 0/3] Fix upgrade from 2.1 sequence Vladislav Shpilevoy
2020-02-17 20:57 ` [Tarantool-patches] [PATCH 1/3] upgrade: add missing sys triggers off and erasure Vladislav Shpilevoy
2020-02-21 15:20   ` Nikita Pettik
2020-02-22 16:17     ` Vladislav Shpilevoy [this message]
2020-02-17 20:57 ` [Tarantool-patches] [PATCH 2/3] box: forbid to update/replace _space_sequence Vladislav Shpilevoy
2020-02-21 15:29   ` Nikita Pettik
2020-02-22 16:16     ` Vladislav Shpilevoy
2020-02-17 20:57 ` [Tarantool-patches] [PATCH 3/3] upgrade: fix generated sequence upgrade from 2.1 Vladislav Shpilevoy
2020-02-21 15:42   ` Nikita Pettik
2020-02-22 16:16     ` Vladislav Shpilevoy
2020-02-24 19:48 ` [Tarantool-patches] [PATCH 0/3] Fix upgrade from 2.1 sequence Kirill Yukhin

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=193460a0-ad68-a587-9598-3fa833c4c68d@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/3] upgrade: add missing sys triggers off and erasure' \
    /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