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 C38066F3C4; Mon, 10 May 2021 21:40:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C38066F3C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620672023; bh=6VWFZFuejNEJZCqs8aggVL9QrqdovJXnV5dfrje8k5Y=; 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=LbMlu9XVMr2Fro/vwHwzCLHCqx2gx8eV7t5BvF4rBuwheluvnbLIGbl7KRGYSm5kN 19vMgJHO0BfpJMI/Rw5uddIXziz1Houn3eWBTJlbq+UmkEYeQAHLMGnZt1duNOfzOO 3ofBvt5JMkjbn3m1K5N/DHLi463qT2bW26r1t5WE= Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (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 3EF076F3C4 for ; Mon, 10 May 2021 21:40:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3EF076F3C4 Received: by smtp17.mail.ru with esmtpa (envelope-from ) id 1lgApI-00085d-Sw; Mon, 10 May 2021 21:40:21 +0300 To: Cyrill Gorcunov , tml References: <20210504155819.290874-1-gorcunov@gmail.com> <20210504155819.290874-2-gorcunov@gmail.com> Message-ID: <8901a085-c259-29d5-70e5-fa23c8123590@tarantool.org> Date: Mon, 10 May 2021 20:40:19 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210504155819.290874-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0AAE50420B6EFF6A4E51E23FC86C8E287182A05F538085040ED7941A876D29DDE6BBC760D46A37E0C23A41637732BB963243BC605B80DA999 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F16C4DE526EFCC04EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CF20B9B7F5DD35A68638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2205C9EBA533C83A8FD309BFD61B457BDAD368CDB2FD0D9CCD2E47CDBA5A96583C09775C1D3CA48CFCF36E64A7E3F8E58117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE74A95F4E53E8DCE969FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7A3A137D4317926AFD32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0258990C0CF215F13CD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD06F486128ED73FA73A7078775C9A163A X-C1DE0DAB: 0D63561A33F958A5E3C42DECA9590570D35981C357DEEDB36950C235509A2DACD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3473688ED311681BF061D7D549EA795B0F149BCBBD55DE8C091B631C2B1E9B815933B725D6A4D28DA41D7E09C32AA3244C827E4B58C520DC9E44EC8F76F381152AE8FBBEFAE1C4874C927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojW8rfvRc3+Ao/ePUyaBVcGg== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA311024A4BC108AE990B202E8442E69B65A69B17BC84159881B6707784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3 01/10] fiber: use uint64_t for fiber IDs 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! See 5 comments below. > diff --git a/changelogs/unreleased/gh-5846-cformat.md b/changelogs/unreleased/gh-5846-cformat.md > new file mode 100644 > index 000000000..027de35d7 > --- /dev/null > +++ b/changelogs/unreleased/gh-5846-cformat.md > @@ -0,0 +1,12 @@ > +## bugfix/core > + * Fixed wrong type specificator when printing fiber state > + change which lead to negative fiber's ID logging. > + > + For exmaple 1. exmaple -> example. > + ``` > + main/-244760339/cartridge.failover.task I> Instance state changed > + ``` > + instead of proper > + ``` > + main/4050206957/cartridge.failover.task I> Instance state changed > + ``` 2. You need to give a link to the issue here in a form 'gh-####'. > diff --git a/changelogs/unreleased/gh-5846-fiber-id.md b/changelogs/unreleased/gh-5846-fiber-id.md > new file mode 100644 > index 000000000..b645da849 > --- /dev/null > +++ b/changelogs/unreleased/gh-5846-fiber-id.md > @@ -0,0 +1,4 @@ > +## feature/core > + * Fiber IDs are switched to monotonically increasing unsigned 8 byte > + integers so that there won't be IDs wrapping anymore. This allows > + to detect fiber's precedence by their IDs if needed. 3. This is a bugfix, not a feature. Please, keep it in the bugfix changelog file. > diff --git a/src/lib/core/say.c b/src/lib/core/say.c > index cbd10e107..5307767b5 100644 > --- a/src/lib/core/say.c > +++ b/src/lib/core/say.c > @@ -792,8 +792,9 @@ say_format_plain_tail(char *buf, int len, int level, const char *filename, > if (cord) { > SNPRINT(total, snprintf, buf, len, " %s", cord->name); > if (fiber() && fiber()->fid != FIBER_ID_SCHED) { > - SNPRINT(total, snprintf, buf, len, "/%i/%s", > - fiber()->fid, fiber_name(fiber())); > + SNPRINT(total, snprintf, buf, len, "/%lld/%s", 4. This is llu, not lld, is it? Because FID is uint64_t. I see you even use llu in the other places for FID. Lets be consistent. Either you use int64_t fid and lld in the formats, or you use uint64_t and llu in the formats. > diff --git a/src/lua/fiber.c b/src/lua/fiber.c > index 02ec3d158..c792bf385 100644 > --- a/src/lua/fiber.c > +++ b/src/lua/fiber.c > @@ -155,11 +155,11 @@ lbox_pushfiber(struct lua_State *L, int fid) > static struct fiber * > lbox_checkfiber(struct lua_State *L, int index) > { > - uint32_t fid; > + uint64_t fid; > if (lua_type(L, index) == LUA_TNUMBER) { > - fid = lua_tonumber(L, index); > + fid = luaL_touint64(L, index); > } else { > - fid = *(uint32_t *) luaL_checkudata(L, index, fiberlib_name); > + fid = *(uint64_t *) luaL_checkudata(L, index, fiberlib_name); 5. Please, drop the whitespace after the type cast alongside. The same in the block below. > } > struct fiber *f = fiber_find(fid); > if (f == NULL) > @@ -170,12 +170,12 @@ lbox_checkfiber(struct lua_State *L, int index) > static int > lbox_fiber_id(struct lua_State *L) > { > - uint32_t fid; > + uint64_t fid; > if (lua_gettop(L) == 0) > fid = fiber()->fid; > else > - fid = *(uint32_t *) luaL_checkudata(L, 1, fiberlib_name); > - lua_pushinteger(L, fid); > + fid = *(uint64_t *) luaL_checkudata(L, 1, fiberlib_name); > + luaL_pushuint64(L, fid); > return 1; > }