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 274136EC56; Tue, 16 Mar 2021 13:19:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 274136EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1615889971; bh=exCLd5mh+ZyG84MpOqus5zVO597te671Ko1TcPDHrVY=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PgmrJC9TNlHT2vKqZL+yRG4vbiciO8aYvQ+VRfPdDPDVCrX3lFm4bvN/qvD1MrNEn xOLONz4JCwMgEfQAf55i91f2HK/BFYdzArJHcsuNRKhUFnxnvGxkIOffmFdXr+6FVd /59a3RZiIzpgAJ7maN0EEq2PhYpUr3pahpVqtD9o= Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (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 6B9CF6EC56 for ; Tue, 16 Mar 2021 13:19:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6B9CF6EC56 Received: by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1lM6nQ-0003B9-O5; Tue, 16 Mar 2021 13:19:29 +0300 To: Vladislav Shpilevoy , Konstantin Osipov , gorcunov@gmail.com, tarantool-patches@dev.tarantool.org References: <20210224193549.70017-1-sergepetrenko@tarantool.org> <26fde1bf-a972-fe03-fffe-818839718394@tarantool.org> <20210310081804.GA87351@starling> <54666e16-f577-c9f5-e917-f834b7e4b8d5@tarantool.org> Message-ID: <07f4831b-2300-2bb0-28a3-9d49f197e951@tarantool.org> Date: Tue, 16 Mar 2021 13:19:27 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <54666e16-f577-c9f5-e917-f834b7e4b8d5@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69B54C6354AEEB3BDF9AAE3283F1E6CEA6100894C459B0CD1B911076E5DE7D4985EB56D8D49EA2255F3D6C190CDF632F4B6808768E5B14F6D12 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74D0D2DEF2EB846B0EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378556F4CD9D953FFE8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CF89CA98302ED496FF2A2AECFE890EC6216D69AA6B6C4D938A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE70F3DDF2BBF19B93A9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C332941D3B652364A4117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF590379BDAD67EFBFBA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B665C1D6FB8A26C38176E601842F6C81A1F004C90652538430CDED94BCBF13EF3B93EC92FD9297F6718AA50765F7900637E52AE9B802B2390DA7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89F3F410F14AF5AD977CE5475246E174218B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DB48C21F01D89DB561574AF45C6390F7469DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20BC34632CCC2A66CAB691F6115D6C662CE X-C1DE0DAB: 0D63561A33F958A5B66B32A7C93C0296E47512952056DE1FED04ED91DBE416B9D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F04B387B5D7535DE410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34980A6B448CFD1B8AA55A1B4D2FDD660FC60069C3AE59623B5E05E5E39E30749E03953AEB8D7174F11D7E09C32AA3244CC88989077CCA3DD688B6E029B51B9F7405AB220A9D022EBC927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmD8gqPF9k0kEqy+h/MbvDQ== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8E5E824FF90AFF63D7AACB870837F164D5CD0503119E437EE424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3] wal: introduce limits on simultaneous writes 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 16.03.2021 02:42, Vladislav Shpilevoy пишет: > Hi! Thanks for the patch! Thanks for your answer! > > I must admit, it looks kind of ugly :D. The class we have now only remotely > looks like a semaphore. > > Number of reasons, some of which you already listed in the header file: > > - It is advisory. Can be bypassed easily if you forget to check wouldblock. > But not a big issue really. An optional thing like 'try_take' is needed > for box.commit({is_async = true}) anyway, not to block the fiber; > > - You can take more amount of the resource than there is. Bearable as well, > but still; > > - sem_release() does not wakeup anybody. Quite counter-intuitive; > > - The wouldblock check not only checks the resource being available, but also > if there are any waiters. It wouldn't matter for a real semaphore, because > it has nothing to do with ordering the waiters in FIFO. It is a detail of > the journal which slipped into the general class. > But maybe that is the only way to make it fair? Otherwise some fibers > could be blocked forever due to starvation. > > The last thing I am not sure is even an issue. Might be a feature. > > The others probably can be fixed if we would rework journal_queue API. For > instance, not have journal_queue_wait() separated from journal_queue_on_append(). > Then sem_take() could become blocking and obligatory. > > You simply inline everything into journal_write() and journal_write_try_async(), > and you will see that you can always call take() and block inside of it. > > But I don't know if it is worth doing TBH. It is used in a single place so far. > This is hard to define fiber_sem API which would be suitable for future usages. > I would vote for not doing it now and see if we would need the semaphore in the > future. > > Although the idea about removing journal_queue_wait() might be worth trying. > It is used either right before journal_queue_on_append(), or in > journal_queue_flush() which is also right before journal_queue_on_append(). > Up to you. Anyway we need to return to this code for box.commit({is_async}) > feature, which means the hard polishing might be not so useful. Let's drop the semaphore thing then. I removed the commit introducing it and pushed the patch on a new branch: sp/gh-5536-replica-oom-no-sem -- Serge Petrenko