You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ed...@apache.org on 2022/09/12 16:06:44 UTC
[cassandra-dtest] branch trunk updated: Fix flaky test_no_base_column_in_view_pk_complex_timestamp_with_flush Patch by Ekaterina Dimitrova; reviewed by Brandon Williams and Andres de la Pena for CASSANDRA-17882
This is an automated email from the ASF dual-hosted git repository.
edimitrova pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git
The following commit(s) were added to refs/heads/trunk by this push:
new 94540894 Fix flaky test_no_base_column_in_view_pk_complex_timestamp_with_flush Patch by Ekaterina Dimitrova; reviewed by Brandon Williams and Andres de la Pena for CASSANDRA-17882
94540894 is described below
commit 945408941e5ce6634751b23995c147078ad05576
Author: Ekaterina Dimitrova <ek...@datastax.com>
AuthorDate: Fri Sep 9 11:36:36 2022 -0400
Fix flaky test_no_base_column_in_view_pk_complex_timestamp_with_flush
Patch by Ekaterina Dimitrova; reviewed by Brandon Williams and Andres de la Pena for CASSANDRA-17882
---
materialized_views_test.py | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 6f547881..6a039480 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -79,12 +79,16 @@ class TestMaterializedViews(Tester):
def update_view(self, session, query, flush, compact=False):
session.execute(query)
+ query_time = time.time()
+
self._replay_batchlogs()
if flush:
self.cluster.flush()
if compact:
self.cluster.compact()
+ return query_time
+
def _settle_nodes(self):
logger.debug("Settling all nodes")
stage_match = re.compile(r"(?P<name>\S+)\s+(?P<active>\d+)\s+(?P<pending>\d+)\s+(?P<completed>\d+)\s+(?P<blocked>\d+)\s+(?P<alltimeblocked>\d+)")
@@ -1536,19 +1540,37 @@ class TestMaterializedViews(Tester):
assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, None])
assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
- # add selected with ttl=20 (we apparently need a long ttl because the flushing etc that self.update_view does can take a long time)
- self.update_view(session, "UPDATE t USING TTL 20 SET a=1 WHERE k=1 AND c=1;", flush)
- assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, None])
- assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
+ start = time.time()
+ # add selected with ttl=30 (we apparently need a long ttl because the flushing etc that self.update_view does can take a long time)
+ update_time = self.update_view(session, "UPDATE t USING TTL 30 SET a=1 WHERE k=1 AND c=1;", flush)
+ try:
+ assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
+ except AssertionError as ae:
+ if (time.time() - start) >= 30:
+ pytest.fail("Please increase the 30 TTL which expired before we could test due to a slow env.")
+ else:
+ raise ae
- time.sleep(20)
+ wait_time = update_time + 30 - time.time()
+ if wait_time > 0:
+ time.sleep(wait_time)
- # update unselected with ttl=10, view row should be alive
- self.update_view(session, "UPDATE t USING TTL 20 SET f=1 WHERE k=1 AND c=1;", flush)
- assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, 1])
- assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+ start = time.time()
+ # update unselected with ttl=30, view row should be alive
+ update_time = self.update_view(session, "UPDATE t USING TTL 30 SET f=1 WHERE k=1 AND c=1;", flush)
+ try:
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+ except AssertionError as ae:
+ if (time.time() - start) >= 30:
+ pytest.fail("Please increase the 30 TTL which expired before we could test due to a slow env.")
+ else:
+ raise ae
- time.sleep(20)
+ wait_time = update_time + 30 - time.time()
+ if wait_time > 0:
+ time.sleep(wait_time)
# view row still alive due to base livenessInfo
assert_none(session, "SELECT * FROM t")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org