Skip to content

Commit

Permalink
[dbnode] Only extend reverse index retention up (#2745)
Browse files Browse the repository at this point in the history
  • Loading branch information
linasm authored Oct 15, 2020
1 parent 0a74633 commit 6573769
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/dbnode/storage/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,9 @@ func (i *nsIndex) SetExtendedRetentionPeriod(period time.Duration) {
i.state.Lock()
defer i.state.Unlock()

i.extendedRetentionPeriod = period
if period > i.extendedRetentionPeriod {
i.extendedRetentionPeriod = period
}
}

func (i *nsIndex) effectiveRetentionPeriodWithLock() time.Duration {
Expand Down
4 changes: 2 additions & 2 deletions src/dbnode/storage/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ func TestNamespaceIndexSetExtendedRetentionPeriod(t *testing.T) {
idx.SetExtendedRetentionPeriod(longerRetention)
assert.Equal(t, longerRetention, idx.effectiveRetentionPeriodWithLock())

shorterRetention := originalRetention - time.Minute
shorterRetention := longerRetention - time.Second
idx.SetExtendedRetentionPeriod(shorterRetention)
assert.Equal(t, originalRetention, idx.effectiveRetentionPeriodWithLock())
assert.Equal(t, longerRetention, idx.effectiveRetentionPeriodWithLock())
}

func verifyFlushForShards(
Expand Down

0 comments on commit 6573769

Please sign in to comment.