Skip to content
Snippets Groups Projects
Commit 39d92ffe authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files
Fix bug https://bugs.launchpad.net/tarantool/+bug/990728
"box.space:truncate() is a CPU hog".

The old truncate algorithm would restart iteration
from the beginning to delete every tuple.
With HASH index it was especially slow, since
it would have to skip more and more empty slots
to find a non-empty slot for deletion.

Rewrite the truncate() to walk linearly
over all elements and delete them.

This works both with HASH and TREE indexes.

On the same token make truncate multipart-index
aware (was missed in multipart-pk patch).
Add a test for that.

To work with multipart keys efficiently,
implement tuple:slice(). A slice returns
a linear set of fields from a tuple.
Convenient to retreive a multipart key or
tuple tail. Document tuple:slice().
parent baa03bea
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment