Files
greptimedb/tests
916acb1267 fix(operator): apply metric ingest TTL hints to physical tables (#9057)
* fix(operator): apply metric ingest TTL to physical tables

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* fix(operator): preserve instant TTL on logical tables and add remote write TTL hint integration test

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* fix(operator): preserve instant TTL on logical tables and add remote write TTL hint integration test

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* test(sqlness): regenerate logical table TTL expectation

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* refactor(operator): centralize metric logical table TTL checks

Share retention-vs-instant TTL helpers between DDL validation, auto-create
option filling, and ingest rejection messages so batch and SQL paths stay aligned.

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>

* fix(operator): borrow physical table name for TTL hint error

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>

* test(sqlness): expect InvalidArguments for logical retention TTL

Align table_semantics with alter_table retention rejection and rustfmt
the TTL hint error helper call.

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>

* feat(operator): apply retention ttl hint only on physical table creation and ignore on subsequent writes

Signed-off-by: Mohd Quamar Tyagi <104281681+Tyagiquamar@users.noreply.github.com>

* fix(operator): legacy logical TTL on create and restore ddl.rs LF

Strip retention ttl from metric logical CREATE options with a warning so
import_v2 can replay older snapshots. Narrow alter TTL checks, reduce
helper visibility, and convert ddl.rs back to LF line endings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* fix(cli): clippy in import_v2 legacy ttl test

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* docs(operator): clarify logical metric ttl alter handling

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* test(sqlness): add server-side coverage for legacy logical-table TTL

Replace the mock import_v2 unit test with sqlness cases verifying:
- SHOW CREATE TABLE omits database retention TTL on logical tables.
- Legacy logical CREATE TABLE with retention TTL strips the retention option from create_options.
- Explicit instant TTL remains preserved on logical tables.

Group TTL_KEY import in ddl.rs and verify create_options in HTTP test.

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* refactor(operator): strip logical retention ttl in one place

Every logical-table create path ends in StatementExecutor::create_logical_tables,
so strip retention ttl there instead of in fill_table_options_for_create and
validate_logical_create. validate_logical_create no longer mutates its input.

Classify ttl by parsing it once: only a valid non-instant ttl counts as
retention. Invalid values now fail normal option validation instead of being
silently stripped on create or reported as retention on ALTER.

Drop unit tests covered by the sqlness and HTTP integration cases.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
Signed-off-by: Mohd Quamar Tyagi <104281681+Tyagiquamar@users.noreply.github.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Co-authored-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-18 23:46:22 +00:00
..

Sqlness Test

Sqlness manual

Case file

Sqlness has two types of file:

  • .sql: test input, SQL only
  • .result: expected test output, SQL and its results

.result is the output (execution result) file. If you see .result files is changed, it means this test gets a different result and indicates it fails. You should check change logs to solve the problem.

You only need to write test SQL in .sql file, and run the test.

Case organization

The root dir of input cases is tests/cases. It contains several subdirectories stand for different test modes. E.g., standalone/ contains all the tests to run under greptimedb standalone start mode.

Under the first level of subdirectory (e.g. the cases/standalone), you can organize your cases as you like. Sqlness walks through every file recursively and runs them.

Kafka WAL

Sqlness supports Kafka WAL. You can either provide a Kafka cluster or let sqlness to start one for you.

To run test with kafka, you need to pass the option -w kafka. If no other options are provided, sqlness will use conf/kafka-cluster.yml to start a Kafka cluster. This requires docker and docker-compose commands in your environment.

Otherwise, you can additionally pass the your existing kafka environment to sqlness with -k option. E.g.:

cargo sqlness bare -w kafka -k localhost:9092

In this case, sqlness will not start its own kafka cluster and the one you provided instead.

Run the test

Unlike other tests, this harness is in a binary target form. You can run it with:

cargo sqlness bare

It automatically finishes the following procedures: compile GreptimeDB, start it, grab tests and feed it to the server, then collect and compare the results. You only need to check if the .result files are changed. If not, congratulations, the test is passed 🥳!