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 E725F6EC5E; Fri, 23 Apr 2021 23:57:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E725F6EC5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1619211434; bh=SY2cY3Rap2/Dp3TJXhhFi/Mv0XPJ1Cn3zE+nGskm4bg=; 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=uG2us/QcBg3EZYOgx8cu5ccSo1mOrTGPABc6w11HwO0yOYO9mUr0gpo8cbUvWTC5L MIgeS2+waViDn/ctM3qm7uleTxmwjHNfyjwC8lthUXfXe9+TOWba465TmOME/t2FCa sNwszi6Yn4hXdwu2qFzs7MTwDZ1575EpjTb9psvo= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 C018E6EC5E for ; Fri, 23 Apr 2021 23:57:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C018E6EC5E Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1la2rQ-0007yf-5Z; Fri, 23 Apr 2021 23:57:12 +0300 To: Cyrill Gorcunov , tml References: <20210419083719.29689-1-gorcunov@gmail.com> <20210419083719.29689-2-gorcunov@gmail.com> Message-ID: <68c7c11c-758b-5513-de57-1150c16689d8@tarantool.org> Date: Fri, 23 Apr 2021 22:57:11 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210419083719.29689-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9203E2ABA940B754838BCE75048F11F6F76F35AC68F7AE588182A05F53808504002C24C7F52A8D1C65AA5236F63AE6713237D0FDC7EFE40AB287BF7ED282A74DF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73B2A9F8A35432468EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637DAE863916B47044D8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2F13156C852575805BF0AF003B68A0F24C5BC91295CC49E52D2E47CDBA5A96583C09775C1D3CA48CFE97D2AE7161E217F117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7E4DF6D1C10F22F599FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16BCE5475246E174218B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A56CF77B333A34BA9C45030DF1507D39FA726C4393AD81866ED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34EE19B6E2433CA093E391054FCF99A5175C4970BE9442C5502E2354C9625A67E8D28257FD263A4CB71D7E09C32AA3244C8131F2573E4EE7730963B927DD9A381763871F383B54D9B3729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojfZPPuXuuvpSbO4VnZx8T7g== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382272B7B75786DF415EF5D4A220483DCBEC3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/3] wal: sanitize wal_mode 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" Hi! Thanks for the patch! > diff --git a/src/box/wal.h b/src/box/wal.h > index a8a16ba2e..470aa1cc8 100644 > --- a/src/box/wal.h > +++ b/src/box/wal.h > @@ -41,7 +41,29 @@ struct fiber; > struct wal_writer; > struct tt_uuid; > > -enum wal_mode { WAL_NONE = 0, WAL_WRITE, WAL_FSYNC, WAL_MODE_MAX }; > +enum wal_mode { > + /** > + * Do not write data at all. > + */ > + WAL_NONE, > + > + /** > + * Write without waiting the data to be > + * flushed to the storage device. > + */ > + WAL_WRITE, > + > + /** > + * Write data and wait the record to be > + * flushed to the storage device. > + */ > + WAL_FSYNC, > + > + WAL_MODE_MAX > +}; > + > +/** String constants for the supported modes. */ > +extern const char *wal_mode_STRS[WAL_MODE_MAX]; 1. Why do you need to declare in the header the array size? The old version with [] was just fine. And less places to change if becomes necessary. 2. Please, keep the global variable where it was. We usually group global variable declarations. It was grouped with wal_dir_lock below. > enum { > /** > @@ -52,9 +74,6 @@ enum { > WAL_ROWS_PER_YIELD = 1 << 15, > }; > > -/** String constants for the supported modes. */ > -extern const char *wal_mode_STRS[]; > - > extern int wal_dir_lock; > > #if defined(__cplusplus) >