From 7bc92e8973131a0934622ee8521a5d3c94526b5b Mon Sep 17 00:00:00 2001
From: Arseniy Volynets <vol0ncar@yandex.ru>
Date: Mon, 27 Nov 2023 23:55:33 +0300
Subject: [PATCH] fix: flaky sql test with global subquery

- Test fails because of timeout on socket.
Current vshard multi storage call works
in 2 stages:
1. Ref needed storages
2. Execute stored procedure on the storages
When creating Ref on storage, vshard waits for all
buckets to become writable, if it happens that
rebalancer will start to move buckets, the query
execution will freeze until rebalancing is
done, which happens for this test sometimes.
- Comment out the flaky test until we switch
to new vshard multicall algorithm. Another
solution would be to increase timeout, but
there is no guarantee that new timeout is
big enough: I caught this error with 5s
timeout.
---
 test/int/test_sql.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/test/int/test_sql.py b/test/int/test_sql.py
index f0aa1d8c46..142c802618 100644
--- a/test/int/test_sql.py
+++ b/test/int/test_sql.py
@@ -221,15 +221,18 @@ def test_subqueries_on_global_tbls(cluster: Cluster):
     )
     assert data["rows"] == [[1], [3]]
 
-    data = i1.sql(
-        """
-        select a from g
-        where b in (select c from s where c = 1) or
-        b in (select c from s where c = 3) and
-        a < (select sum(c) from s)
-        """,
-    )
-    assert data["rows"] == [[1], [3]]
+    # TODO: uncomment when
+    # https://git.picodata.io/picodata/picodata/sbroad/-/issues/542
+    # is done.
+    # data = i1.sql(
+    #     """
+    #     select a from g
+    #     where b in (select c from s where c = 1) or
+    #     b in (select c from s where c = 3) and
+    #     a < (select sum(c) from s)
+    #     """,
+    # )
+    # assert data["rows"] == [[1], [3]]
 
 
 def test_aggregates_on_global_tbl(cluster: Cluster):
-- 
GitLab