* feat(frontend): add TTL-based PromQL range cache Signed-off-by: discord9 <discord9@163.com> * feat(frontend): add rollup cache reset endpoint Signed-off-by: discord9 <discord9@163.com> * feat(frontend): honor nocache for rollup cache Signed-off-by: discord9 <discord9@163.com> * fix(frontend): key rollup cache by table id and invalidate on DDL Signed-off-by: discord9 <discord9@163.com> * fix(frontend): set transitional rollup cache bounds Signed-off-by: discord9 <discord9@163.com> * fix(frontend): trim rollup cache to ttl and reset Remove the reset token and all DDL/heartbeat invalidation so the transitional cache has one freshness rule (ttl) and one manual escape (reset). Charge variable-sized keys, honor POST-form nocache, fail on schema changes instead of falling back, and drop duplicate TTL/dead checks. Signed-off-by: discord9 <discord9@163.com> * docs(frontend): drop stale invalidation wording Signed-off-by: discord9 <discord9@163.com> * fix(frontend): bound rollup cache key and weight Share one QueryIdentity across a plan's chunk keys, refuse chunks whose weight does not fit a u32, and reject ttl values longer than moka accepts. Clarify schema-mismatch and wall-clock tail docs. Signed-off-by: discord9 <discord9@163.com> * docs(frontend): regenerate config.md for rollup_cache tail config/config.md was hand-updated and kept the previous wording of the rollup_cache.tail comment. Run make config-docs so it matches the example TOMLs, which is what CI checks. Signed-off-by: discord9 <discord9@163.com> * test(integration): expect rollup_cache in the /config snapshot test_config_api compares the whole TOML the /config endpoint returns with a hardcoded expectation. The rollup cache adds a [rollup_cache] section, so append it with the values the frontend defaults serialize to. Signed-off-by: discord9 <discord9@163.com> * refactor(frontend): rename rollup cache to promql_rollup_cache Rename the config key, the options and config types, the cache itself, the instance accessors, the reset endpoint and the session hint so the name says what is cached. query_cache becomes promql_query_cache for the same reason: it holds PromQL range-query chunks only. Signed-off-by: discord9 <discord9@163.com> * feat(frontend): log the promql rollup cache config when enabled Signed-off-by: discord9 <discord9@163.com> * feat(frontend): size the promql rollup cache from system memory by default Derive max_bytes from total memory like the OTLP trace aux cache (1/128, floor 32MiB, cap 8GiB) instead of a fixed 256MiB, so a small frontend does not give up a quarter of its memory and a large host gets a useful budget. An explicit max_bytes still wins. Signed-off-by: discord9 <discord9@163.com> * refactor(frontend): move the promql rollup cache wiring out of instance.rs Signed-off-by: discord9 <discord9@163.com> * refactor(query): expose plan_is_native from the native planner Signed-off-by: discord9 <discord9@163.com> * fix(frontend): key promql rollup cache chunks on the output schema The metric engine auto-alters a logical table when a new label arrives, which keeps the table id but changes the schema. Keying on the id alone let one request meet an old-schema hit with a new-schema fill and fail until the ttl. The output schema of the built plan is now a key dimension, so a schema change misses; a disagreement left after that is a race with an ALTER, and the request bypasses to its original plan instead of failing. Signed-off-by: discord9 <discord9@163.com> * perf(frontend): execute consecutive promql rollup cache misses as one window A cold request executed every missed chunk as its own subwindow, each re-reading the range its first point folds. Consecutive misses now run as one window and the rows are split back into chunks before insert. Signed-off-by: discord9 <discord9@163.com> * perf(frontend): size promql rollup cache chunks in steps and drop empty-chunk guards A fixed-time chunk holds chunk/step points and degrades to one point at a large step: a 7d panel at a 10m step became 1008 single-point chunks that all had to be looked up and merged even when warm. A chunk is now at least MIN_CHUNK_STEPS points wide, so the chunk count tracks points rather than range (7d at 10m: 50 chunks). plan_chunks never emits an empty chunk, so the guards in lookup and insert, the EmptyChunk bypass, Lookup::Bypass and Insert::Bypassed are gone along with the two tests that built an empty key by hand. Also applies the reviewer's doc suggestions and dedupes the tests that asserted one behavior at three layers. Signed-off-by: discord9 <discord9@163.com> * docs(frontend): regenerate config.md for promql_rollup_cache Signed-off-by: discord9 <discord9@163.com> * fix(frontend): copy split promql rollup cache chunks before storing them Signed-off-by: discord9 <discord9@163.com> * fix(frontend): store empty promql rollup cache chunks as complete answers Signed-off-by: discord9 <discord9@163.com> * refactor(frontend): key the promql rollup cache on the arrow schema directly Signed-off-by: discord9 <discord9@163.com> * fix(frontend): only bypass the promql rollup cache for a set nocache hint Signed-off-by: discord9 <discord9@163.com> * docs(frontend): record that rollup cache annotations belong to the read Signed-off-by: discord9 <discord9@163.com> * perf(frontend): read contiguous direct spans as one window Signed-off-by: discord9 <discord9@163.com> * docs(frontend): fix stale rollup cache comments and pin lookback_ms 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.