From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 3B9CD45C304 for ; Sun, 20 Dec 2020 19:13:38 +0300 (MSK) References: <20201211153724.7575-1-i.kosarev@tarantool.org> <3f0e3d86-17a4-9356-bffe-079308c46e05@tarantool.org> <1608162239.973321901@f42.i.mail.ru> From: Vladislav Shpilevoy Message-ID: <7787de2a-ba8d-66bd-d52b-c0c672d6e810@tarantool.org> Date: Sun, 20 Dec 2020 17:13:36 +0100 MIME-Version: 1.0 In-Reply-To: <1608162239.973321901@f42.i.mail.ru> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH] memtx: allow quota overuse for truncation List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ilya Kosarev Cc: tarantool-patches@dev.tarantool.org > > diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c > > index 73b4c450eb..cc431ea816 100644 > > --- a/src/box/memtx_space.c > > +++ b/src/box/memtx_space.c > > @@ -327,8 +327,9 @@ memtx_space_execute_replace(struct space *space, struct txn *txn, > > struct memtx_space *memtx_space = (struct memtx_space *)space; > > struct txn_stmt *stmt = txn_current_stmt(txn); > > enum dup_replace_mode mode = dup_replace_mode(request->type); > > - stmt->new_tuple = memtx_tuple_new(space->format, request->tuple, > > - request->tuple_end); > > + stmt->new_tuple = space->format->vtab.tuple_new(space->format, > > + request->tuple, > > + request->tuple_end); > > 2. Seems like an expensive change. You added +2 pointer > dereferences to a hot path. > > Last time when you worked on that I proposed to make space_truncate > use box.begin + quota disable + box_upsert + quota enable + commit. > So there are no yields between quota enable and disable. And no changes > in the code not related to truncation. Why didn't it work? > > That does work, but then it was also discussed that we should use only > huge slabs on disabled quota, so that quota can shrink back when freed. Such discussion results are far from something trivial and obvious. Please, specify that in the commit message and in the comments if possible. Also I don't understand why can't you do that on the slab arena level. Start allocating only 'huge' slabs if the quota is full, but disabled. > It also requires specific freeing for those tuples, that is why both new() and > delete() are now used from vtab, which has specific version for truncate space. Why do you need special freeing? memtx_tuple_delete() does not allocate anything. > There is an option to use only specific delete() from vtab and for allocation > patch space_truncate() instead of new(), although it looks more strange. Didn't understand what you mean. > > > > if (stmt->new_tuple == NULL) > > return -1; > > tuple_ref(stmt->new_tuple); > >   >   > -- > Ilya Kosarev >