Discussion:
[leveldb] CompactRange does not remove old values?
Aman Gupta
2017-03-01 15:56:21 UTC
Permalink
I have a leveldb database that I regularly add and remove keys from.
Occasionally, I run `CompactRange()` to reclaim space, but I've noticed
that even after a full manual compaction, `leveldbutil dump` shows old
values for keys still exist..

So for instance, after a `CompactRange(NULL, NULL)`, I see in the LOG:

compacted to: files[ 0 0 0 125 0 0 0 ]


But then leveldbutil shows:

'b1488250800' @ 23057457 : del => ''
'b1488250800' @ 169587 : val => ......
'b1488250800' @ 23116237 : del => ''
'b1488250800' @ 202418 : val => ......


Is this a bug in the compaction logic, or am I misunderstanding how
compaction is supposed to work?
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Aman Gupta
2017-03-01 17:47:16 UTC
Permalink
You have seven Levels but your data has filled upto L3 only.
1. The delete markers cannot be deleted if there are keys in lower levels.
2. The delete markers cannot be deleted if there are active snapshots that
makes some of these keys visible in the snapshot
are u using snapshots?
I am, and it appears I may not have been releasing them correctly. I'll see
if I can recreate the issue when no snapshots are active.

Thanks for the pointer in the right direction.
Post by Aman Gupta
I have a leveldb database that I regularly add and remove keys from.
Occasionally, I run `CompactRange()` to reclaim space, but I've noticed
that even after a full manual compaction, `leveldbutil dump` shows old
values for keys still exist..
compacted to: files[ 0 0 0 125 0 0 0 ]
Is this a bug in the compaction logic, or am I misunderstanding how
compaction is supposed to work?
--
You received this message because you are subscribed to the Google Groups
"leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...