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

Replace TenantIndex, BlockMeta and CompactedBlockMeta with proto near-equivalents #4072

Merged
merged 71 commits into from
Oct 2, 2024

Conversation

zalegrala
Copy link
Contributor

@zalegrala zalegrala commented Sep 11, 2024

What this PR does:

Here we replace the TenantIndex, BlockMeta and CompactedBlockMeta with structs which are generated from proto. This allows us to convert the TenantIndex to proto-only without the translation between a backend struct and an internal struct, since the internal structs here are being replaced. The BlockMeta and CompactedBlockMeta remain json. We may consider replacing these with proto in the future.

The replacement structs are not identical. Of note, the BlockMeta struct has several fields which have no proto equivalent. In order to overcome this, several types have been defined in the proto as bytes, which allows the use of the customtype gogo proto option to point to a specific type. Those types must conform to a specific interface, and so methods have been added where necessary.

  • backend.DedicatedColumns updated to include proto marshal and unmarshal methods
  • backend.Encoding updated to include prto marshal and unmarshal methods
  • backend.BlockMeta has a few type changes
    • TotalObjects changes int -> int64
    • Size becomes a funcion and the old size is moved to Size_
    • CompactionLevel changes uint8 -> uint32
    • BloomShardCount changes uint16 -> uint32
    • ReplicationFactor changes uint8 -> uint32

A new UUID type has been added which is backed by the google UUID type and provide
the necessary interface for use with proto.

The TenantIndex is written both as proto and json, and read as protofirst with a fallback to json on error.

The BlockMeta and CompactedBlockMeta are written/read only as json.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@zalegrala zalegrala force-pushed the jsonpbTenantIndex branch 3 times, most recently from 513e33b to 3c10c0f Compare September 11, 2024 17:52
@zalegrala zalegrala changed the title wip: Replace TenantIndex, BlockMeta and CompactedBlockMeta with proto near-equivalents Replace TenantIndex, BlockMeta and CompactedBlockMeta with proto near-equivalents Sep 11, 2024
@zalegrala zalegrala force-pushed the jsonpbTenantIndex branch 2 times, most recently from f65adc7 to cc764f5 Compare September 13, 2024 20:50
@zalegrala zalegrala force-pushed the jsonpbTenantIndex branch 4 times, most recently from 5d44486 to c89cb07 Compare September 25, 2024 20:39
@zalegrala zalegrala marked this pull request as ready for review September 25, 2024 20:59
Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

I like where we ended up with this PR. The existing block meta.json and block state are unchanged, but we will get the index proto efficiency on the downstream components (frontend, querier). This PR looks like a lot, but 90% is fallout from the uuid and Size changes. The actual change is much smaller. 99% LGTM left a few q's and comments.

Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

Great work! Let's get the changelog entry and then merge.

@zalegrala zalegrala merged commit 884bbea into grafana:main Oct 2, 2024
16 checks passed
@zalegrala zalegrala deleted the jsonpbTenantIndex branch October 2, 2024 18:41
@zalegrala zalegrala mentioned this pull request Oct 15, 2024
3 tasks
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