Fix test_replace_partition flakiness

test_replace_partition/test.py::test_replace_after_replace_failover
statistics:

```sql
┌──────ymd─┬─success─┬─failure─┐
│ 20200613 │      40 │       2 │
│ 20200614 │      98 │       2 │
│ 20200615 │     126 │       9 │
│ 20200616 │     141 │      10 │
│ 20200617 │     119 │       7 │
│ 20200618 │      87 │      12 │
│ 20200619 │      81 │       9 │
...
│ 20210305 │      60 │      28 │
│ 20210306 │      69 │       7 │
│ 20210307 │      42 │       0 │
│ 20210308 │      53 │       8 │
│ 20210309 │     137 │      23 │
│ 20210310 │      84 │      14 │
│ 20210311 │      81 │      20 │
└──────────┴─────────┴─────────┘
```
This commit is contained in:
Azat Khuzhin 2021-03-12 21:10:16 +03:00
parent 49f6fd0923
commit 5af5c90b8b

View File

@ -1,3 +1,4 @@
import time
import pytest
from helpers.cluster import ClickHouseCluster
@ -97,12 +98,13 @@ def test_drop_failover(drop_failover):
# Drop partition on source node
node3.query("ALTER TABLE test_table DROP PARTITION 201706")
# connection restored
# Wait few seconds for connection to zookeeper to be restored
time.sleep(5)
node4.query_with_retry("select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
msg = node4.query_with_retry(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
check_callback=lambda x: 'Not found part' not in x, sleep_time=1)
assert 'Not found part' not in node4.query(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'")
assert 'Not found part' not in msg
assert_eq_with_retry(node4, "SELECT id FROM test_table order by id", '')
@ -151,8 +153,11 @@ def test_replace_after_replace_failover(replace_after_replace_failover):
assert_eq_with_retry(node5, "SELECT id FROM test_table order by id", '333')
node6.query_with_retry("select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
# Wait few seconds for connection to zookeeper to be restored
time.sleep(5)
msg = node6.query_with_retry(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'",
check_callback=lambda x: 'Not found part' not in x, sleep_time=1)
assert 'Not found part' not in node6.query(
"select last_exception from system.replication_queue where type = 'REPLACE_RANGE'")
assert 'Not found part' not in msg
assert_eq_with_retry(node6, "SELECT id FROM test_table order by id", '333')