abdullah alamoudi has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/2845
Change subject: [ASTERIXDB-2065][ING] Make stop timeout configurable
......................................................................
[ASTERIXDB-2065][ING] Make stop timeout configurable
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Make timeout of a graceful stop of an active job
configurable.
Change-Id: Id8d0c205a6959967dbce2b7223061ffa2f26059c
---
M
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveEntityEventsListener.java
M
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ActiveProperties.java
2 files changed, 14 insertions(+), 6 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/45/2845/1
diff --git
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveEntityEventsListener.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveEntityEventsListener.java
index b5432c5..2b53b6d 100644
---
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveEntityEventsListener.java
+++
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveEntityEventsListener.java
@@ -74,10 +74,7 @@
private static final EnumSet<ActivityState> TRANSITION_STATES =
EnumSet.of(ActivityState.RESUMING,
ActivityState.STARTING, ActivityState.STOPPING,
ActivityState.RECOVERING, ActivityState.CANCELLING);
private static final String DEFAULT_ACTIVE_STATS = "{\"Stats\":\"N/A\"}";
- // TODO: Make configurable
https://issues.apache.org/jira/browse/ASTERIXDB-2065
- protected static final long STOP_MESSAGE_TIMEOUT = 5L;
- protected static final long SUSPEND_MESSAGE_TIMEOUT = 10L;
- protected static final TimeUnit TIMEOUT_UNIT = TimeUnit.MINUTES;
+ protected static final TimeUnit TIMEOUT_UNIT = TimeUnit.SECONDS;
protected final IClusterStateManager clusterStateManager;
protected final ActiveNotificationHandler handler;
protected final List<IActiveEntityEventSubscriber> subscribers = new
ArrayList<>();
@@ -517,7 +514,7 @@
} else if (state == ActivityState.RUNNING) {
setState(ActivityState.STOPPING);
try {
- doStop(metadataProvider, STOP_MESSAGE_TIMEOUT, TIMEOUT_UNIT);
+ doStop(metadataProvider,
appCtx.getActiveProperties().getActiveStopTimeout(), TIMEOUT_UNIT);
} catch (Exception e) {
setState(ActivityState.STOPPED);
LOGGER.log(Level.ERROR, "Failed to stop the entity " +
entityId, e);
diff --git
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ActiveProperties.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ActiveProperties.java
index 8455a6f..75c6fde 100644
---
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ActiveProperties.java
+++
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ActiveProperties.java
@@ -18,6 +18,7 @@
*/
package org.apache.asterix.common.config;
+import static org.apache.hyracks.control.common.config.OptionTypes.INTEGER;
import static
org.apache.hyracks.control.common.config.OptionTypes.LONG_BYTE_UNIT;
import static org.apache.hyracks.util.StorageUtil.StorageUnit.MEGABYTE;
@@ -32,7 +33,9 @@
ACTIVE_MEMORY_GLOBAL_BUDGET(
LONG_BYTE_UNIT,
StorageUtil.getLongSizeInBytes(64L, MEGABYTE),
- "The memory budget (in bytes) for the active runtime");
+ "The memory budget (in bytes) for the active runtime"),
+ ACTIVE_STOP_TIMEOUT(INTEGER, 300, "The maximum time to wait for a
graceful stop of an active runtime"),
+ ACTIVE_SUSPEND_TIMEOUT(INTEGER, 600, "The maximum time to wait for a
graceful suspend of an active runtime");
private final IOptionType type;
private final Object defaultValue;
@@ -72,4 +75,12 @@
public long getMemoryComponentGlobalBudget() {
return accessor.getLong(Option.ACTIVE_MEMORY_GLOBAL_BUDGET);
}
+
+ public int getActiveStopTimeout() {
+ return accessor.getInt(Option.ACTIVE_STOP_TIMEOUT);
+ }
+
+ public int getActiveSuspendTimeout() {
+ return accessor.getInt(Option.ACTIVE_SUSPEND_TIMEOUT);
+ }
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/2845
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8d0c205a6959967dbce2b7223061ffa2f26059c
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <[email protected]>