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().
Showing
- doc/user/stored-programs.xml 19 additions, 2 deletionsdoc/user/stored-programs.xml
- mod/box/box.lua 5 additions, 5 deletionsmod/box/box.lua
- mod/box/box_lua.m 56 additions, 0 deletionsmod/box/box_lua.m
- test/box/lua.result 80 additions, 0 deletionstest/box/lua.result
- test/box/lua.test 20 additions, 0 deletionstest/box/lua.test
- test/box_big/tree_pk_multipart.result 11 additions, 0 deletionstest/box_big/tree_pk_multipart.result
- test/box_big/tree_pk_multipart.test 3 additions, 0 deletionstest/box_big/tree_pk_multipart.test
- test/connector_c/init.lua 0 additions, 0 deletionstest/connector_c/init.lua
- test/connector_c/suite.ini 0 additions, 1 deletiontest/connector_c/suite.ini
Loading
Please register or sign in to comment