fix: old tsl files should be compacted without new writes (#22006)

* fix: old tsl files should be compacted wihout new writes

* chore: update changelog.md
pull/21999/head
Sam Arnold 2021-08-02 13:36:23 -04:00 committed by GitHub
parent 12f361062d
commit e62efaf751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,7 @@
- [#21863](https://github.com/influxdata/influxdb/pull/21863): fix: export example and fix adjacent shards
- [#21934](https://github.com/influxdata/influxdb/pull/21934): chore: use community maintained golang-jwt
- [#21943](https://github.com/influxdata/influxdb/pull/21943): fix: tsi index should compact old or too-large log files
- [#22006](https://github.com/influxdata/influxdb/pull/22006): fix: old tsl files should be compacted without new writes
- [#21947](https://github.com/influxdata/influxdb/pull/21947): fix: prevent silently dropped writes with overlapping shards
- [#21978](https://github.com/influxdata/influxdb/pull/21978): fix: restore portable backup bug

View File

@ -475,6 +475,7 @@ func (p *Partition) prependActiveLogFile() error {
manifestSize, err := p.Manifest().Write()
if err != nil {
// TODO: Close index if write fails.
p.logger.Error("manifest write failed, index is potentially damaged", zap.Error(err))
return err
}
p.manifestSize = manifestSize
@ -959,6 +960,13 @@ func (p *Partition) compact() {
fs := p.retainFileSet()
defer fs.Release()
// check if the current active log file should be rolled
if p.needsLogCompaction() {
if err := p.prependActiveLogFile(); err != nil {
p.logger.Error("failed to retire active log file", zap.Error(err))
}
}
// compact any non-active log files first
for _, f := range p.fileSet.files {
if f.Level() == 0 {