Skip to content

fix: Export exportTSInSecs field in TSDB identifier to make sure correct gap calculation #13116

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

Merged
merged 5 commits into from
Jan 29, 2025

Conversation

honganan
Copy link
Contributor

@honganan honganan commented Jun 4, 2024

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #13115

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR
@honganan honganan requested a review from a team as a code owner June 4, 2024 10:30
@chaudum
Copy link
Contributor

chaudum commented Jul 26, 2024

@honganan Could you explain why making the field exported would change any of the logic and fix anything?

@honganan
Copy link
Contributor Author

@honganan Could you explain why making the field exported would change any of the logic and fix anything?

@chaudum
In summary, the Meta(now in loki/pkg/storage/stores/shipper/bloomshipper/client.go) structure contains a Sources []tsdb.SingleTenantTSDBIdentifier field, and within tsdb.SingleTenantTSDBIdentifier, there is an exportTSInSecs field. When Meta is serialized and written to OSS storage, the exportTSInSecs field is being set to its default value, false, which is not the expected behavior. It should retain its actual value; otherwise, this will lead to issues during subsequent gap calculations.

Sources []tsdb.SingleTenantTSDBIdentifier

@chaudum
Copy link
Contributor

chaudum commented Jan 24, 2025

@honganan Can you add a test case to assert that SingleTenantTSDBIdentifier.Name() is equal before and after a json serialisation roundtrip (json.Marshal + json.Unmarshal).

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 24, 2025
@honganan
Copy link
Contributor Author

@honganan Can you add a test case to assert that SingleTenantTSDBIdentifier.Name() is equal before and after a json serialisation roundtrip (json.Marshal + json.Unmarshal).

Ok, Added it.

@chaudum chaudum enabled auto-merge (squash) January 29, 2025 08:26
@chaudum chaudum merged commit 99d9f1c into grafana:main Jan 29, 2025
58 checks passed
loki-gh-app bot pushed a commit that referenced this pull request Jan 29, 2025
…rrect gap calculation (#13116)

 In summary, the Meta(now in loki/pkg/storage/stores/shipper/bloomshipper/client.go) structure contains a Sources []tsdb.SingleTenantTSDBIdentifier field, and within tsdb.SingleTenantTSDBIdentifier, there is an exportTSInSecs field. When Meta is serialized and written to OSS storage, the exportTSInSecs field is being set to its default value, false, which is not the expected behavior. It should retain its actual value; otherwise, this will lead to issues during subsequent gap calculations.

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
(cherry picked from commit 99d9f1c)
loki-gh-app bot pushed a commit that referenced this pull request Jan 29, 2025
…rrect gap calculation (#13116)

 In summary, the Meta(now in loki/pkg/storage/stores/shipper/bloomshipper/client.go) structure contains a Sources []tsdb.SingleTenantTSDBIdentifier field, and within tsdb.SingleTenantTSDBIdentifier, there is an exportTSInSecs field. When Meta is serialized and written to OSS storage, the exportTSInSecs field is being set to its default value, false, which is not the expected behavior. It should retain its actual value; otherwise, this will lead to issues during subsequent gap calculations.

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
(cherry picked from commit 99d9f1c)
salvacorts pushed a commit that referenced this pull request Feb 12, 2025
…rrect gap calculation (#13116)

 In summary, the Meta(now in loki/pkg/storage/stores/shipper/bloomshipper/client.go) structure contains a Sources []tsdb.SingleTenantTSDBIdentifier field, and within tsdb.SingleTenantTSDBIdentifier, there is an exportTSInSecs field. When Meta is serialized and written to OSS storage, the exportTSInSecs field is being set to its default value, false, which is not the expected behavior. It should retain its actual value; otherwise, this will lead to issues during subsequent gap calculations.

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants