Fix first block not getting purged when deleting series

pull/6486/head
Jason Wilder 2016-04-27 17:08:00 -06:00
parent 0157968633
commit 4e353867d5
1 changed files with 9 additions and 3 deletions

View File

@ -761,16 +761,22 @@ func (k *tsmKeyIterator) Next() bool {
}
}
// Only one block, just return early everything after is wasted work
if len(k.blocks) == 1 {
// No blocks left, we're done
if len(k.blocks) == 0 {
return false
}
// Only one block and no tombstoned values, just return early everything after is wasted work
if len(k.blocks) == 1 && len(k.blocks[0].tombstones) == 0 {
return true
}
// If we have more than one block or any partially tombstoned blocks, we many need to dedup
var dedup bool
dedup := len(k.blocks[0].tombstones) > 0
if len(k.blocks) > 1 {
dedup = len(k.blocks[0].tombstones) > 0
// Quickly scan each block to see if any overlap with the prior block, if they overlap then
// we need to dedup as there may be duplicate points now
for i := 1; !dedup && i < len(k.blocks); i++ {