From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (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 3CDD34696C3 for ; Sat, 2 May 2020 23:12:12 +0300 (MSK) References: <8ef56505d0ff0302c09570eecc55fdbe911c3f17.1588292014.git.v.shpilevoy@tarantool.org> <17f95a5f-9fa5-3807-265c-e66fe176ff21@tarantool.org> From: Vladislav Shpilevoy Message-ID: <859f127f-742d-f1ca-43c4-e7badbd7d6ff@tarantool.org> Date: Sat, 2 May 2020 22:12:10 +0200 MIME-Version: 1.0 In-Reply-To: <17f95a5f-9fa5-3807-265c-e66fe176ff21@tarantool.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH vshard 7/7] router: introduce discovery mode 'once' List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Oleg Babin , tarantool-patches@dev.tarantool.org Thanks for the review! >> @@ -342,6 +342,13 @@ discovery_f = function(router) >>               unknown_bucket_count = >>                   router.total_bucket_count - router.known_bucket_count >>               if unknown_bucket_count == 0 then >> +                if router.discovery_mode == 'once' then >> +                    log.info("Discovery mode is 'once', and all is ".. >> +                             "discovered - shut down the discovery process") >> +                    router.discovery_fiber = nil >> +                    lfiber.self():cancel() >> +                    return >> +                end > > I'm not sure that self.cancel is a good approach. I think simple "return" should be enough. The discovery fiber is restarted if it returns or throws. The only way to stop it is to cancel. See reloadable_fiber_main_loop() in vshard/vshard/util.lua.