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 CDD9B6EC55; Thu, 17 Jun 2021 12:16:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CDD9B6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623921398; bh=evqhWn+ZY3VSJNr3F9FvHZXxx+CR/B8TJ5IwKeKeLks=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=zRt79Lb07im34QnSPWLJlvVBhpOwJEaIMq+uhfNNru6mHg2hUPJWOi+fp848JKSFR 1dLI0QMl5eY4Z0nhhhcsoBTe7oQinG2n4sfJDi7cXtBlVK+wz3+y53TNZ9fuKxzAOW jIl15wt1T2BZEmfzB6I3I1W0bkLnIrY88a++Bjjw= Received: from smtp47.i.mail.ru (smtp47.i.mail.ru [94.100.177.107]) (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 85AB16EC55 for ; Thu, 17 Jun 2021 12:16:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 85AB16EC55 Received: by smtp47.i.mail.ru with esmtpa (envelope-from ) id 1lto8a-0003ts-GO; Thu, 17 Jun 2021 12:16:36 +0300 To: Cyrill Gorcunov References: <20210607155519.109626-1-gorcunov@gmail.com> <20210607155519.109626-2-gorcunov@gmail.com> <22738ee6-74e1-0090-4eb0-c08183bb16e8@tarantool.org> Message-ID: <68c348fe-7029-db28-8457-a95d03e6923e@tarantool.org> Date: Thu, 17 Jun 2021 12:16:35 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9C7814344C8C501C8B30A48FA5B63709A91E92CF834B7C7BB182A05F538085040A78B2AA1C851B063D973354F855AB6D3DDCB4A8904575B18602BE9B876FD01AF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72AC9FB60380F23AEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063753275FB77F6A31628638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8CF8A575C64054CBD27A2808F70384C0A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC9FC99A4BA45EE8B4A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735204B6963042765DA4B6FD1C55BDD38FC3FD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A1DCCEB63E2F10FB089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A56392DFE0C05C56D5DC836A4F450225CBE71100619CB4A15BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A9A0A0BF1A2CAC6207DCFB115EFBC3EEA59BB3771790A17CB6BEAF2A8A79C67486BB8780653CD01D1D7E09C32AA3244CB96DDB16F758009C6973DFCEAFA9ECB464EE5813BBCA3A9D927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojo2TEchKDd+fTGqGPOOBPjQ== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446542EB993283EE8983B93FD43C3A66BD7168D86CA77387D39424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v8 1/2] applier: send transaction's first row WAL time in the applier_writer_f 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: Vladislav Shpilevoy , tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 16.06.2021 16:32, Cyrill Gorcunov пишет: > On Tue, Jun 15, 2021 at 12:36:02PM +0300, Serge Petrenko wrote: >>> @@ -193,6 +196,16 @@ applier_writer_f(va_list ap) >>> applier->has_acks_to_send = false; >>> struct xrow_header xrow; >>> xrow_encode_vclock(&xrow, &replicaset.vclock); >>> + /* >>> + * For relay lag statistics we report last >>> + * written transaction timestamp in tm field. >>> + * >>> + * Replica might be dead already so we have to >>> + * test on each iteration. >>> + */ >>> + struct replica *r = replica_by_id(replica_id); >>> + if (likely(r != NULL)) >>> + xrow.tm = r->applier_txn_start_tm; >> How could a replica be dead here? >> AFAIR we delete a replica only when it's deleted from _cluster. Shouldn't >> the applier writer be dead as well by that time? > Before accessing replica_by_id we're sitting in event loop trying to > fetch data from the network. Which means an admin may cleanup the > entry manually before we get back to this code in result we will > get a nil dereference (if only I'm not missing something). I mean that this code you're referring to is executed in a while (!fiber_is_cancelled()) {...} loop. IIRC applier->writer gets cancelled as soon as replica is unregistered. So even if someone deletes the entry manually the writer will exit the loop before getting a nil dereference. P.S. I couldn't find this anywhere in code so let's leave the check. -- Serge Petrenko