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

Bloomshipper: Use model.Time in MetaRef and BlockRef #11566

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Jan 2, 2024

What this PR does / why we need it:

The Ref of MetaRef and BlockRef do have start and end timestamps, which are of type int64.
This however, can lead to the problem that different components might use different precisions (s, ms, ns) for these timestamps.

This PR changes the current implementation of the bloom shipper to use ms precision timestamps (using model.Time) instead of s, to match the behaviour that we have to encode ChunkRefs to object store keys.

Copy link
Contributor

github-actions bot commented Jan 2, 2024

Trivy scan found the following vulnerabilities:

  • HIGH, Target: docker.io/grafana/loki:main-76bf505 (alpine 3.18.4), Type: alpine openssl: Incorrect cipher key and IV length processing in libcrypto3 v3.1.3-r0. Fixed in v3.1.4-r0
  • HIGH, Target: docker.io/grafana/loki:main-76bf505 (alpine 3.18.4), Type: alpine openssl: Incorrect cipher key and IV length processing in libssl3 v3.1.3-r0. Fixed in v3.1.4-r0
    \nTo see more details on these vulnerabilities, and how/where to fix them, please run docker build -t grafana/loki:main-76bf505 -f cmd/loki/Dockerfile .
    trivy i grafana/loki:main-76bf505 on your branch. If these were not introduced by your PR, please considering fixing them in via a subsequent PR. Thanks!

@@ -33,20 +33,28 @@ type Ref struct {
TenantID string
TableName string
MinFingerprint, MaxFingerprint uint64
StartTimestamp, EndTimestamp int64
StartTimestamp, EndTimestamp int64 // must be millisecond precision timestamp aka model.Time
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would make even more sense to use model.Time type.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree 👍

Comment on lines +475 to +476
MinFingerprint: job.minFp,
MaxFingerprint: job.maxFp,
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't this complain? min/maxFp are model.Fingerprint

StartTimestamp int64
EndTimestamp int64
TenantID string
MinFingerprint, MaxFingerprint model.Fingerprint
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's good to use model.Fingerprint here instead of uint64

If you are changing fp here, maybe change above in Ref struct too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can change it in the Ref as well. I would create a separate PR for that, though.

@chaudum chaudum changed the title Bloomshipper: Use millisecond precision for encoding timestamp into Ref Bloomshipper: Use model.Time in MetaRef and BlockRef Jan 2, 2024
@chaudum chaudum marked this pull request as ready for review January 2, 2024 16:06
@chaudum chaudum requested a review from a team as a code owner January 2, 2024 16:06
Copy link
Contributor

@poyzannur poyzannur left a comment

Choose a reason for hiding this comment

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

lgtm

The `Ref` of `MetaRef` and `BlockRef` do have start and end timestamps,
which are of type `int64`.
This however, can lead to the problem that different components might
use different precisions (`s`, `ms`, `ns`) for these timestamps.

This PR changes the current implementation of the bloom shipper to use
`ms` precision timestamps (using `model.Time`) instead of `s`, to match
the behaviour that we have to encode ChunkRefs to object store keys.

Signed-off-by: Christian Haudum <[email protected]>
@chaudum chaudum force-pushed the chaudum/use-model-timestamp-in-bloom-shipper branch from 0d4d250 to 844563c Compare January 2, 2024 16:50
@chaudum chaudum enabled auto-merge (squash) January 2, 2024 16:50
@chaudum chaudum merged commit 0a0b7c8 into main Jan 2, 2024
7 checks passed
@chaudum chaudum deleted the chaudum/use-model-timestamp-in-bloom-shipper branch January 2, 2024 17:06
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
…1566)

The `Ref` of `MetaRef` and `BlockRef` do have start and end timestamps,
which are of type `int64`.
This however, can lead to the problem that different components might
use different precisions (`s`, `ms`, `ns`) for these timestamps.

This PR changes the current implementation of the bloom shipper to use
`ms` precision timestamps (using `model.Time`) instead of `s`, to match
the behaviour that we have to encode ChunkRefs to object store keys.

Signed-off-by: Christian Haudum <[email protected]>
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.

2 participants