Retry connection expired in test_rename_column/test.py

This commit is contained in:
alesapin 2023-05-16 13:05:36 +02:00
parent 6061f3b90e
commit a4f84cecfd

View File

@ -225,7 +225,9 @@ def select(
def rename_column(
node, table_name, name, new_name, iterations=1, ignore_exception=False
):
for i in range(iterations):
i = 0
while True:
i += 1
try:
node.query(
"ALTER TABLE {table_name} RENAME COLUMN {name} to {new_name}".format(
@ -233,14 +235,22 @@ def rename_column(
)
)
except QueryRuntimeException as ex:
if 'Coordination::Exception' in str(ex):
continue
if not ignore_exception:
raise
if i >= iterations:
break
def rename_column_on_cluster(
node, table_name, name, new_name, iterations=1, ignore_exception=False
):
for i in range(iterations):
i = 0
while True:
i += 1
try:
node.query(
"ALTER TABLE {table_name} ON CLUSTER test_cluster RENAME COLUMN {name} to {new_name}".format(
@ -248,12 +258,21 @@ def rename_column_on_cluster(
)
)
except QueryRuntimeException as ex:
if 'Coordination::Exception' in str(ex):
continue
if not ignore_exception:
raise
if i >= iterations:
break
def alter_move(node, table_name, iterations=1, ignore_exception=False):
for i in range(iterations):
i = 0
while True:
i += 1
move_part = random.randint(0, 99)
move_volume = "external"
try:
@ -263,9 +282,16 @@ def alter_move(node, table_name, iterations=1, ignore_exception=False):
)
)
except QueryRuntimeException as ex:
if 'Coordination::Exception' in str(ex):
continue
if not ignore_exception:
raise
if i >= iterations:
break
def test_rename_parallel_same_node(started_cluster):
table_name = "test_rename_parallel_same_node"