Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store-gateway: Add no-compact column on store-gateway/tenants admin UI #6848

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

ying-jeanne
Copy link
Contributor

@ying-jeanne ying-jeanne commented Dec 7, 2023

What this PR does

This PR introduces a new filter 'no-compact' in the admin UI for block filtering. Currently, we have various filters available for markers, but this addition extends functionality by enabling the display of blocks marked with 'no-compact'. Subsequent PRs will build upon this enhancement to provide users with the capability to mark blocks directly through the UI instead of CLI.

Test in local, how it looks like on UI
Screenshot 2023-12-07 at 19 16 05

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • na Tests updated.
  • na Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • na about-versioning.md updated with experimental features.

@ying-jeanne ying-jeanne changed the title Enhance: add no-compact filter on store-gateway/tenants endpoint Enhance: Add no-compact filter on store-gateway/tenants endpoint Dec 7, 2023
@@ -79,6 +82,14 @@
{{ end }}
</td>
{{ end }}
{{ if $page.ShowNoCompact }}
Copy link
Member

@pstibrany pstibrany Dec 7, 2023

Choose a reason for hiding this comment

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

Let's always show no compact markers when listing blocks via web.

}
}

metas, err = fetchMetas(ctx, bkt, metaPaths)
return metas, deletionTimes, err
return metas, deletionTimes, noCompactBlocks, err
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to fetch "reasons" and timestamps from no-compact markers, and return those.

@ying-jeanne ying-jeanne force-pushed the mark-no-compact branch 5 times, most recently from c12106b to cf791b9 Compare December 7, 2023 18:33
@ying-jeanne ying-jeanne changed the title Enhance: Add no-compact filter on store-gateway/tenants endpoint Store-gateway: Add no-compact filter on store-gateway/tenants endpoint Dec 7, 2023
@ying-jeanne ying-jeanne changed the title Store-gateway: Add no-compact filter on store-gateway/tenants endpoint Store-gateway: Add no-compact column on store-gateway/tenants admin UI Dec 7, 2023
@ying-jeanne ying-jeanne marked this pull request as ready for review December 8, 2023 09:38
@ying-jeanne ying-jeanne requested a review from a team as a code owner December 8, 2023 09:38
pkg/util/listblocks/listblocks.go Outdated Show resolved Hide resolved
pkg/util/listblocks/listblocks.go Outdated Show resolved Hide resolved
pkg/util/listblocks/listblocks.go Outdated Show resolved Hide resolved
return times, concurrency.ForEachJob(ctx, len(deletionMarkers), concurrencyLimit, func(ctx context.Context, idx int) error {
r, err := bkt.Get(ctx, deletionMarkers[idx])
return details, concurrency.ForEachJob(ctx, len(markers), concurrencyLimit, func(ctx context.Context, idx int) error {
r, err := bkt.Get(ctx, markers[idx])
Copy link
Contributor

Choose a reason for hiding this comment

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

can we reuse block.ReadMarker()? it looks like it's doing pretty much the same job as here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the function was there, i didn't look into make it different because of the change size, it is not really relevant to the PR title. I see the difference between listblocks and other cases we use ReadMarker, is that here we do execute the read in concurrency. I would prefer not to change that in this PR, if possible it could be a good general refectory task for following.

pkg/storage/tsdb/block/markers.go Outdated Show resolved Hide resolved
pkg/storegateway/gateway_blocks_http.go Outdated Show resolved Hide resolved
pkg/storegateway/gateway_blocks_http.go Outdated Show resolved Hide resolved
@dimitarvdimitrov dimitarvdimitrov enabled auto-merge (squash) December 8, 2023 17:21
@dimitarvdimitrov dimitarvdimitrov merged commit 6453122 into main Dec 8, 2023
28 checks passed
@dimitarvdimitrov dimitarvdimitrov deleted the mark-no-compact branch December 8, 2023 17:26
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Left some post-merge comments.

}

const concurrencyLimit = 32

func fetchDeletionTimes(ctx context.Context, bkt objstore.BucketReader, deletionMarkers []string) (map[ulid.ULID]time.Time, error) {
func fetchMarkerDetails[MARKER_TYPE block.Marker](ctx context.Context, bkt objstore.BucketReader, markers []string) (map[ulid.ULID]MARKER_TYPE, error) {
Copy link
Member

Choose a reason for hiding this comment

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

All generic types are "types", there's no need to include that in the name. I'd suggest to shorten MARKER_TYPE to just M.

@@ -149,10 +159,9 @@ func (s *StoreGateway) BlocksHandler(w http.ResponseWriter, req *http.Request) {
}, blocksPageTemplate, req)
}

func formatTimeIfNotZero(t time.Time, format string) string {
if t.IsZero() {
func formatTimeIfNotZero(t int64, format string) string {
Copy link
Member

Choose a reason for hiding this comment

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

We should use strong types instead of "integers" for times. Perhaps we could use *time.Time in richMeta?

Copy link
Member

Choose a reason for hiding this comment

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

See #6883

}
}

noCompactDetails, err = fetchMarkerDetails[block.NoCompactMark](ctx, bkt, noCompactMarkerFiles)
Copy link
Member

Choose a reason for hiding this comment

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

We should only load no-compact markers when they are displayed.

In store-gateway UI, I suggested to always display them, but in listblocks we could have provided an option instead.

@@ -140,7 +141,7 @@ func printMetas(metas map[ulid.ULID]*block.Meta, deletedTimes map[ulid.ULID]time
fmt.Fprintln(tabber)

for _, b := range blocks {
if !cfg.showDeleted && !deletedTimes[b.ULID].IsZero() {
if !cfg.showDeleted && deleteMarkerDetails[b.ULID].DeletionTime != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

We could change DeletionTime to time.Time and provide correct marshal/unmarshal functions.

Comment on lines +166 to +172
if val, ok := noCompactMarkerDetails[b.ULID]; ok {
fmt.Fprintf(tabber, "%v\t", []string{
fmt.Sprintf("Time: %s", time.Unix(val.NoCompactTime, 0).UTC().Format(time.RFC3339)),
fmt.Sprintf("Reason: %s", val.Reason)})
} else {
fmt.Fprintf(tabber, "\t")
}
Copy link
Member

Choose a reason for hiding this comment

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

What does the output for this look like?

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.

3 participants