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 D2D206EC5D; Fri, 2 Apr 2021 18:11:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D2D206EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617376290; bh=mhuK9XuOyo8C5JJ9C/ym9+YmwiN+V+IMqk5yzaCVKkE=; 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=uggFG2Gbl0NBw1OAYFljMsH9CpINslPEyps3g59FTBCq9D8Mv2VqkX/fPFzG/nx+b aZjdOaQZgl4fREjnzX8CKhzXBaFQ0jZQ2dlrslbWaFmdZPkP8X67hd8NX8iX6HRpBl SYRqjc1E9rolzKqyHIjDLMPiawfbdpeP9vc9QIIc= Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 871A36EC5D for ; Fri, 2 Apr 2021 18:11:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 871A36EC5D Received: by mail-lf1-f44.google.com with SMTP id b14so7966644lfv.8 for ; Fri, 02 Apr 2021 08:11:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NYCEnIFXIoCVl8p71X4Y4UusvUB1Mg0pdXGH0np0ags=; b=C/s89+wYFkR39W6Pp/63Nf7/6c7ir6s2kHuj4FVh+NNK+obknh2UMfLPK9hr3eTMbu 4u+8YI+7E7eECMCnQg3OB0SKFKAEZWXIEth+4xOOCtlgNspUbK2t1KULpUHXhJwcce5q acCHlpqECjyF98Wju5wwvn979Ow2umSDHItMOdmRqwoP5pYgNkFwUBXABuromASH1Y1l QtoazaA7AbjAg8o16iT/Mx5GKSZhwEBfeX7JYDrUhD0cjx6azX62t/nRKcC+e6zX3XOf MG/e6nmUs+jGAsZjaDjegjNSiviuoYxxgZoPyZbqipM94IfUznoMMBJx/BGYz03Fp5hr Jq4Q== X-Gm-Message-State: AOAM533MnO8iRSavgoRoH1vAbfCMamfPnIT/JCscUNhT0DG5O/bim9Eu tlyIhjtI/bbEyDQuugWvQssZKGaYrR5fJA== X-Google-Smtp-Source: ABdhPJxR1aSBszl4QR18byqutG12LAz+FIV1Kp6V7TCBpA1TrZTBvJrZTsFChwNw1Y+wxe3dbEkLVw== X-Received: by 2002:a05:6512:3290:: with SMTP id p16mr9179857lfe.150.1617376288180; Fri, 02 Apr 2021 08:11:28 -0700 (PDT) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id o22sm954479ljh.31.2021.04.02.08.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 08:11:27 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 4DC8B5601C4; Fri, 2 Apr 2021 18:11:26 +0300 (MSK) Date: Fri, 2 Apr 2021 18:11:26 +0300 To: Vladislav Shpilevoy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) Subject: Re: [Tarantool-patches] [PATCH 2/3] recovery: make it transactional 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Fri, Apr 02, 2021 at 12:23:43AM +0200, Vladislav Shpilevoy wrote: > + > +/** > + * Yield once in a while, but not too often, mostly to allow signal handling to > + * take place. > + */ > +static void > +wal_stream_try_yield(struct wal_stream *stream) > +{ > + bool needs_yield = (stream->rows % WAL_ROWS_PER_YIELD == 0); Maybe worth to move this calculation below? > + if (wal_stream_has_tx(stream)) { > + /* > + * Save the yield. Otherwise it would happen only on rows which > + * are a multiple of WAL_ROWS_PER_YIELD and are last in their > + * transaction, which is probably a very rare coincidence. > + */ > + stream->has_yield = true; > + return; > + } Here --> So it won't take place if not needed. Not a big deal though up to you. > + if (stream->has_yield) > + stream->has_yield = false; > + else if (!needs_yield) > + return; > + fiber_sleep(0); > +}