ClickHouse/tests/queries/0_stateless/01014_lazy_database_basic.sh

74 lines
1.7 KiB
Bash
Raw Normal View History

2019-10-01 13:57:58 +00:00
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-08-01 00:51:12 +00:00
. "$CURDIR"/../shell_config.sh
2019-10-01 13:57:58 +00:00
2019-10-18 12:54:39 +00:00
${CLICKHOUSE_CLIENT} -n -q "DROP DATABASE IF EXISTS testlazy"
2019-10-01 13:57:58 +00:00
${CLICKHOUSE_CLIENT} -n -q "
CREATE DATABASE testlazy ENGINE = Lazy(1);
CREATE TABLE testlazy.log (a UInt64, b UInt64) ENGINE = Log;
CREATE TABLE testlazy.slog (a UInt64, b UInt64) ENGINE = StripeLog;
CREATE TABLE testlazy.tlog (a UInt64, b UInt64) ENGINE = TinyLog;
"
2019-10-18 12:54:39 +00:00
${CLICKHOUSE_CLIENT} -q "SELECT * FROM system.parts WHERE database = 'testlazy'";
2019-10-02 13:06:57 +00:00
sleep 1.5
2019-10-01 13:57:58 +00:00
${CLICKHOUSE_CLIENT} -q "
2019-10-03 14:18:17 +00:00
SELECT database, name, create_table_query FROM system.tables WHERE database = 'testlazy';
2019-10-01 13:57:58 +00:00
"
2019-10-02 13:06:57 +00:00
sleep 1.5
2019-10-01 13:57:58 +00:00
${CLICKHOUSE_CLIENT} -q "
2019-10-03 14:18:17 +00:00
SELECT database, name FROM system.tables WHERE database = 'testlazy';
2019-10-01 13:57:58 +00:00
"
2019-10-02 13:06:57 +00:00
sleep 1.5
2019-10-01 13:57:58 +00:00
${CLICKHOUSE_CLIENT} -n -q "
2019-10-02 13:06:57 +00:00
SELECT * FROM testlazy.log LIMIT 0; -- drop testlazy.log from cache
RENAME TABLE testlazy.log TO testlazy.log2;
2019-10-03 14:18:17 +00:00
SELECT database, name FROM system.tables WHERE database = 'testlazy';
2019-10-02 13:06:57 +00:00
"
sleep 1.5
${CLICKHOUSE_CLIENT} -q "
2019-10-03 14:18:17 +00:00
SELECT database, name FROM system.tables WHERE database = 'testlazy';
2019-10-02 13:06:57 +00:00
"
sleep 1.5
${CLICKHOUSE_CLIENT} -n -q "
INSERT INTO testlazy.log2 VALUES (1, 1);
2019-10-01 13:57:58 +00:00
INSERT INTO testlazy.slog VALUES (2, 2);
INSERT INTO testlazy.tlog VALUES (3, 3);
2019-10-02 13:06:57 +00:00
SELECT * FROM testlazy.log2;
2019-10-01 13:57:58 +00:00
SELECT * FROM testlazy.slog;
SELECT * FROM testlazy.tlog;
"
2019-10-02 13:06:57 +00:00
sleep 1.5
2019-10-01 13:57:58 +00:00
2019-10-02 06:31:23 +00:00
${CLICKHOUSE_CLIENT} -n -q "
2019-10-02 13:06:57 +00:00
SELECT * FROM testlazy.log2 LIMIT 0; -- drop testlazy.log2 from cache
DROP TABLE testlazy.log2;
2019-10-01 13:57:58 +00:00
"
2019-10-02 13:06:57 +00:00
sleep 1.5
2019-10-01 13:57:58 +00:00
${CLICKHOUSE_CLIENT} -n -q "
SELECT * FROM testlazy.slog;
SELECT * FROM testlazy.tlog;
"
2019-10-02 13:06:57 +00:00
sleep 1.5
2019-10-01 13:57:58 +00:00
${CLICKHOUSE_CLIENT} -q "
DROP DATABASE testlazy;
"