mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-17 13:30:38 +00:00
* feat: switch partition tree to bulk Signed-off-by: evenyag <realevenyag@gmail.com> * chore: keep partition tree memtable for migration test Restore PartitionTreeMemtable construction when memtable.type=partition_tree is explicit, and move the sparse-encoding bulk override into the default (no explicit memtable.type) arm so phase 2's memtable.type=bulk wins on reopen. Rewrite test_reopen_time_series_sparse_memtable_with_bulk to use a metric-engine-shaped schema and sparse-encoded rows with WriteHint::Sparse, so the test actually exercises a PartitionTreeMemtable in phase 1 and verifies WAL replay into the new BulkMemtable on reopen without flushing. Signed-off-by: evenyag <realevenyag@gmail.com> * chore: drop partition tree memtable from runtime Re-apply the unconditional sparse-encoding override in `MemtableBuilderProvider::builder_for_options` and route the `MemtableOptions::PartitionTree` arm to `BulkMemtable` with a deprecation warning. After this change, `PartitionTreeMemtableBuilder` is no longer reachable from the engine runtime; benchmarks still reference the type. Remove `test_reopen_time_series_sparse_memtable_with_bulk` and the `put_sparse_rows` helper added in the previous commit — that test only existed to validate the PartitionTree -> Bulk reopen migration and is unnecessary now that the override is in place. Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): move timestamp_array_to_i64_slice into read module Relocate the timestamp_array_to_i64_slice helper from memtable/partition_tree/data.rs to the read module so that the read path no longer depends on the partition_tree internals. All call sites (both inside and outside the partition_tree module) now import from crate::read. Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): use TimeSeriesMemtableBuilder in time_partition tests The time_partition tests use the memtable builder purely as a generic backend for the TimePartitions write/scan paths; nothing in them is specific to the partition-tree memtable. Switch the seven affected tests to TimeSeriesMemtableBuilder so the tests no longer depend on PartitionTreeMemtableBuilder. Signed-off-by: evenyag <realevenyag@gmail.com> * chore(mito2): delete PartitionTreeMemtable implementation The runtime already falls back to BulkMemtable for the PartitionTree variant. Drop the now-unreachable implementation, its metrics, the partition_tree benchmarks, the metric-engine Unsupported fallback in bulk_insert.rs, and the test helpers that only existed for the deleted module. MemtableOptions::PartitionTree, its parsing, the runtime fallback, the store-api MEMTABLE_PARTITION_TREE_* constants, and the SQL fixtures remain so existing region options keep round-tripping. Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito-codec): drop skip_partition_column parameter PartitionTreeMemtable was the only caller passing skip_partition_column=true; every other caller passes false. Now that the partition_tree module is gone, the parameter is uniformly false and the guard branch is dead. Drop the parameter from the trait method and both impls, remove the guard and the is_partition_column helper, and update the four remaining call sites in mito2 plus the bench. Signed-off-by: evenyag <realevenyag@gmail.com> * chore(mito2): remove unused MemtableConfig enum Signed-off-by: evenyag <realevenyag@gmail.com> * chore: fmt code Signed-off-by: evenyag <realevenyag@gmail.com> * refactor: remove unused variant Signed-off-by: evenyag <realevenyag@gmail.com> * test: update test_config_api Signed-off-by: evenyag <realevenyag@gmail.com> * fix: remove unused memtable test helpers Signed-off-by: evenyag <realevenyag@gmail.com> * chore: address review comment Signed-off-by: evenyag <realevenyag@gmail.com> * fix: support bulk memtable options Signed-off-by: evenyag <realevenyag@gmail.com> * fix: sanitize config Signed-off-by: evenyag <realevenyag@gmail.com> * feat: remove partition tree options from region options Move primary_key_encoding to the top level Signed-off-by: evenyag <realevenyag@gmail.com> * test: make ssts test datetime replaced text stable Signed-off-by: evenyag <realevenyag@gmail.com> * test: update sqlness result Signed-off-by: evenyag <realevenyag@gmail.com> * chore: validate_enum_options consider bulk memtable Signed-off-by: evenyag <realevenyag@gmail.com> * refactor: pass region id when parsing region options Replace the `TryFrom<&HashMap>` impl for `RegionOptions` with `try_from_options(region_id, options_map)` so the legacy partition_tree fallback can log the affected region. The fallback now also overrides the SST format to flat in addition to clearing the memtable type. Signed-off-by: evenyag <realevenyag@gmail.com> * fix: align sst_format with bulk memtable on parse and open Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com>
97 lines
1.9 KiB
SQL
97 lines
1.9 KiB
SQL
CREATE DATABASE mydb WITH (ttl = '1h');
|
|
|
|
SHOW DATABASES;
|
|
|
|
SHOW FULL DATABASES;
|
|
|
|
SHOW CREATE DATABASE mydb;
|
|
|
|
USE mydb;
|
|
|
|
CREATE TABLE test(host STRING, cpu DOUBLE, ts TIMESTAMP TIME INDEX);
|
|
|
|
SHOW CREATE TABLE test;
|
|
|
|
USE public;
|
|
|
|
DROP DATABASE mydb;
|
|
|
|
---test more options----
|
|
CREATE DATABASE mydb WITH (
|
|
ttl = '1h',
|
|
'memtable.type'='bulk',
|
|
'append_mode'='false',
|
|
'merge_mode'='last_non_null',
|
|
'compaction.type' = 'twcs',
|
|
'compaction.twcs.time_window' = '1h',
|
|
'skip_wal'='true');
|
|
|
|
use mydb;
|
|
|
|
SHOW FULL DATABASES;
|
|
|
|
CREATE TABLE test1(host STRING, cpu DOUBLE, ts TIMESTAMP TIME INDEX);
|
|
|
|
SHOW CREATE TABLE test1;
|
|
|
|
CREATE TABLE test2(host STRING, cpu DOUBLE, ts TIMESTAMP TIME INDEX) WITH (
|
|
'append_mode'='true',
|
|
'merge_mode'='',
|
|
'skip_wal'='false');
|
|
|
|
SHOW CREATE TABLE test2;
|
|
|
|
INSERT INTO test2 VALUES('host1', 1.0, '2023-10-01 00:00:00');
|
|
|
|
SELECT * FROM test2;
|
|
|
|
USE public;
|
|
|
|
DROP DATABASE mydb;
|
|
|
|
--- test compaction options----
|
|
|
|
CREATE DATABASE test_compaction_opt;
|
|
|
|
USE test_compaction_opt;
|
|
|
|
SHOW CREATE DATABASE test_compaction_opt;
|
|
|
|
CREATE TABLE test_table(ts TIMESTAMP TIME INDEX, val INT);
|
|
|
|
SHOW CREATE TABLE test_table;
|
|
|
|
ALTER DATABASE test_compaction_opt SET 'compaction.type' = 'twcs';
|
|
|
|
ALTER DATABASE test_compaction_opt SET 'compaction.twcs.time_window' = '2h';
|
|
|
|
SHOW CREATE DATABASE test_compaction_opt;
|
|
|
|
SHOW CREATE TABLE test_table;
|
|
|
|
CREATE TABLE test_table2(ts TIMESTAMP TIME INDEX, val INT);
|
|
|
|
SHOW CREATE TABLE test_table2;
|
|
|
|
USE public;
|
|
|
|
DROP DATABASE test_compaction_opt;
|
|
|
|
CREATE DATABASE test_compaction_opt2;
|
|
|
|
USE test_compaction_opt2;
|
|
|
|
CREATE TABLE test_table(ts TIMESTAMP TIME INDEX, v INT) WITH ('compaction.type'='twcs','compaction.twcs.time_window'='1h');
|
|
|
|
SHOW CREATE TABLE test_table;
|
|
|
|
ALTER DATABASE test_compaction_opt2 SET 'compaction.twcs.time_window' = '3h';
|
|
|
|
SHOW CREATE TABLE test_table;
|
|
|
|
USE public;
|
|
|
|
DROP DATABASE test_compaction_opt2;
|
|
|
|
SHOW DATABASES;
|