Skip to content

Fix: TTL query add metadata TTL and PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB.#13827

Merged
wu-sheng merged 4 commits into
apache:masterfrom
wankai123:banyandb-ttl
Apr 17, 2026
Merged

Fix: TTL query add metadata TTL and PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB.#13827
wu-sheng merged 4 commits into
apache:masterfrom
wankai123:banyandb-ttl

Conversation

@wankai123
Copy link
Copy Markdown
Member

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.

* Fix: PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB.
@wankai123 wankai123 added this to the 10.5.0 milestone Apr 17, 2026
@wankai123 wankai123 requested review from Copilot and wu-sheng April 17, 2026 01:27
@wankai123 wankai123 added the bug Something isn't working and you are sure it's a bug! label Apr 17, 2026
@wankai123 wankai123 changed the title * Fix: TTL query add metadata TTL and PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB. Fix: TTL query add metadata TTL and PersistentWorker used wrong TTL for metrics cache if the storage is BanyanDB. Apr 17, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances TTL reporting and TTL usage in metrics persistence, especially for BanyanDB, and adds E2E coverage to ensure TTL config can be queried and validated across storage backends.

Changes:

  • Extend TTL status output to include metadata TTL (alongside minute/hour/day metrics TTLs).
  • Introduce a per-metrics-model TTL hook (StorageTTLStatusQuery#getMetricsTTL(Model)) and use it when creating MetricsPersistentWorkers (fixing BanyanDB’s effective TTL handling for cache/expiration checks).
  • Add E2E verification for /status/config/ttl across multiple storage cases, with separate expected output for BanyanDB.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/e2e-v2/cases/storage/postgres/e2e.yaml Add TTL status endpoint verification to Postgres storage E2E.
test/e2e-v2/cases/storage/opensearch/e2e.yaml Add TTL status endpoint verification to OpenSearch storage E2E.
test/e2e-v2/cases/storage/mysql/e2e.yaml Add TTL status endpoint verification to MySQL storage E2E.
test/e2e-v2/cases/storage/es/e2e.yaml Add TTL status endpoint verification to ES storage E2E.
test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml Add additional trace verifications and TTL status endpoint verification for ES sharding case.
test/e2e-v2/cases/storage/es/es-sharding/docker-compose.yml Parameterize Elasticsearch image version with ${ES_VERSION}.
test/e2e-v2/cases/storage/banyandb/e2e.yaml Add TTL status endpoint verification for BanyanDB storage E2E.
test/e2e-v2/cases/storage/banyandb/docker-compose.yml Adjust BanyanDB case env to exercise effective TTL behavior (warm-stage-related).
test/e2e-v2/cases/storage/expected/ttl-config.yml New expected TTL JSON for non-BanyanDB storages (includes metadata TTL).
test/e2e-v2/cases/storage/expected/ttl-config-banyandb.yml New expected TTL JSON for BanyanDB (includes effective TTL values).
oap-server/server-storage-plugin/storage-banyandb-plugin/.../BanyanDBTTLStatusQuery.java Include metadata TTL in TTL definition; add per-model metrics TTL implementation for BanyanDB.
oap-server/server-core/.../storage/ttl/MetricsTTL.java Add metadata field to metrics TTL model.
oap-server/server-core/.../storage/ttl/TTLDefinition.java Include metadata TTL in string output.
oap-server/server-core/.../storage/ttl/StorageTTLStatusQuery.java Add default getMetricsTTL(Model) extension point.
oap-server/server-core/.../query/TTLStatusQuery.java Add getMetricsTTL(Model) that falls back to core TTL when storage doesn’t customize.
oap-server/server-core/.../analysis/worker/MetricsStreamProcessor.java Use TTLStatusQuery#getMetricsTTL(Model) when creating persistent workers; remove direct core TTL injection.
oap-server/server-core/.../CoreModuleProvider.java Stop setting metricsDataTTL directly into MetricsStreamProcessor (now resolved via TTLStatusQuery).
docs/en/changes/changes.md Add changelog entries for metadata TTL reporting and BanyanDB metrics cache TTL fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/e2e-v2/cases/storage/banyandb/docker-compose.yml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances TTL visibility and correctness across storage backends by exposing a dedicated metadata TTL in the TTL status API, and by ensuring metrics persistent workers use the effective per-model TTL (not the generic core TTL) when running on BanyanDB.

Changes:

  • Extend TTL reporting to include metrics.metadata and add e2e coverage for /status/config/ttl across storages (with BanyanDB-specific expectations).
  • Add a per-metrics-model TTL API (StorageTTLStatusQuery#getMetricsTTL(Model)), surfaced via TTLStatusQuery, and wire it into MetricsStreamProcessor so persistent workers use the effective TTL.
  • Update BanyanDB TTL status implementation to provide metadata TTL and per-model TTL decisions, plus adjust BanyanDB e2e config to validate warm/cold stage behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/e2e-v2/cases/storage/postgres/e2e.yaml Add TTL status endpoint verification for Postgres storage e2e.
test/e2e-v2/cases/storage/opensearch/e2e.yaml Add TTL status endpoint verification for OpenSearch storage e2e.
test/e2e-v2/cases/storage/mysql/e2e.yaml Add TTL status endpoint verification for MySQL storage e2e.
test/e2e-v2/cases/storage/es/e2e.yaml Add TTL status endpoint verification for Elasticsearch storage e2e.
test/e2e-v2/cases/storage/es/es-sharding/e2e.yaml Expand ES-sharding e2e coverage and add TTL status verification.
test/e2e-v2/cases/storage/es/es-sharding/docker-compose.yml Parameterize Elasticsearch image version via ${ES_VERSION}.
test/e2e-v2/cases/storage/banyandb/e2e.yaml Add BanyanDB-specific TTL status verification.
test/e2e-v2/cases/storage/banyandb/docker-compose.yml Enable warm/cold stages for BanyanDB minute metrics to validate effective TTL behavior.
test/e2e-v2/cases/storage/expected/ttl-config.yml New expected JSON output for TTL status on non-BanyanDB storages.
test/e2e-v2/cases/storage/expected/ttl-config-banyandb.yml New expected JSON output for TTL status on BanyanDB (includes staged TTL effects).
oap-server/server-storage-plugin/storage-banyandb-plugin/.../BanyanDBTTLStatusQuery.java Add metadata TTL and implement per-model metrics TTL selection for BanyanDB.
oap-server/server-core/.../storage/ttl/TTLDefinition.java Include metrics.metadata in text representation of TTL definitions.
oap-server/server-core/.../storage/ttl/StorageTTLStatusQuery.java Add default per-model metrics TTL API to storage TTL status service.
oap-server/server-core/.../storage/ttl/MetricsTTL.java Extend metrics TTL DTO with a metadata TTL field.
oap-server/server-core/.../query/TTLStatusQuery.java Populate metadata TTL in defaults and expose getMetricsTTL(Model) with fallback behavior.
oap-server/server-core/.../analysis/worker/MetricsStreamProcessor.java Use per-model effective TTL when constructing persistent workers (fixes BanyanDB cache TTL selection).
oap-server/server-core/.../CoreModuleProvider.java Remove now-obsolete wiring of core TTL into MetricsStreamProcessor.
docs/en/changes/changes.md Document the TTL metadata addition and BanyanDB metrics cache TTL fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wu-sheng wu-sheng merged commit 272ba7d into apache:master Apr 17, 2026
624 of 630 checks passed
@wankai123 wankai123 deleted the banyandb-ttl branch April 17, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working and you are sure it's a bug!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants