mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
add functionality test
Signed-off-by: Lloyd-Pottiger <yan1579196623@gamil.com>
This commit is contained in:
parent
ee88aed42b
commit
c5d81e160c
@ -20,7 +20,7 @@ CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster]
|
||||
|
||||
Engine parameters:
|
||||
|
||||
- `ttl` - time to live. TTL is accepted in seconds. Not specifying/passing or non-positive TTL behaves like TTL = infinity.
|
||||
- `ttl` - time to live for values. TTL is accepted in seconds. If TTL is 0, regular RocksDB instance is used (without TTL).
|
||||
- `read_only` - when `read_only` is set to `true`, read-only mode is used. For storage with TTL, compaction will not be triggered (neither manual nor automatic), so no expired entries are removed.
|
||||
- `primary_key_name` – any column name in the column list.
|
||||
- `primary key` must be specified, it supports only one column in the primary key. The primary key will be serialized in binary as a `rocksdb key`.
|
||||
|
@ -0,0 +1 @@
|
||||
--
|
12
tests/queries/0_stateless/02381_rocksdb_read_only.sql
Normal file
12
tests/queries/0_stateless/02381_rocksdb_read_only.sql
Normal file
@ -0,0 +1,12 @@
|
||||
DROP TABLE IF EXISTS 02381_test;
|
||||
|
||||
CREATE TABLE 02381_test (key UInt64, value String) Engine=EmbeddedRocksDB(0, true) PRIMARY KEY(key);
|
||||
|
||||
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '02381_test' and name = 'number.keys.written';
|
||||
INSERT INTO 02381_test SELECT number, format('Hello, world ({})', toString(number)) FROM numbers(10000);
|
||||
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '02381_test' and name = 'number.keys.written';
|
||||
|
||||
SELECT * FROM 02381_test WHERE key = 123;
|
||||
SELECT '--';
|
||||
|
||||
DROP TABLE IF EXISTS 02381_test;
|
18
tests/queries/0_stateless/02381_rocksdb_with_ttl.reference
Normal file
18
tests/queries/0_stateless/02381_rocksdb_with_ttl.reference
Normal file
@ -0,0 +1,18 @@
|
||||
10000
|
||||
123 Hello, world (123)
|
||||
--
|
||||
--
|
||||
123 Hello, world (123)
|
||||
4567 Hello, world (4567)
|
||||
--
|
||||
--
|
||||
0 Hello, world (0)
|
||||
--
|
||||
123 Hello, world (123)
|
||||
456 Hello, world (456)
|
||||
--
|
||||
99 Hello, world (99)
|
||||
999 Hello, world (999)
|
||||
9999 Hello, world (9999)
|
||||
--
|
||||
0
|
32
tests/queries/0_stateless/02381_rocksdb_with_ttl.sql
Normal file
32
tests/queries/0_stateless/02381_rocksdb_with_ttl.sql
Normal file
@ -0,0 +1,32 @@
|
||||
DROP TABLE IF EXISTS 02381_test;
|
||||
|
||||
CREATE TABLE 02381_test (key UInt64, value String) Engine=EmbeddedRocksDB(10) PRIMARY KEY(key);
|
||||
|
||||
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '02381_test' and name = 'number.keys.written';
|
||||
INSERT INTO 02381_test SELECT number, format('Hello, world ({})', toString(number)) FROM numbers(10000);
|
||||
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '02381_test' and name = 'number.keys.written';
|
||||
|
||||
SELECT * FROM 02381_test WHERE key = 123;
|
||||
SELECT '--';
|
||||
SELECT * FROM 02381_test WHERE key = -123;
|
||||
SELECT '--';
|
||||
SELECT * FROM 02381_test WHERE key = 123 OR key = 4567 ORDER BY key;
|
||||
SELECT '--';
|
||||
SELECT * FROM 02381_test WHERE key = NULL;
|
||||
SELECT '--';
|
||||
SELECT * FROM 02381_test WHERE key = NULL OR key = 0;
|
||||
SELECT '--';
|
||||
SELECT * FROM 02381_test WHERE key IN (123, 456, -123) ORDER BY key;
|
||||
SELECT '--';
|
||||
SELECT * FROM 02381_test WHERE key = 'Hello'; -- { serverError 53 }
|
||||
|
||||
DETACH TABLE 02381_test NO DELAY;
|
||||
ATTACH TABLE 02381_test;
|
||||
|
||||
SELECT * FROM 02381_test WHERE key IN (99, 999, 9999, -123) ORDER BY key;
|
||||
|
||||
sleep(10)
|
||||
SELECT '--';
|
||||
SELECT value FROM system.rocksdb WHERE database = currentDatabase() and table = '02381_test' and name = 'number.keys.written';
|
||||
|
||||
DROP TABLE IF EXISTS 02381_test;
|
Loading…
Reference in New Issue
Block a user