Run runs compact job
()
| 64 | |
| 65 | // Run runs compact job |
| 66 | func (c *compactJob) Run() error { |
| 67 | startTime := time.Now() |
| 68 | metrics.CompactStatistics.Compacting.WithTagValues(c.compactType).Incr() |
| 69 | defer func() { |
| 70 | metrics.CompactStatistics.Compacting.WithTagValues(c.compactType).Decr() |
| 71 | metrics.CompactStatistics.Duration.WithTagValues(c.compactType).UpdateSince(startTime) |
| 72 | }() |
| 73 | compaction := c.state.compaction |
| 74 | switch { |
| 75 | case c.rollup == nil && compaction.IsTrivialMove(): |
| 76 | // compact job can move file |
| 77 | c.moveCompaction() |
| 78 | default: |
| 79 | if err := c.mergeCompaction(); err != nil { |
| 80 | metrics.CompactStatistics.Failure.WithTagValues(c.compactType).Incr() |
| 81 | return err |
| 82 | } |
| 83 | } |
| 84 | return nil |
| 85 | } |
| 86 | |
| 87 | // moveCompaction moves low level file to up level, just does metadata change |
| 88 | func (c *compactJob) moveCompaction() { |
nothing calls this directly
no test coverage detected