You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2025/09/23 22:39:17 UTC
[M] Change in asterixdb[phoenix]: [ASTERIXDB-3647][TEST] Use InfiniteRetryPolicy
From Ian Maxon <im...@apache.org>:
Ian Maxon has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20407?usp=email )
Change subject: [ASTERIXDB-3647][TEST] Use InfiniteRetryPolicy
......................................................................
[ASTERIXDB-3647][TEST] Use InfiniteRetryPolicy
This was replaced with instantiations of CountRetryPolciy,
which is similar but handles interrupts differently.
Ext-ref: MB-64900
Change-Id: I068f9caa9d9ea800d62954a1963291db074a29c3
---
A asterixdb/asterix-active/src/main/java/org/apache/asterix/active/InfiniteRetryPolicy.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java
2 files changed, 47 insertions(+), 3 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/07/20407/1
diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/InfiniteRetryPolicy.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/InfiniteRetryPolicy.java
new file mode 100644
index 0000000..6f43c64
--- /dev/null
+++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/InfiniteRetryPolicy.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.active;
+
+import org.apache.hyracks.util.IRetryPolicy;
+
+public class InfiniteRetryPolicy implements IRetryPolicy {
+
+ private final IActiveEntityEventsListener listener;
+
+ public InfiniteRetryPolicy(IActiveEntityEventsListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ public boolean retry(Throwable failure) {
+ synchronized (listener) {
+ try {
+ listener.wait(5000); //NOSONAR this method is being called in a while loop
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java
index 460565c..6f71c03 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/ActiveEventsListenerTest.java
@@ -32,6 +32,7 @@
import org.apache.asterix.active.ActivityState;
import org.apache.asterix.active.EntityId;
+import org.apache.asterix.active.InfiniteRetryPolicy;
import org.apache.asterix.active.NoRetryPolicyFactory;
import org.apache.asterix.app.active.ActiveNotificationHandler;
import org.apache.asterix.app.cc.CcApplicationContext;
@@ -150,8 +151,7 @@
nodeControllers[0] = new TestNodeControllerActor(nodes[0], clusterController);
nodeControllers[1] = new TestNodeControllerActor(nodes[1], clusterController);
listener = new TestEventsListener(clusterController, nodeControllers, jobIdFactory, entityId,
- new ArrayList<>(allDatasets), statementExecutor, appCtx, hcc, locations,
- x -> new CountRetryPolicy(1000));
+ new ArrayList<>(allDatasets), statementExecutor, appCtx, hcc, locations, InfiniteRetryPolicy::new);
users = new TestUserActor[3];
users[0] = newUser("Till", appCtx);
users[1] = newUser("Mike", appCtx);
@@ -1544,7 +1544,7 @@
AlgebricksAbsolutePartitionConstraint locations = new AlgebricksAbsolutePartitionConstraint(nodes);
additionalListeners[i] = listener = new TestEventsListener(clusterController, nodeControllers, jobIdFactory,
entityId, new ArrayList<>(allDatasets), statementExecutor, ccAppCtx, hcc, locations,
- x -> new CountRetryPolicy(1000));
+ InfiniteRetryPolicy::new);
}
Action suspension = users[0].suspendAllActivities(handler);
suspension.sync();
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20407?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: phoenix
Gerrit-Change-Id: I068f9caa9d9ea800d62954a1963291db074a29c3
Gerrit-Change-Number: 20407
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Maxon <im...@apache.org>