compact: Make sure sources are removed after compaction.#258
Conversation
| // Eventually the block we just uploaded should get synced into the group again (including sync-delay). | ||
| for _, b := range plan { | ||
| idStr := filepath.Base(b) | ||
| id, err := ulid.Parse(idStr) |
There was a problem hiding this comment.
No need to create idStr, just write ulid.Parse(filepath.Base(b))
|
|
||
| // Spawn a new context so we always delete a block in full on shutdown. | ||
| delCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) | ||
| level.Info(cg.logger).Log("msg", "deleting compacted block", "block", id, "compacted", compID) |
There was a problem hiding this comment.
I think the keys here will be somewhat confusing in practice. old_block and replacement_block might be clearer.
| } | ||
|
|
||
| // Spawn a new context so we always delete a block in full on shutdown. | ||
| delCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) |
There was a problem hiding this comment.
👍 – though I notice we potentially abort upload of the compacted block but don't clean up remainers if we did that.
There was a problem hiding this comment.
what remainders? Do you mean doing that
?
for _, b := range plan {
id, err := ulid.Parse(filepath.Base(b))
if err != nil {
return compID, errors.Wrapf(err, "plan dir %s", b)
}
if err := os.RemoveAll(b); err != nil {
return compID, errors.Wrapf(err, "remove old block dir %s", id)
}
If we don't upload compacted blocks all if good I think - no need to delete anything. We will do another compaction
There was a problem hiding this comment.
I mean if we upload the result block only partially because the context got canceled. But objstore.UploadDir already does this I remembered.
5103382 to
eede36e
Compare
|
👍 |
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
eede36e to
272c975
Compare
* Konflux: reintroduce custom changes - multi-arch build on push - hermetic builds - correctly pre-fetching golang deps - build source image Signed-off-by: Jacob Baungard Hansen <jacobbaungard@redhat.com> * Konflux: also prefetch konflux dependencies Signed-off-by: Jacob Baungard Hansen <jacobbaungard@redhat.com> --------- Signed-off-by: Jacob Baungard Hansen <jacobbaungard@redhat.com>
Fixes #246
Signed-off-by: Bartek Plotka bwplotka@gmail.com