Skip to content

[tools] add flag for uploading compacted blocks to bucket upload-blocks#8359

Merged
yeya24 merged 3 commits intothanos-io:mainfrom
jdgeisler:thanos-tools-upload-compacted-blocks
Jul 24, 2025
Merged

[tools] add flag for uploading compacted blocks to bucket upload-blocks#8359
yeya24 merged 3 commits intothanos-io:mainfrom
jdgeisler:thanos-tools-upload-compacted-blocks

Conversation

@jdgeisler
Copy link
Contributor

@jdgeisler jdgeisler commented Jul 4, 2025

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Resolves #8358

This is adding the flag shipper.upload-compacted to enable uploading compacted blocks using thanos tools. This is the same approach used for the thanos-sidecar already.

This flag is then used for upload-blocks in the shipper to set shipper.WithUploadCompacted.

Verification

I have successfully tested this locally.

Logs without the flag set. We can see the compacted blocks are skipped over.

tools bucket upload-blocks \
  --objstore.config='{"type": "s3", "prefix": "thanos-receive/tenant/dev-loadtest-main", "config": {"bucket": "dev-loadtest-main-thanos", "endpoint": "s3.us-west-2.amazonaws.com", "region": "us-west-2"}}' \
  --path="./blocks" \
  --label=tenant_id=\"loadtest-main\"
ts=2025-07-03T21:38:42.703124Z caller=factory.go:54 level=info msg="loading bucket configuration"
ts=2025-07-03T21:38:42.752759Z caller=tools_bucket.go:1521 level=info msg="synced blocks" uploaded=0
ts=2025-07-03T21:38:42.752857Z caller=main.go:174 level=info msg=exiting

Logs with the flag set. The compacted blocks are now uploaded.

tools bucket upload-blocks \
  --objstore.config='{"type": "s3", "prefix": "thanos-receive/tenant/dev-loadtest-main", "config": {"bucket": "dev-loadtest-main-thanos", "endpoint": "s3.us-west-2.amazonaws.com", "region": "us-west-2"}}' \
  --path="./blocks" \
  --label=tenant_id=\"loadtest-main\" \
  --shipper.upload-compacted
ts=2025-07-03T21:33:25.527097Z caller=factory.go:54 level=info msg="loading bucket configuration"
ts=2025-07-03T21:33:25.531647Z caller=shipper.go:307 level=info msg="no meta file found, creating empty meta data to write later"
ts=2025-07-03T21:33:25.848786Z caller=shipper.go:273 level=info msg="gathering all existing blocks from the remote bucket for check" id=01JZ91KRZ84JWD4X6096T474NQ
ts=2025-07-03T21:37:27.247279Z caller=shipper.go:432 level=info msg="upload new block" id=01JZ91KRZ84JWD4X6096T474NQ
ts=2025-07-03T21:37:27.940023Z caller=shipper.go:432 level=info msg="upload new block"

@jdgeisler jdgeisler changed the title add flag for uploading compacted blocks to thanos tools [Tools] add flag for uploading compacted blocks to bucket upload-blocks Jul 4, 2025
@jdgeisler jdgeisler changed the title [Tools] add flag for uploading compacted blocks to bucket upload-blocks [tools] add flag for uploading compacted blocks to bucket upload-blocks Jul 4, 2025
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Jul 4, 2025
yeya24
yeya24 previously approved these changes Jul 7, 2025
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks. This change makes sense to me

Signed-off-by: James Geisler <geislerjamesd@gmail.com>
Signed-off-by: James Geisler <geislerjamesd@gmail.com>
Signed-off-by: James Geisler <geislerjamesd@gmail.com>
@jdgeisler jdgeisler force-pushed the thanos-tools-upload-compacted-blocks branch from d8950b1 to b13e308 Compare July 23, 2025 15:42
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks. Docs failure unrelated. Merging now

@yeya24 yeya24 merged commit be2f408 into thanos-io:main Jul 24, 2025
21 of 22 checks passed
Naman-B-Parlecha pushed a commit to Naman-B-Parlecha/thanos that referenced this pull request Jul 29, 2025
…ks (thanos-io#8359)

* add flag for uploading compacted blocks to thanos tools

Signed-off-by: James Geisler <geislerjamesd@gmail.com>

* update changelog

Signed-off-by: James Geisler <geislerjamesd@gmail.com>

* fix doc check

Signed-off-by: James Geisler <geislerjamesd@gmail.com>

---------

Signed-off-by: James Geisler <geislerjamesd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support uploading compacted blocks for thanos tools bucket upload-blocks

2 participants