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 8A8686EC58; Wed, 4 Aug 2021 02:26:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8A8686EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628033161; bh=upwcUOUsLG1uERDT9CrEeR/XGCcHJdYn6PaKtZA8Dl4=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=d7e1JRR5uMkbFFfXtYglJ7vSYWbqOtSq3pkdkVmqlKrUPx4KyMGu78U6JGHnFFl37 QanoitYUBEC9oR7hXUEL1zZqyKPOYD30xf1UfJyuoDPaI5YTVmbDsZrVLmL0BjufSF 6MVgcKa1J7TUW4/Xn/aeZemyPiAOf2kfEsPFDjv4= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 5A15E6EC58 for ; Wed, 4 Aug 2021 02:26:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5A15E6EC58 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mB3nL-0006YR-H0; Wed, 04 Aug 2021 02:25:59 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <3b4f7752-f68b-afce-c83a-355bcfbc28cc@tarantool.org> <9ae5765f-ffcb-af66-469b-b0a99d71c331@tarantool.org> <036d7d32-54bc-3239-9291-d713b062f324@tarantool.org> <03c81edf-709b-6320-b3e3-a2331b2b08fe@tarantool.org> Message-ID: <5ca8fae1-c231-8903-a5d6-cc1aa03a9ea5@tarantool.org> Date: Wed, 4 Aug 2021 01:25:58 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <03c81edf-709b-6320-b3e3-a2331b2b08fe@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C366EE405EC28A2001F8302D8429E0DE58182A05F538085040B490F266CEEA124B344CF9F4A2F94CAF312F36CC657195302C0F84B5FEA565B4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BDF1FA55CCD598A3EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AD1E1BF10F09609D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D81F8A940E482D2DD120A503B5FB4D8227117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B5057C87ED1DFBD03447F676E5DFE9EC019E X-C1DE0DAB: 0D63561A33F958A5583E91460BCD89194330C1AA8216A9F4F2E598D87EA2AA0CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751B940EDA0DFB0535410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3447DF5779098ECEE949DA806AFB14FCC849F5926C728B7E42CA732F92B0273255D5B0C4EE5D4B9E401D7E09C32AA3244CCF82C6A4A9A0E7C8BE683DE2CBDDF047B038C9161EF167A1FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojeDyvyeZJDJGf2WTNbNdYLg== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DA65B503539C321B98CF0A0C411CEDBA43841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3 07/12] box: introduce `box.ctl.demote` 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the fixes! See 3 comments below. > diff --git a/src/box/iproto.cc b/src/box/iproto.cc > index 3ed641eea..5cc69b77f 100644 > --- a/src/box/iproto.cc > +++ b/src/box/iproto.cc > @@ -557,6 +558,20 @@ struct iproto_connection >      struct iproto_thread *iproto_thread; >  }; > > +#ifdef NDEBUG > +#define iproto_write_error(fd, e, schema_version, sync)                         \ > +    iproto_do_write_error(fd, e, schema_version, sync); > +#else > +#define iproto_write_error(fd, e, schema_version, sync) do {                    \ > +    int flags = fcntl(fd, F_GETFL, 0);                                      \ > +    if (flags >= 0)                                                         \ > +        fcntl(fd, F_SETFL, flags & (~O_NONBLOCK));                      \ > +    iproto_do_write_error(fd, e, schema_version, sync);                     \ > +    if (flags >= 0)                                                         \ > +        fcntl(fd, F_SETFL, flags);                                      \ > +} while (0); > +#endif 1. Why didn't you do this right in iproto_write_error? Why do you need to change iproto.cc code at all? > diff --git a/src/box/relay.cc b/src/box/relay.cc > index 805b5e7ff..2947468ba 100644 > --- a/src/box/relay.cc > +++ b/src/box/relay.cc > @@ -444,20 +444,20 @@ relay_initial_join(int fd, uint64_t sync, struct vclock *vclock, >       */ >      if (replica_version_id > 0) { >          /* Mark the beginning of the metadata stream. */ > -        row.type = IPROTO_JOIN_META; > -        coio_write_xrow(&relay->io, &row); > +        xrow_encode_type(&row, IPROTO_JOIN_META); > +        xstream_write(&relay->stream, &row); 2. Why do you use xtream_write? And why coio_write_xrow just a few lines above works just fine then? >          xrow_encode_raft(&row, &fiber()->gc, &raft_req); > -        coio_write_xrow(&relay->io, &row); > +        xstream_write(&relay->stream, &row); > >          char body[XROW_SYNCHRO_BODY_LEN_MAX]; >          xrow_encode_synchro(&row, body, &req); >          row.replica_id = req.replica_id; > -        coio_write_xrow(&relay->io, &row); > +        xstream_write(&relay->stream, &row); > >          /* Mark the end of the metadata stream. */ > -        row.type = IPROTO_JOIN_SNAPSHOT; > -        coio_write_xrow(&relay->io, &row); > +        xrow_encode_type(&row, IPROTO_JOIN_SNAPSHOT); > +        xstream_write(&relay->stream, &row); >      } > diff --git a/src/box/raft.c b/src/box/raft.c > index f8d13aa32..bc69f7f1b 100644 > --- a/src/box/raft.c > +++ b/src/box/raft.c > @@ -83,6 +83,24 @@ box_raft_request_to_msg(const struct raft_request *req, struct raft_msg *msg) >      }; >  } > > +static void > +box_raft_update_synchro_queue(struct raft *raft) > +{ > +    assert(raft == box_raft()); > +    if (raft->state != RAFT_STATE_LEADER) > +        return; > +    int rc = 0; > +    uint32_t errcode = 0; > +    do { > +        rc = box_promote_qsync(); > +        if (rc != 0) { > +            struct error *err = diag_last_error(diag_get()); > +            errcode = box_error_code(err); > +            diag_log(); > +        } 3. Could it stop being a leader during the retries? Would it make sense to continue them then? > +    } while (rc != 0 && errcode == ER_QUORUM_WAIT && !fiber_is_cancelled()); > +}