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 C48216F3E5; Sat, 6 Nov 2021 22:30:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C48216F3E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1636227041; bh=zA0L5MSNhBF+lrYP16OXIAzzceRJ3JXMt2K+s98os90=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Q2M6PSs+t75EHkCaDIaCBGyVgv0peN+UCbDhXCehZ1TMskcZ3lPoJ0M5LeCd9auTX JYQ8CSVeR1/NqbuKMgAUMQSMZsrRAP0Rqe7RLDm+38thv8TWy4TaS6xnRTSJkELO9s Jhh/sBFoaF3HdyBUKYFiRUpE03b8VUKSCmA3ulyE= Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 DB3B06F3E5 for ; Sat, 6 Nov 2021 22:30:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DB3B06F3E5 Received: by mail-lj1-f182.google.com with SMTP id g3so20969396ljm.8 for ; Sat, 06 Nov 2021 12:30:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lUQQEPIr6WNv0CgTW+IFHHaVUZv7qY76nGQ12kmw9UM=; b=79ZmWRoZ+W4IYfFx9FoIUy0ckYQqwom+2A+6efoIqxwJA4gMrx9Mn7FwO1cPJpQLnn buf3C7sgM6+MXgJ9c+KRZ508ziOen1wquJGwb+QvmZmPSb1o8hGJBY162pLMIBv8TQjC 7hxEItD4BPNdvWU4DkoCjiT0Rd/BefOvJLAxt4kVXAOVm97s9l70ZIUe+SqIty+11EpM QVq6GiwsUK2s2+COUyC/Cl4+P0LWxLEhRyLcaULzHa1jHKNqu2z3pLomejAzYczE4PxW j9gC6bda7nYmIh35//lfCa2goQhR/AdmPcnjuJO5jn0T6Lk+l/phuS/KBOtHQI8ByQu5 QX0A== X-Gm-Message-State: AOAM531KxlVxTtfc+5ZqbHR93Q+xhe4kwJL5rHS7WGBwwQHrM0R9VUMH sJsnwoMPm08Zgcx6awHr9uk552pe1O0= X-Google-Smtp-Source: ABdhPJzOJJ+vKWcunWecLB6rI4H0uXIargVk+zDhxRTSLVl8K9fQgPfGIJoP8yRcCsAkFXq2jEs7fw== X-Received: by 2002:a2e:7a0e:: with SMTP id v14mr5698979ljc.528.1636227038754; Sat, 06 Nov 2021 12:30:38 -0700 (PDT) Received: from grain.localdomain ([5.18.251.97]) by smtp.gmail.com with ESMTPSA id o21sm77502lfk.11.2021.11.06.12.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Nov 2021 12:30:37 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id EAEDB5A0020; Sat, 6 Nov 2021 22:30:36 +0300 (MSK) Date: Sat, 6 Nov 2021 22:30:36 +0300 To: Vladislav Shpilevoy via Tarantool-patches Message-ID: References: <99799340f06652929897e363e42a5227d12277a1.1636156453.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <99799340f06652929897e363e42a5227d12277a1.1636156453.git.v.shpilevoy@tarantool.org> User-Agent: Mutt/2.0.7 (2021-05-04) Subject: Re: [Tarantool-patches] [PATCH 9/9] box: enrich ER_READONLY with new details 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Sat, Nov 06, 2021 at 12:56:40AM +0100, Vladislav Shpilevoy via Tarantool-patches wrote: > + if (raft_is_ro(raft)) { > + error_field_set_str(e, "reason", "election"); > + error_field_set_str(e, "state", raft_state_str(raft->state)); > + error_field_set_uint(e, "term", raft->volatile_term); > + uint32_t id = raft->leader; > + if (id != REPLICA_ID_NIL) { > + error_field_set_uint(e, "leader_id", id); > + struct replica *r = replica_by_id(id); Why do we need an additional variable here instead of raft->leader? To shrink code left? > + } else if (txn_limbo_is_ro(&txn_limbo)) { > + error_field_set_str(e, "reason", "synchro"); > + uint32_t id = txn_limbo.owner_id; > + error_field_set_uint(e, "queue_owner_id", id); > + error_field_set_uint(e, "term", raft->volatile_term); > + struct replica *r = replica_by_id(id); And here too. Just wondering.