diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2021-01-06 02:22:18 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-06 02:22:18 -0800 |
| commit | 95ecf0c72f57f7b8cc96cb9099b79bc8ead9b80d (patch) | |
| tree | 713cb1fb4ef9ebcd78ed068bddc8116f9f4073cd | |
| parent | f5798389170f709c0e504ae5967dde32be61949f (diff) | |
| parent | 0764fccde7f88fb0d3b2b5824f03ed2cdc2ca42b (diff) | |
| download | seaweedfs-95ecf0c72f57f7b8cc96cb9099b79bc8ead9b80d.tar.xz seaweedfs-95ecf0c72f57f7b8cc96cb9099b79bc8ead9b80d.zip | |
Merge pull request #1735 from qieqieplus/rocksdb
ignore decode error for non-entry data
| -rw-r--r-- | weed/filer/rocksdb/rocksdb_ttl.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/weed/filer/rocksdb/rocksdb_ttl.go b/weed/filer/rocksdb/rocksdb_ttl.go index 98918b5d7..faed22310 100644 --- a/weed/filer/rocksdb/rocksdb_ttl.go +++ b/weed/filer/rocksdb/rocksdb_ttl.go @@ -23,17 +23,16 @@ func NewTTLFilter() gorocksdb.CompactionFilter { func (t *TTLFilter) Filter(level int, key, val []byte) (remove bool, newVal []byte) { // decode could be slow, causing write stall // level >0 sst can run compaction in parallel - if t.skipLevel0 && level == 0 { - return false, val - } - entry := filer.Entry{} - if err := entry.DecodeAttributesAndChunks(val); err == nil { - if entry.TtlSec == 0 || - entry.Crtime.Add(time.Duration(entry.TtlSec)*time.Second).After(time.Now()) { - return false, val + if !t.skipLevel0 || level > 0 { + entry := filer.Entry{} + if err := entry.DecodeAttributesAndChunks(val); err == nil { + if entry.TtlSec > 0 && + entry.Crtime.Add(time.Duration(entry.TtlSec)*time.Second).Before(time.Now()) { + return true, nil + } } } - return true, nil + return false, val } func (t *TTLFilter) Name() string { |
