Make tests faster + docs improvement

This commit is contained in:
yariks5s 2024-03-26 17:00:35 +00:00
parent 30df4589ed
commit c01448f0b6
4 changed files with 8 additions and 7 deletions

View File

@ -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} ## 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). Default value: `480` (8 minutes).

View File

@ -1,3 +1,3 @@
<clickhouse> <clickhouse>
<database_atomic_delay_before_drop_table_sec>80</database_atomic_delay_before_drop_table_sec> <database_atomic_delay_before_drop_table_sec>20</database_atomic_delay_before_drop_table_sec>
</clickhouse> </clickhouse>

View File

@ -23,7 +23,7 @@ def started_cluster():
def test_undrop_drop_and_undrop_loop(started_cluster): def test_undrop_drop_and_undrop_loop(started_cluster):
uuid_list = [] uuid_list = []
for i in range(10): for i in range(4):
table_uuid = uuid.uuid1().__str__() table_uuid = uuid.uuid1().__str__()
uuid_list.append(table_uuid) uuid_list.append(table_uuid)
logging.info(f"table_uuid: {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};") node.query(f"DROP TABLE test_undrop_{i};")
for i in range(10): for i in range(4):
if i >= 8: # -> setting for table to live after drop = 80 seconds 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( error = node.query_and_get_error(
f"UNDROP TABLE test_undrop_loop_{i} UUID '{uuid_list[i]}';" f"UNDROP TABLE test_undrop_loop_{i} UUID '{uuid_list[i]}';"
) )
assert "UNKNOWN_TABLE" in error assert "UNKNOWN_TABLE" in error
else: else:
node.query(f"UNDROP TABLE test_undrop_loop_{i} UUID '{uuid_list[i]}';") node.query(f"UNDROP TABLE test_undrop_loop_{i} UUID '{uuid_list[i]}';")
time.sleep(10) time.sleep(5)

View File

@ -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; create table 02681_undrop_detach (id Int32, num Int32) Engine=MergeTree() order by id;
insert into 02681_undrop_detach values (1, 1); insert into 02681_undrop_detach values (1, 1);
detach table 02681_undrop_detach sync; 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; attach table 02681_undrop_detach;
alter table 02681_undrop_detach update num = 2 where id = 1; 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; select command from system.mutations where table='02681_undrop_detach' and database=currentDatabase() limit 1;