This is an automated email from the ASF dual-hosted git repository.
maedhroz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 092bb60 Take into account starting session size when making
assertions about its size after task execution completes
092bb60 is described below
commit 092bb60ba413b8ef0eb9e0de86ce394a2f939084
Author: Caleb Rackliffe <[email protected]>
AuthorDate: Tue Nov 9 16:57:10 2021 -0600
Take into account starting session size when making assertions about its
size after task execution completes
patch by Caleb Rackliffe; reviewed by David Capwell for CASSANDRA-17039
---
test/unit/org/apache/cassandra/repair/RepairJobTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/unit/org/apache/cassandra/repair/RepairJobTest.java
b/test/unit/org/apache/cassandra/repair/RepairJobTest.java
index cfe7297..f4d2367 100644
--- a/test/unit/org/apache/cassandra/repair/RepairJobTest.java
+++ b/test/unit/org/apache/cassandra/repair/RepairJobTest.java
@@ -259,13 +259,17 @@ public class RepairJobTest
// SyncTasks themselves should not contain significant memory
SyncTaskListAssert.assertThat(syncTasks).hasSizeLessThan(0.2 *
singleTreeSize);
+ // Remember the size of the session before we've executed any tasks
+ long sizeBeforeExecution = ObjectSizes.measureDeep(session);
+
// block syncComplete execution until test has verified session still
retains the trees
CompletableFuture<?> future = new CompletableFuture<>();
session.registerSyncCompleteCallback(future::get);
ListenableFuture<List<SyncStat>> syncResults =
job.executeTasks(syncTasks);
// Immediately following execution the internal execution queue should
still retain the trees
-
assertThat(ObjectSizes.measureDeep(session)).isGreaterThan(singleTreeSize);
+ long sizeDuringExecution = ObjectSizes.measureDeep(session);
+ assertThat(sizeDuringExecution).isGreaterThan(sizeBeforeExecution +
(syncTasks.size() * singleTreeSize));
// unblock syncComplete callback, session should remove trees
future.complete(null);
@@ -274,9 +278,8 @@ public class RepairJobTest
long millisUntilFreed;
for (millisUntilFreed = 0; millisUntilFreed < TEST_TIMEOUT_S * 1000;
millisUntilFreed += THREAD_TIMEOUT_MILLIS)
{
- // The measured size of the syncingTasks, and result of the
computation should be much smaller
TimeUnit.MILLISECONDS.sleep(THREAD_TIMEOUT_MILLIS);
- if (ObjectSizes.measureDeep(session) < 0.8 * singleTreeSize)
+ if (ObjectSizes.measureDeep(session) < (sizeDuringExecution -
(syncTasks.size() * singleTreeSize)))
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]