`absent_over_time({job="x"}[20m])` was declined by the native route, and the plan it fell back to
answers with an error, so the shape produced no answer at all: the existing planner needs one
`__name__` equality matcher to read a table from (`Expect a metric matcher, but not found`).
The guard that declined it assumed that a nameless selector's tree declares `__name__` while binding
no metric name, and that the fused node refuses such a tree. That is not the shape: a discovered
selector's prepared input is the `Union` of one `RawSeriesSource` per metric, so the node is handed
explicit-label frames, and only its bare-region-scan arm reads the binding's name - an arm a nameless
selector never reaches, because a successful scan always binds one metric. A statement such as
`sum by (__name__) ({tag_0="x"})` over discovered metrics already builds and runs exactly this
combination.
The guard now declines only a nameless input that is not already sourced, which keeps the bare-scan
arm closed if that invariant ever regresses. The presence fold keeps the metric name, so two metrics
sharing ordinary labels stay two series and `absent` answers the empty vector, as Prometheus does;
a fold that dropped the name would have folded them into one series and answered wrongly.
`is_sourced_plan` is the existing predicate factored out of the child mapping, so the guard and the
mapping ask the same question. `FusedSeriesBinding::metric_name`'s doc no longer claims the logical
node requires a name whenever `tags` declares `__name__`; the requirement belongs to the bare-scan
arm of the physical planner.
A statement that mixes a multi-metric discovery with a single-metric selector was admitted and then
failed at physical planning: `build_inner_segment`'s multi-source arm wrapped every prepared plan in
a new `RawSeriesSource`, including plans that were already sources, and built
`RawSeriesSource(RawSeriesSource(TableScan))`, which the physical planner refuses after the statement
has been committed to this route. The arm now hands an already-sourced plan to the segment as it is
and wraps only real table scans (`is_sourced_plan`).
Regression: `absent_over_time({job="api"}[5m]) or ({probe_label="y"} + on(job) absent_a)` was
unanswerable before that fix and now runs a `FusedSeriesExec` and answers
`(120000, {job="api"}, 7.0)` and `(400000, {job="api"}, 1.0)`.
Not changed: a statement whose discovered table is partitioned still declines, because
`remote_raw_boundary` skips this builder and the alternative does not recognise a `Union`.
Signed-off-by: discord9 <discord9@163.com>
Setup tests for multiple storage backend
To run the integration test, please copy .env.example to .env in the project root folder and change the values on need.
Take s3 for example. You need to set your S3 bucket, access key id and secret key:
# Settings for s3 test
GT_S3_BUCKET=S3 bucket
GT_S3_REGION=S3 region
GT_S3_ACCESS_KEY_ID=S3 access key id
GT_S3_ACCESS_KEY=S3 secret access key
Run
Execute the following command in the project root folder:
cargo test integration
Test s3 storage:
cargo test s3
Test oss storage:
cargo test oss
Test azblob storage:
cargo test azblob
Setup tests with Kafka wal
To run the integration test, please copy .env.example to .env in the project root folder and change the values on need.
GT_KAFKA_ENDPOINTS = localhost:9092
Setup kafka standalone
cd tests-integration/fixtures
docker compose -f docker-compose.yml up kafka
Setup tests with etcd TLS
This guide explains how to set up and test TLS-enabled etcd connections in GreptimeDB integration tests.
Quick Start
TLS certificates are already at tests-integration/fixtures/etcd-tls-certs/.
-
Start TLS-enabled etcd:
cd tests-integration/fixtures docker compose up etcd-tls -d -
Start all services (including etcd-tls):
cd tests-integration/fixtures docker compose up -d --wait
Certificate Details
The checked-in certificates include:
ca.crt- Certificate Authority certificateserver.crt/server-key.pem- Server certificate for etcd-tls serviceclient.crt/client-key.pem- Client certificate for connecting to etcd-tls
The server certificate includes SANs for localhost, etcd-tls, 127.0.0.1, and ::1.
Regenerating Certificates (Optional)
If you need to regenerate the etcd certificates:
# Regenerate certificates (overwrites existing ones)
./scripts/generate-etcd-tls-certs.sh
# Or generate in custom location
./scripts/generate-etcd-tls-certs.sh /path/to/cert/directory
If you need to regenerate the mysql and postgres certificates:
# Regenerate certificates (overwrites existing ones)
./scripts/generate_certs.sh
# Or generate in custom location
./scripts/generate_certs.sh /path/to/cert/directory
Note: The checked-in certificates are for testing purposes only and should never be used in production.