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 44E666EC40; Fri, 13 Aug 2021 02:03:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 44E666EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628809423; bh=rLLGV5fd/ujL9PthC7yuLuqnEAZsrNLlHZuaH6tz47Q=; 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=UdkT4LA+QwkGhQFyYXPnk3jNj3r5ypKa2mB8qOZ1NJx7bbN21OOxX8VT0dsIGFaKu bhJwvAQ3wYDfQuNWvUR0xdh9TKAB6N0CfdV9gsaD0/aaiMAG4cUkgBv156Hg0PRESx 9yEgtIKxkqIGDuzLHUYGpDSCnMmFKaK7tbwtPQOA= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (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 255916EC40 for ; Fri, 13 Aug 2021 02:03:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 255916EC40 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1mEJjg-00012Y-Pk; Fri, 13 Aug 2021 02:03:41 +0300 To: imun@tarantool.org, v.shpilevoy@tarantool.org References: Message-ID: Date: Fri, 13 Aug 2021 02:03:34 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD91BCCB18F2C129F87F36E61E9E4584E9D182A05F5380850401E61C93EF6590E6929A51227D0E469FB0E507AF79C412D3F0A5980AF777C7A7B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D6964C9E324ABA58EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063740CAE4B7CE19A94DEA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F26A0C82CC03A50BECBEE81B3525FBCFDCCC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F790063783E00425F71A4181389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637A9329C8D89988D4ED81D268191BDAD3DBD4B6F7A4D31EC0BEA7A3FFF5B025636D81D268191BDAD3D78DA827A17800CE7137687454284763FEC76A7562686271EEC990983EF5C03292E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3EBF4D8D28E8B690335872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505CB6318CA9025F8426DB3D91653E30048 X-C1DE0DAB: 0D63561A33F958A5D1D4521893CBD42EEF94B3361A63FF7323E4B1B021B705B1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA750E14360347543F58410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34ADE558D2B396DA7CDD2C0EA3B523E9E564F63DC1A9D9B76DD12F64D562059EF8404D53FC79B64A651D7E09C32AA3244C55E799075E62E8B37EAE4A91175B8A8C259227199D06760A83B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj0dLV0c3jbkyOFp4lKQZMmA== X-Mailru-Sender: B5B6A6EBBD94DAD86A422A53D9D37A7D514F13372DE208C8B66A22F7AAB3BD90CBCCD57F2E67AF481EC9E4A2C82A33BC8C24925A86E657CE0C70AEE3C9A96FBAB3D7EE8ED63280BE112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 4/7] box, datetime: messagepack support for datetime 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: Safin Timur via Tarantool-patches Reply-To: Safin Timur Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 13.08.2021 1:33, Timur Safin wrote: > Serialize datetime_t as newly introduced MP_EXT type. > It saves 1 required integer field and upto 2 optional > unsigned fields in very compact fashion. > - secs is required field; > - but nsec, offset are both optional; > > * json, yaml serialization formats, lua output mode > supported; > * exported symbols for datetime messagepack size calculations > so they are available for usage on Lua side. > > Part of #5941 > Part of #5946 > --- > extra/exports | 2 + > src/box/field_def.c | 35 +++--- > src/box/field_def.h | 1 + > src/box/lua/serialize_lua.c | 7 +- > src/box/msgpack.c | 7 +- > src/box/tuple_compare.cc | 20 ++++ > src/lib/core/CMakeLists.txt | 4 +- > src/lib/core/datetime.c | 9 ++ > src/lib/core/datetime.h | 20 ++++ > src/lib/core/mp_datetime.c | 189 ++++++++++++++++++++++++++++++ > src/lib/core/mp_datetime.h | 89 ++++++++++++++ > src/lib/core/mp_extension_types.h | 1 + > src/lib/mpstream/mpstream.c | 11 ++ > src/lib/mpstream/mpstream.h | 4 + > src/lua/msgpack.c | 12 ++ > src/lua/msgpackffi.lua | 18 +++ > src/lua/serializer.c | 4 + > src/lua/serializer.h | 2 + > src/lua/utils.c | 1 - Discovered the harder way (massive number of failing CI builds) that I've forgotten to update result samples for test/unit/datetime.c test. Now have updated this patch to include test/unit/datetime.result and have force pushed to the branch. > test/unit/datetime.c | 125 +++++++++++++++++++- > third_party/lua-cjson/lua_cjson.c | 8 ++ > third_party/lua-yaml/lyaml.cc | 6 +- > 22 files changed, 554 insertions(+), 21 deletions(-) > create mode 100644 src/lib/core/mp_datetime.c > create mode 100644 src/lib/core/mp_datetime.h > ================================================================== diff --git a/test/unit/datetime.result b/test/unit/datetime.result index 33997d9df..5f01c4344 100644 --- a/test/unit/datetime.result +++ b/test/unit/datetime.result @@ -1,4 +1,4 @@ -1..1 +1..4 1..355 ok 1 - correct parse_datetime return value for '2012-12-24 15:30Z' ok 2 - correct parse_datetime output seconds for '2012-12-24 15:30Z @@ -356,3 +356,116 @@ ok 354 - correct parse_datetime return value for '2012-12-24 15:30:00' ok 355 - reversible seconds via strftime for '2012-12-24 15:30:00 ok 1 - subtests + 1..15 + ok 1 - string '1970-01-01T02:00+02:00' expected, received '1970-01-01T02:00+02:00' + ok 2 - string '1970-01-01T01:30+01:30' expected, received '1970-01-01T01:30+01:30' + ok 3 - string '1970-01-01T01:00+01:00' expected, received '1970-01-01T01:00+01:00' + ok 4 - string '1970-01-01T00:01+00:01' expected, received '1970-01-01T00:01+00:01' + ok 5 - string '1970-01-01T00:00Z' expected, received '1970-01-01T00:00Z' + ok 6 - string '1969-12-31T23:59-00:01' expected, received '1969-12-31T23:59-00:01' + ok 7 - string '1969-12-31T23:00-01:00' expected, received '1969-12-31T23:00-01:00' + ok 8 - string '1969-12-31T22:30-01:30' expected, received '1969-12-31T22:30-01:30' + ok 9 - string '1969-12-31T22:00-02:00' expected, received '1969-12-31T22:00-02:00' + ok 10 - string '1970-01-01T00:00:00.123456789Z' expected, received '1970-01-01T00:00:00.123456789Z' + ok 11 - string '1970-01-01T00:00:00.123456Z' expected, received '1970-01-01T00:00:00.123456Z' + ok 12 - string '1970-01-01T00:00:00.123Z' expected, received '1970-01-01T00:00:00.123Z' + ok 13 - string '1973-11-29T21:33:09Z' expected, received '1973-11-29T21:33:09Z' + ok 14 - string '2013-10-28T17:51:56Z' expected, received '2013-10-28T17:51:56Z' + ok 15 - string '9999-12-31T23:59:59Z' expected, received '9999-12-31T23:59:59Z' +ok 2 - subtests + 1..85 + ok 1 - len 6, expected len 6 + ok 2 - mp_sizeof_datetime(6) == encoded length 6 + ok 3 - mp_decode_datetime() return code + ok 4 - mp_sizeof_uuid() == decoded length + ok 5 - datetime_compare(&date, &ret) + ok 6 - len 6, expected len 6 + ok 7 - mp_sizeof_datetime(6) == encoded length 6 + ok 8 - mp_decode_datetime() return code + ok 9 - mp_sizeof_uuid() == decoded length + ok 10 - datetime_compare(&date, &ret) + ok 11 - len 6, expected len 6 + ok 12 - mp_sizeof_datetime(6) == encoded length 6 + ok 13 - mp_decode_datetime() return code + ok 14 - mp_sizeof_uuid() == decoded length + ok 15 - datetime_compare(&date, &ret) + ok 16 - len 6, expected len 6 + ok 17 - mp_sizeof_datetime(6) == encoded length 6 + ok 18 - mp_decode_datetime() return code + ok 19 - mp_sizeof_uuid() == decoded length + ok 20 - datetime_compare(&date, &ret) + ok 21 - len 3, expected len 3 + ok 22 - mp_sizeof_datetime(3) == encoded length 3 + ok 23 - mp_decode_datetime() return code + ok 24 - mp_sizeof_uuid() == decoded length + ok 25 - datetime_compare(&date, &ret) + ok 26 - len 6, expected len 6 + ok 27 - mp_sizeof_datetime(6) == encoded length 6 + ok 28 - mp_decode_datetime() return code + ok 29 - mp_sizeof_uuid() == decoded length + ok 30 - datetime_compare(&date, &ret) + ok 31 - len 6, expected len 6 + ok 32 - mp_sizeof_datetime(6) == encoded length 6 + ok 33 - mp_decode_datetime() return code + ok 34 - mp_sizeof_uuid() == decoded length + ok 35 - datetime_compare(&date, &ret) + ok 36 - len 6, expected len 6 + ok 37 - mp_sizeof_datetime(6) == encoded length 6 + ok 38 - mp_decode_datetime() return code + ok 39 - mp_sizeof_uuid() == decoded length + ok 40 - datetime_compare(&date, &ret) + ok 41 - len 6, expected len 6 + ok 42 - mp_sizeof_datetime(6) == encoded length 6 + ok 43 - mp_decode_datetime() return code + ok 44 - mp_sizeof_uuid() == decoded length + ok 45 - datetime_compare(&date, &ret) + ok 46 - len 9, expected len 9 + ok 47 - mp_sizeof_datetime(9) == encoded length 9 + ok 48 - mp_decode_datetime() return code + ok 49 - mp_sizeof_uuid() == decoded length + ok 50 - datetime_compare(&date, &ret) + ok 51 - len 9, expected len 9 + ok 52 - mp_sizeof_datetime(9) == encoded length 9 + ok 53 - mp_decode_datetime() return code + ok 54 - mp_sizeof_uuid() == decoded length + ok 55 - datetime_compare(&date, &ret) + ok 56 - len 9, expected len 9 + ok 57 - mp_sizeof_datetime(9) == encoded length 9 + ok 58 - mp_decode_datetime() return code + ok 59 - mp_sizeof_uuid() == decoded length + ok 60 - datetime_compare(&date, &ret) + ok 61 - len 8, expected len 8 + ok 62 - mp_sizeof_datetime(8) == encoded length 8 + ok 63 - mp_decode_datetime() return code + ok 64 - mp_sizeof_uuid() == decoded length + ok 65 - datetime_compare(&date, &ret) + ok 66 - len 8, expected len 8 + ok 67 - mp_sizeof_datetime(8) == encoded length 8 + ok 68 - mp_decode_datetime() return code + ok 69 - mp_sizeof_uuid() == decoded length + ok 70 - datetime_compare(&date, &ret) + ok 71 - len 12, expected len 12 + ok 72 - mp_sizeof_datetime(12) == encoded length 12 + ok 73 - mp_decode_datetime() return code + ok 74 - mp_sizeof_uuid() == decoded length + ok 75 - datetime_compare(&date, &ret) + ok 76 - len 17, expected len 17 + ok 77 - mp_sizeof_datetime(17) == encoded length 17 + ok 78 - mp_decode_datetime() return code + ok 79 - mp_sizeof_uuid() == decoded length + ok 80 - datetime_compare(&date, &ret) + ok 81 - len 18, expected len 18 + ok 82 - mp_sizeof_datetime(18) == encoded length 18 + ok 83 - mp_decode_datetime() return code + ok 84 - mp_sizeof_uuid() == decoded length + ok 85 - datetime_compare(&date, &ret) +ok 3 - subtests + 1..5 + *** mp_print_test *** + ok 1 - correct mp_snprint size 17 with empty buffer + ok 2 - correct mp_snprint size 17 + ok 3 - correct mp_snprint result + ok 4 - correct mp_fprint size 17 + ok 5 - correct mp_fprint result 17 + *** mp_print_test: done *** +ok 4 - subtests ==================================================================