From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 91AB56EC40; Fri, 13 Aug 2021 10:54:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 91AB56EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628841281; bh=Kbr6D1VQ1z4FH/CJj+ILgU3LjM6lqtJ2vMJTFtBZgek=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=u07leCpDd+oOuB/2jr2EsntfcNCDD7ARuM11dnLdL3DCtfUwWlfIn3j6R42bgJLCS vEF40a2H1pwAzbCYhBLePEs17zWW6OK+ZqYFE+l/dj1m0XVtPGfMFmFZ/u+rkv9WmL 1YK2RtDoAexvHvoPCbDiGy0FT5DrDWdecuMeQV1c= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 405406EC40 for ; Fri, 13 Aug 2021 10:54:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 405406EC40 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1mES1X-0006C5-9q; Fri, 13 Aug 2021 10:54:39 +0300 Date: Fri, 13 Aug 2021 10:54:38 +0300 To: Serge Petrenko Message-ID: <20210813075438.4qcxnemi7yr72gwe@esperanza> References: <20210810112836.48775-1-sergepetrenko@tarantool.org> <20210811110654.y3xyaojebckp6flq@esperanza> <90eeefb5-3719-3198-dec7-4f00834733e7@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <90eeefb5-3719-3198-dec7-4f00834733e7@tarantool.org> X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9BCE6B93DE0C6C3914462CDB1732D383C182A05F5380850400B0849A05C5E446C8A5F2C3D61D9482872B0A5B91779D359CEBBF8E0078CF377 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE752E71F0C64B7C834EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637560334CFC131571A8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D814901D0324DA5F4A310CD76059EAEA2D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC55B19328CBC4F849A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A53F51879D202566AD2C29CAE9B7B488C38814C1A508F279FDD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA750E14360347543F58410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A5112A9AECFE11B1A4F66F44CA2DE0D339D9735BE27494AF4C93B48B0CFD4814962308C14B729C561D7E09C32AA3244C090A691CE384C72B0E5F5F6408B8F7E4435BF7150578642F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj0dLV0c3jbkxdv84jroZtig== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DF53F8FC45990B3C8A7312CCAF8D2A9CA274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] box: allow upgrading from version 1.6 X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Fri, Aug 13, 2021 at 02:20:23AM +0300, Serge Petrenko wrote: > > > +local function on_init_set_recovery_triggers() > > > + log.info("Recovering snapshot with schema version %s", snap_version) > > > + for _, trig_tbl in ipairs(recovery_triggers) do > > > + if trig_tbl.version >= snap_version then > > > + for space, trig in pairs(trig_tbl.tbl) do > > > + box.space[space]:before_replace(trig) > > > + log.info("Set recovery trigger on space '%s' to comply with ".. > > > + "version %s format", space, trig_tbl.version) > > > + end > > > + end > > > + end > > > +end > > > + > > > +local function set_recovery_triggers(version) > > > + snap_version = version > > > + box.ctl.on_schema_init(on_init_set_recovery_triggers) > > > +end > > > > Please don't use a global variable for this - it's bad for encapsulation > > and generally make code more difficult to follow. Pass version > > explicitly to all functions that need it. > > I can't do that for an on_schema_init trigger, unfortunately. > Am I missing something? Looks like there's no way to pass trigger.data > for lua triggers. You can capture a value in a lambda: box.ctl.on_schema_init(function() on_init_set_recover_triggers(snap_version) end)