Replace ziplist with listpack in quicklist#9740
Conversation
oranagra
left a comment
There was a problem hiding this comment.
@sundb thank you,
i guess we wanna see some benchmarks.
rdb loading to make sure we know the price
and commands to make sure there's no big regression.
i see rdb file format conversion test wasn't added, it is because the one added in #9357 covers it?
p.s. edited your top comment a bit (no need for backwards compatibility for DEBUG command).
1. Modify the timing of the call to lpShrinkToFit. 2. Remove the listpack overhead calculation in quicklistAllowInsert, and remove the `new_sz` assertion, since listpack will never be large than 1GB, and `sz` is also smalloc than `packed_threshold`(1GB). 3. Change type of `lpBytes` to `unsigned long long` to avoid overflow in 32bit.
4b82a0f to
6206d13
Compare
Co-authored-by: Oran Agra <[email protected]>
Co-authored-by: Oran Agra <[email protected]>
|
From the results, we can see that the performance of quicklist info
|
|
Following is the RDB load time test of Config: Test other info: Due to the physical memory limitation, when the
|
|
@redis/core-team this is the final step in getting rid of ziplists, it's basically more of the same of what we did for hashes and listpacks. |
yossigo
left a comment
There was a problem hiding this comment.
Approving the change, did not code review.
madolson
left a comment
There was a problem hiding this comment.
Approve at a high level.
soloestoy
left a comment
There was a problem hiding this comment.
Approve the change, did not code review line by line.
…ze to list_max_listpack_size
506cb6c to
562f31e
Compare
|
Good job @sundb! If this is the last usage of ziplist, can we now remove almost all of ziplist.c? It seems that only ziplistGet is used in the conversion. |
|
@zuiderkwast Only |
|
OK. I was thinking about deleting the dead code (ziplistInsert, etc. which is at least half of ziplist.c). I suppose instead we will delete ziplist.c in Redis 8 or 9(?) when we no longer support conversion from ziplist. |
|
@zuiderkwast It could be a long, long time, and I hate to see them at lcov with such low coverage. |
Part three of implementing redis#8702, following redis#8887 and redis#9366 . ## Description of the feature 1. Replace the ziplist container of quicklist with listpack. 2. Convert existing quicklist ziplists on RDB loading time. an O(n) operation. ## Interface changes 1. New `list-max-listpack-size` config is an alias for `list-max-ziplist-size`. 2. Replace `debug ziplist` command with `debug listpack`. ## Internal changes 1. Add `lpMerge` to merge two listpacks . (same as `ziplistMerge`) 2. Add `lpRepr` to print info of listpack which is used in debugCommand and `quicklistRepr`. (same as `ziplistRepr`) 3. Replace `QUICKLIST_NODE_CONTAINER_ZIPLIST` with `QUICKLIST_NODE_CONTAINER_PACKED`(following redis#9357 ). It represent that a quicklistNode is a packed node, as opposed to a plain node. 4. Remove `createZiplistObject` method, which is never used. 5. Calculate listpack entry size using overhead overestimation in `quicklistAllowInsert`. We prefer an overestimation, which would at worse lead to a few bytes below the lowest limit of 4k. ## Improvements 1. Calling `lpShrinkToFit` after converting Ziplist to listpack, which was missed at redis#9366. 2. Optimize `quicklistAppendPlainNode` to avoid memcpy data. ## Bugfix 1. Fix crash in `quicklistRepr` when ziplist is compressed, introduced from redis#9366. ## Test 1. Add unittest for `lpMerge`. 2. Modify the old quicklist ziplist corrupt dump test. Co-authored-by: Oran Agra <[email protected]>
Remove some dead code in object.c, ziplist is no longer used in 7.0 Some backgrounds: zipmap - hash: replaced by ziplist in redis#285 ziplist - hash: replaced by listpack in redis#8887 ziplist - zset: replaced by listpack in redis#9366 ziplist - list: replaced by quicklist (listpack) in redis#2143 / redis#9740
Remove some dead code in object.c, ziplist is no longer used in 7.0 Some backgrounds: zipmap - hash: replaced by ziplist in #285 ziplist - hash: replaced by listpack in #8887 ziplist - zset: replaced by listpack in #9366 ziplist - list: replaced by quicklist (listpack) in #2143 / #9740 Moved the location of ziplist.h in the server.c
Remove some dead code in object.c, ziplist is no longer used in 7.0 Some backgrounds: zipmap - hash: replaced by ziplist in redis#285 ziplist - hash: replaced by listpack in redis#8887 ziplist - zset: replaced by listpack in redis#9366 ziplist - list: replaced by quicklist (listpack) in redis#2143 / redis#9740 Moved the location of ziplist.h in the server.c
Part three of implementing #8702, following #8887 and #9366 .
Description of the feature
Interface changes
list-max-listpack-sizeconfig is an alias forlist-max-ziplist-size.debug ziplistcommand withdebug listpack.Internal changes
lpMergeto merge two listpacks . (same asziplistMerge)lpReprto print info of listpack which is used in debugCommand andquicklistRepr. (same asziplistRepr)QUICKLIST_NODE_CONTAINER_ZIPLISTwithQUICKLIST_NODE_CONTAINER_PACKED(following Add support for list type to store elements larger than 4GB #9357 ).It represent that a quicklistNode is a packed node, as opposed to a plain node.
createZiplistObjectmethod, which is never used.quicklistAllowInsert.We prefer an overestimation, which would at worse lead to a few bytes below the lowest limit of 4k.
Improvements
lpShrinkToFitafter converting Ziplist to listpack, which was missed at Replace all usage of ziplist with listpack for t_zset #9366.quicklistAppendPlainNodeto avoid memcpy data.Bugfix
quicklistReprwhen ziplist is compressed, introduced from Replace all usage of ziplist with listpack for t_zset #9366.Test
lpMerge.TODO