From c01448f0b680853575111755180136a16e4d634b Mon Sep 17 00:00:00 2001 From: yariks5s Date: Tue, 26 Mar 2024 17:00:35 +0000 Subject: [PATCH] Make tests faster + docs improvement --- .../server-configuration-parameters/settings.md | 2 +- .../test_undrop_query/configs/with_delay_config.xml | 2 +- tests/integration/test_undrop_query/test.py | 9 +++++---- tests/queries/0_stateless/02681_undrop_query.sql | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/en/operations/server-configuration-parameters/settings.md b/docs/en/operations/server-configuration-parameters/settings.md index 61aee5a7b42..5d87ca5ce8d 100644 --- a/docs/en/operations/server-configuration-parameters/settings.md +++ b/docs/en/operations/server-configuration-parameters/settings.md @@ -945,7 +945,7 @@ Hard limit is configured via system tools ## database_atomic_delay_before_drop_table_sec {#database_atomic_delay_before_drop_table_sec} -The delay before a table data is dropped in seconds. If the `DROP TABLE` query has a `SYNC` modifier, this setting is ignored. +The delay during which a dropped table can be restored using the [UNDROP](/docs/en/sql-reference/statements/undrop.md) statement. If `DROP TABLE` ran with a `SYNC` modifier, the setting is ignored. Default value: `480` (8 minutes). diff --git a/tests/integration/test_undrop_query/configs/with_delay_config.xml b/tests/integration/test_undrop_query/configs/with_delay_config.xml index 94e5da2193b..5e6de6b7567 100644 --- a/tests/integration/test_undrop_query/configs/with_delay_config.xml +++ b/tests/integration/test_undrop_query/configs/with_delay_config.xml @@ -1,3 +1,3 @@ - 80 + 20 diff --git a/tests/integration/test_undrop_query/test.py b/tests/integration/test_undrop_query/test.py index b6123312320..dfceccee3fa 100644 --- a/tests/integration/test_undrop_query/test.py +++ b/tests/integration/test_undrop_query/test.py @@ -23,7 +23,7 @@ def started_cluster(): def test_undrop_drop_and_undrop_loop(started_cluster): uuid_list = [] - for i in range(10): + for i in range(4): table_uuid = uuid.uuid1().__str__() uuid_list.append(table_uuid) logging.info(f"table_uuid: {table_uuid}") @@ -34,12 +34,13 @@ def test_undrop_drop_and_undrop_loop(started_cluster): node.query(f"DROP TABLE test_undrop_{i};") - for i in range(10): - if i >= 8: # -> setting for table to live after drop = 80 seconds + for i in range(4): + if i >= 3: # First 3 tables are dropped after 0, 5 and 10 seconds. Fourth is dropped after 21 seconds + time.sleep(11) error = node.query_and_get_error( f"UNDROP TABLE test_undrop_loop_{i} UUID '{uuid_list[i]}';" ) assert "UNKNOWN_TABLE" in error else: node.query(f"UNDROP TABLE test_undrop_loop_{i} UUID '{uuid_list[i]}';") - time.sleep(10) + time.sleep(5) diff --git a/tests/queries/0_stateless/02681_undrop_query.sql b/tests/queries/0_stateless/02681_undrop_query.sql index d038a383690..c33b74d49e5 100644 --- a/tests/queries/0_stateless/02681_undrop_query.sql +++ b/tests/queries/0_stateless/02681_undrop_query.sql @@ -17,7 +17,7 @@ drop table if exists 02681_undrop_detach sync; create table 02681_undrop_detach (id Int32, num Int32) Engine=MergeTree() order by id; insert into 02681_undrop_detach values (1, 1); detach table 02681_undrop_detach sync; -undrop table 02681_undrop_detach; -- { serverError 57 } +undrop table 02681_undrop_detach; -- { serverError TABLE_ALREADY_EXISTS } attach table 02681_undrop_detach; alter table 02681_undrop_detach update num = 2 where id = 1; select command from system.mutations where table='02681_undrop_detach' and database=currentDatabase() limit 1;