* perf(promql): stop building label-set tables where they cannot collide A `Window` node used to hold an Emitted table of the label sets it had already published, so that a statement dropping the metric name could still keep two series apart when their remaining labels were identical. Every window paid for that table whether or not it could ever collide: a plain `rate()` over a table whose tag columns are nullable had to collect and merge for its whole life, because the table could not prove two series would not fold into one. The table is gone. The proof moved to plan time: a drop that cannot collide - one metric, and no `__type__`/`__unit__` tag to lose - needs no `Merge`, and any other shape gets a canonical `Merge` inserted where the drop happens. The canonical merge kernel already answers the collision, so the runtime no longer carries an occupancy set to detect one. A decline now records why it declined, which is what tells the two paths apart in metrics. Signed-off-by: discord9 <discord9@163.com> * test(promql): pin that a drop above a name-dropping kernel needs no merge `rate(x[5m]) * 2` plans one window and one broadcast, and `abs(abs(rate(x[5m])))` one window and two maps; neither plans a merge, because the metadata labels are all the drop can lose and the labels proof covers them. The review asked for these two shapes by name: with the labels proof forced to answer `false` the test reports `left: 0, right: 2` for the first, which is the count it planned before. Signed-off-by: discord9 <discord9@163.com> * fix(promql): make the metadata drop's proof ask the storage keys `drop_metric_name` also drops an empty label value (`map.rs:367-368`), so two stored series that differ only in `{zone=""}` versus no `zone` become one label set after a name-dropping kernel. The labels alone cannot see that pair, so the proof was incomplete: a nullable key column let the pass insert no `Merge`, and the runtime then emitted two series of one label set instead of reporting `vector cannot contain metrics with the same labelset`. The proof now asks `keys_survive_metadata_drop` - the rule the physical scan already reads - and a `Merge` at or below the drop answers its empty-value half, so a chain of drops over a nullable table pays one collection at the bottom rather than one per drop. Every GreptimeDB tag column is nullable today, so that boundary is what a real table gets. A canonical merge carrying histogram frames was the one pairing nothing exercised, and the extra boundary made it reachable: the gate that declined it is gone. A histogram statement now crosses the boundary - a producer per partition, a consumer above the router - on the merge kernel's own `SampleRef::Histogram` arm, which is where the duplicate this fix is about is reported. That crossing is covered by an HTTP case over a nullable tag, and by `Merge` coverage for complementary positions, overlapping positions, missing samples and sliced payloads, the evaluated frame's histogram and mixed encodings through producer, router and consumer, a float-producing histogram function below a nested boundary, and the segmented plan. Signed-off-by: discord9 <discord9@163.com> --------- 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.