From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 4828E42EF5C for ; Sat, 20 Jun 2020 21:01:30 +0300 (MSK) From: Vladislav Shpilevoy Date: Sat, 20 Jun 2020 20:01:27 +0200 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH small 1/1] test: don't use not aligned size for mempool List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, avtikhon@tarantool.org, kyukhin@tarantool.org Mempool expects aligned object size. Because it uses the free blocks to store metadata in them, in a struct mslab. Which needs alignment. Part of https://github.com/tarantool/tarantool/issues/5063 --- Branch: http://github.com/tarantool/small/tree/gerold103/tarantool/gh-5063-not-aligned-test Issue: https://github.com/tarantool/tarantool/issues/5063 test/mempool.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/mempool.c b/test/mempool.c index 298ba17..65eabaf 100644 --- a/test/mempool.c +++ b/test/mempool.c @@ -1,3 +1,4 @@ +#include "trivia/util.h" #include #include #include @@ -121,6 +122,12 @@ int main() objsize = rand() % OBJSIZE_MAX; if (objsize < OBJSIZE_MIN) objsize = OBJSIZE_MIN; + /* + * Mempool does not work with not aligned sizes. Because + * it utilizes the unused blocks for storing internal + * info, which needs alignment. + */ + objsize = small_align(objsize, alignof(uint64_t)); quota_init("a, UINT_MAX); -- 2.21.1 (Apple Git-122.3)