Skip to content

Flaky test: test_replicated_merge_tree_s3_zero_copy/test.py::test_drop_table #73096

Closed

Description

@tuanpach

Report: https://s3.amazonaws.com/clickhouse-test-reports/0/bb1604d48ca3b6b52b14d31b85f7821219272deb/integration_tests__asan__old_analyzer__%5B5_6%5D.html

[gw4] linux -- Python 3.10.12 /usr/bin/python3

cluster = <helpers.cluster.ClickHouseCluster object at 0x7f2aa4d354b0>

    def test_drop_table(cluster):
        node = list(cluster.instances.values())[0]
        node2 = list(cluster.instances.values())[1]
    
        # We are checking log entries in this test, so it should be empty before the execution.
        node.rotate_logs()
        node2.rotate_logs()
    
        # drop table .. sync, doesn't removes replica from zk immediately. Prevent race contition by removing old nodes from zk.
        remove_leftovers_from_zk(node, node2, "1")
        remove_leftovers_from_zk(node2, node, "2")
    
        node.query(
            "create table test_drop_table (n int) engine=ReplicatedMergeTree('/test/drop_table', '1') order by n partition by n % 99 settings storage_policy='s3'"
        )
        node2.query(
            "create table test_drop_table (n int) engine=ReplicatedMergeTree('/test/drop_table', '2') order by n partition by n % 99 settings storage_policy='s3'"
        )
        node.query("insert into test_drop_table select * from numbers(1000)")
        node2.query("system sync replica test_drop_table")
    
        with PartitionManager() as pm:
            pm._add_rule(
                {
                    "probability": 0.01,
                    "destination": node.ip_address,
                    "source_port": 2181,
                    "action": "REJECT --reject-with tcp-reset",
                }
            )
            pm._add_rule(
                {
                    "probability": 0.01,
                    "source": node.ip_address,
                    "destination_port": 2181,
                    "action": "REJECT --reject-with tcp-reset",
                }
            )
    
            # Will drop in background with retries
            node.query("drop table test_drop_table")
    
            # It should not be possible to create a replica with the same path until the previous one is completely dropped
            for i in range(0, 100):
>               node.query_and_get_answer_with_error(
                    "create table if not exists test_drop_table (n int) "
                    "engine=ReplicatedMergeTree('/test/drop_table', '1') "
                    "order by n partition by n % 99 settings storage_policy='s3'"
                )

test_replicated_merge_tree_s3_zero_copy/test.py:206: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
helpers/cluster.py:3788: in query_and_get_answer_with_error
    return self.client.query_and_get_answer_with_error(
helpers/client.py:39: in wrap
    return func(self, *args, **kwargs)
helpers/client.py:165: in query_and_get_answer_with_error
    ).get_answer_and_error()
helpers/client.py:292: in get_answer_and_error
    self.process.wait(timeout=DEFAULT_QUERY_TIMEOUT)
/usr/lib/python3.10/subprocess.py:1209: in wait
    return self._wait(timeout=timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Popen: returncode: None args: ['/clickhouse', 'client', '--host', '172.16.3...>
timeout = 600

    def _wait(self, timeout):
        """Internal implementation of wait() on POSIX."""
        if self.returncode is not None:
            return self.returncode
    
        if timeout is not None:
            endtime = _time() + timeout
            # Enter a busy loop if we have a timeout.  This busy loop was
            # cribbed from Lib/threading.py in Thread.wait() at r71065.
            delay = 0.0005 # 500 us -> initial delay of 1 ms
            while True:
                if self._waitpid_lock.acquire(False):
                    try:
                        if self.returncode is not None:
                            break  # Another thread waited.
                        (pid, sts) = self._try_wait(os.WNOHANG)
                        assert pid == self.pid or pid == 0
                        if pid == self.pid:
                            self._handle_exitstatus(sts)
                            break
                    finally:
                        self._waitpid_lock.release()
                remaining = self._remaining_time(endtime)
                if remaining <= 0:
                    raise TimeoutExpired(self.args, timeout)
                delay = min(delay * 2, remaining, .05)
>               time.sleep(delay)
E               Failed: Timeout >900.0s

/usr/lib/python3.10/subprocess.py:1953: Failed

Activity

  1. added
    flaky test
    on Dec 11, 2024
  2. tuanpach commented on Dec 11, 2024

    @tuanpach
    MemberAuthor

    When the keep session expires, the merge tree table tries to restore metadata from Keeper. With the default settings (keeper_max_retries=10, keeper_retry_initial_backoff_ms=100, keeper_retry_max_backoff_ms=5000), the query might take up to 25s.

    We run the test 5 times, and loop number is 100; the total processing time might exceed the test timeout which is 900s.

    Possible solution:

    1. Reduce the loop number: probably 50
    2. Reduce keeper_max_retries from 10 to 3, keeper_retry_max_backoff_ms from 5000 to 500 in the query settings.
  3. self-assigned this
    on Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

flaky test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions