Touch causes bucket fragmentation


#1

Hello,
I am running Couchbase 2.0.1 on a Windows 2012 server. This is a single-node cluster in a non-critical environment (mostly used as a speed-up for another server). Our only bucket now has about 700k items and bound to grow to a few millions over the upcoming months. New data is uploaded regularly and all items have a TTL of 5 days. Every night, another server goes through a list of all items and issues a touch operation on items that need to live longer. My concern is that doing this process (touching the majority of items to renew their TTL to 5 days) causes massive fragmentation in the bucket.
The actual timing creates enough room for automatic compaction to run and complete before we come back to work the next morning, but I fear this will not be the case for very long.
Is there any reason why a touch operation will create fragmentation? Is there any way around this?
Thx!


#2

This is because we currently rewrite the value when the expiration time is updated. We have a bug filed for this issue here.
http://www.couchbase.com/issues/browse/MB-6981
I’ll see if I can get it into the next maintenance release, but a workaround would be to spread out the touch calls. So maybe you can touch half the keys at midnight and the other half at 3AM.