vinyl: decrease usage of vy_mem_older_lsn
Do not call vy_mem_older_lsn on each UPSERT commit. Older lsn statement is used to squash big count of upserts and to turn UPSERT into REPLACE, if the older statement has appeared to be not UPSERT. But n_upserts could be calculated on prepare phase almost free, because the bps has method bps_insert_get_iterator, which returns iterator to the inserted statement. We can move this iterator forward to the older lsn without searching in the tree and update n_upserts. On a commit phase we can get the n_upserts, calculated on a prepare phase, and call vy_mem_older_lsn only if there is a sense to optimize the UPSERT. Closes #1988
Showing
- src/box/vinyl.c 112 additions, 41 deletionssrc/box/vinyl.c
- src/box/vy_mem.c 64 additions, 0 deletionssrc/box/vy_mem.c
- src/box/vy_mem.h 12 additions, 0 deletionssrc/box/vy_mem.h
- src/box/vy_stmt.h 8 additions, 0 deletionssrc/box/vy_stmt.h
- test/vinyl/upsert.result 6 additions, 2 deletionstest/vinyl/upsert.result
- test/vinyl/upsert.test.lua 1 addition, 0 deletionstest/vinyl/upsert.test.lua
Loading
Please register or sign in to comment