Skip to content

i1.33.9

@abhijat abhijat tagged this 25 Sep 08:30
* core: Allow defragmentation of qlist

The defragmentation of qlist involves iterating over each node, checking
if the page containing it is underutilized, and if so moving the object
to the malloc page and freeing the original.

To do this we do not use the iterator API which is built to look at
elements within each node and thus it has to decompress and recompress
data.

Instead we iterate over nodes directly starting at the head node, and
for each node:

* if it is raw list pack allocate a new listpack, memcpy data and move
  node pointer
* if it is compressed or plain string allocate a pointer, memcpy and
  move pointer

The original listpack or node is freed and the number of reallocations
performed is returned.

Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>
Assets 2
Loading