From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olegrok@tarantool.org>
Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [94.100.177.109])
 (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 B8AF9469710
 for <tarantool-patches@dev.tarantool.org>;
 Mon,  4 May 2020 17:27:48 +0300 (MSK)
From: Oleg Babin <olegrok@tarantool.org>
References: <cover.1588292014.git.v.shpilevoy@tarantool.org>
 <8ef56505d0ff0302c09570eecc55fdbe911c3f17.1588292014.git.v.shpilevoy@tarantool.org>
 <17f95a5f-9fa5-3807-265c-e66fe176ff21@tarantool.org>
 <859f127f-742d-f1ca-43c4-e7badbd7d6ff@tarantool.org>
Message-ID: <1908eb31-0d6a-829b-59e3-4274e02beadc@tarantool.org>
Date: Mon, 4 May 2020 17:27:43 +0300
MIME-Version: 1.0
In-Reply-To: <859f127f-742d-f1ca-43c4-e7badbd7d6ff@tarantool.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-GB
Content-Transfer-Encoding: 8bit
Subject: Re: [Tarantool-patches] [PATCH vshard 7/7] router: introduce
	discovery mode 'once'
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, tarantool-patches@dev.tarantool.org

Got it. Thanks for your answer. LGTM.

On 02/05/2020 23:12, Vladislav Shpilevoy wrote:
> 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.
>