Skip to content

compact: Make sure sources are removed after compaction.#258

Merged
bwplotka merged 2 commits into
masterfrom
compact-fix-v2
Mar 27, 2018
Merged

compact: Make sure sources are removed after compaction.#258
bwplotka merged 2 commits into
masterfrom
compact-fix-v2

Conversation

@bwplotka
Copy link
Copy Markdown
Member

Fixes #246

Signed-off-by: Bartek Plotka bwplotka@gmail.com

Comment thread pkg/compact/compact.go Outdated
// 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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to create idStr, just write ulid.Parse(filepath.Base(b))

Comment thread pkg/compact/compact.go Outdated

// 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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the keys here will be somewhat confusing in practice. old_block and replacement_block might be clearer.

Comment thread pkg/compact/compact.go
}

// Spawn a new context so we always delete a block in full on shutdown.
delCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 – though I notice we potentially abort upload of the compacted block but don't clean up remainers if we did that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean if we upload the result block only partially because the context got canceled. But objstore.UploadDir already does this I remembered.

@fabxc
Copy link
Copy Markdown
Collaborator

fabxc commented Mar 27, 2018

👍

@bwplotka bwplotka changed the base branch from fix-comp-dups to master March 27, 2018 13:23
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
@bwplotka bwplotka merged commit 94e26c6 into master Mar 27, 2018
@bwplotka bwplotka deleted the compact-fix-v2 branch March 27, 2018 13:34
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/thanos that referenced this pull request Dec 16, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants