[Tarantool-patches] [PATCH] memtx: allow quota overuse for truncation

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Dec 20 19:13:36 MSK 2020


>     > 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
>  


More information about the Tarantool-patches mailing list