abdullah alamoudi has submitted this change and it was merged. Change subject: [NO ISSUE][ING] Prevent duplicate active runtimes in NCs ......................................................................
[NO ISSUE][ING] Prevent duplicate active runtimes in NCs - user model changes: no - storage format changes: no - interface changes: no details: - Previously, when an active runtime is registered, we ignore if the runtime id is already registered. - After this change, such operation will throw an exception. Change-Id: Id7065625537f930394fa7387af2fd1e851582c86 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2392 Sonar-Qube: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> --- M asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveEntityEventsListener.java 2 files changed, 7 insertions(+), 5 deletions(-) Approvals: Jenkins: Verified; No violations found; ; Verified Michael Blow: Looks good to me, approved diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java index f9aef4c..bb76204 100644 --- a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java +++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java @@ -73,7 +73,9 @@ if (shutdown) { throw new RuntimeDataException(ErrorCode.ACTIVE_MANAGER_SHUTDOWN); } - runtimes.putIfAbsent(runtime.getRuntimeId(), runtime); + if (runtimes.putIfAbsent(runtime.getRuntimeId(), runtime) != null) { + throw new IllegalStateException("Active Runtime " + runtime.getRuntimeId() + " is already registered"); + } } public void deregisterRuntime(ActiveRuntimeId id) { 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 1758daa..2a214e3 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 @@ -182,8 +182,9 @@ protected void finish(ActiveEvent event) throws HyracksDataException { LOGGER.log(level, "the job " + jobId + " finished"); if (numRegistered != numDeRegistered) { - LOGGER.log(Level.WARN, "the job " + jobId + " finished with reported runtime registrations = " - + numRegistered + " and deregistrations = " + numDeRegistered + " on node controllers"); + LOGGER.log(Level.WARN, + "the job {} finished with reported runtime registrations = {} and deregistrations = {}", jobId, + numRegistered, numDeRegistered); } jobId = null; Pair<JobStatus, List<Exception>> status = (Pair<JobStatus, List<Exception>>) event.getEventObject(); @@ -194,8 +195,7 @@ jobFailure = exceptions.isEmpty() ? new RuntimeDataException(ErrorCode.UNREPORTED_TASK_FAILURE_EXCEPTION) : exceptions.get(0); setState((state == ActivityState.STOPPING) ? ActivityState.STOPPED : ActivityState.TEMPORARILY_FAILED); - if (prevState != ActivityState.SUSPENDING && prevState != ActivityState.RECOVERING - && prevState != ActivityState.RESUMING && prevState != ActivityState.STOPPING) { + if (prevState == ActivityState.RUNNING) { recover(); } } else { -- To view, visit https://asterix-gerrit.ics.uci.edu/2392 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id7065625537f930394fa7387af2fd1e851582c86 Gerrit-PatchSet: 14 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: abdullah alamoudi <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
