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 2D8FC6EC55; Wed, 21 Jul 2021 00:16:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2D8FC6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626815813; bh=AzIDjbIpeAnMztm7aIr2/wuH6Dqio9xVyHyj54zasD8=; 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=YQHdj7hZK1y414B3u5/vK1PRWBmKt0m6wtJtXTrc4jUaUiqmCzNOPqPbodcYA5Um+ gyWZ73ZoIpnWZZTzWjzy/qMhGpUCJG3Q1OmzUKKOHlvCsKoJY1MMxfLlINc/swtEwh g705N8IyjmeytN7c9ECcaUlTzRvEvpIaopcJVIxw= Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 A3DE06EC55 for ; Wed, 21 Jul 2021 00:16:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A3DE06EC55 Received: by mail-lf1-f42.google.com with SMTP id u13so23432lfs.11 for ; Tue, 20 Jul 2021 14:16:51 -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=8mUtjzZJMFWSqmFn/hohFKosK6KiWU0V1frZqYCW+zE=; b=SJdOKYes+BLQA3sXhuxeINSKNt2VKgIhQ7sk1Ic3QLlGV0qURyplqNf8Vy1zqW+9mX lWSnG0z/r5Y4pi60HUQhQPhW9Ta2XU6gfSxfowB+LtWMe2Zn4UfBTPKG6SMaLVdOX2PN 7GWwmC/5s44g2COM+fdJ1Oa/BmoFz6Da1+6SiM5IZdsC1bo+v0kD7Xl0CkTh2rBFCLPW b7zQAg2TQCJaLdA+eXezayyRYkXbJz/CfFTciWIGtHlW/sD4GxopXl0S5vTa8GcGJ43P UveUpn07oQfFXavBi5I+oO4x3brWadQPhLbP4zvmKKu7ccg9j6AE+D+tuYn13es2yyIg cFHA== X-Gm-Message-State: AOAM533kvDcOPFuWRKEHltS/VQBJx9KzVfL1JkdfuaqJ6visS3CQ4Rpy ows2ULOIwoX3Ekwj/DhljM2Bo/XmV6w= X-Google-Smtp-Source: ABdhPJx+WlllZwiyC0ypADhC0e7ZG7YT6THMN4MM3wkT0g5ZnDF3KcdxWLJMcknT1OlDKpvEn+fsDA== X-Received: by 2002:ac2:50d6:: with SMTP id h22mr23725367lfm.306.1626815810543; Tue, 20 Jul 2021 14:16:50 -0700 (PDT) Received: from grain.localdomain ([5.18.255.97]) by smtp.gmail.com with ESMTPSA id j1sm1607945lfb.189.2021.07.20.14.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 14:16:49 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 478525A001E; Wed, 21 Jul 2021 00:16:48 +0300 (MSK) Date: Wed, 21 Jul 2021 00:16:48 +0300 To: Konstantin Osipov Message-ID: References: <0c92a88ff1d392f8b03de59be8cb19a162bf78f8.1626392372.git.v.shpilevoy@tarantool.org> <20210716142959.GC146960@starling> <20210719091248.GA4257@starling> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210719091248.GA4257@starling> User-Agent: Mutt/2.0.7 (2021-05-04) Subject: Re: [Tarantool-patches] [PATCH 1/2] replication: introduce ballot.can_be_leader 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, Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Mon, Jul 19, 2021 at 12:12:48PM +0300, Konstantin Osipov wrote: > > Imagine there are nodes A, B, C, D, E. > A is a leader, E is a voter which can not become a leader. > > Imagine A's log index is 5, B = 4, C = 3, D = 2, E = 5. > > The majority's log index is 4, so entry 4 is committed. A dies, B > is partitioned away. The cluster is stuck, because neither C nor B > can get a quorum (3 votes). > > Worse yet, if E's (voter) commit index is low, not high, it can vote for a > node which doesn't have a committed entry. In that case you can > lose a committed entry. Wait, Kostya, here is a set A B C D E {5, 4, 3, 2, 5} * * * L F F F V where L - leader, F - follower, V - voter, LCI is 4 (least common index), Q(uorum) = 3, then A B C D E {-, -, 3, 2, 5} F F V The Voter E won't be able to choose C or D because its log is bigger and the cluster get stuck (this is guaranteed by vclock comparision). Lets assume the E's index is low, say 3 A B C D E {5, 4, 4, 3, 3} * * L F F F V in this config the leader won't commit record 5 until one of {C,D,E} write the new record(s) since otherwise the quorum won't be reached. Assume A and B get out of the set without record 4 written to C A B C D E {-, -, 4, 3, 3} F F V Now the node E can vote for C and D because its index is LE. And since C's index is bigger than others it will be elected next as far as I understand, no? The E won't be leader but will help C to gather the majority. So the cluster should be safe I only I'm not missing something obvious.