Repository navigation
[GOBBLIN-2270] Add retained-state fallback for KILL actions #4208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Blazer-007
merged 3 commits into
apache:master
from
Siddhi-agg:siagrawa/add-force-kill-handler
Sep 24, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ore/src/test/java/org/apache/gobblin/metastore/MysqlJobStatusStateStoreFlowScopeTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * 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.gobblin.metastore; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Collections; | ||
|
|
||
| import org.testng.Assert; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import org.apache.gobblin.configuration.State; | ||
|
|
||
| import static org.mockito.ArgumentMatchers.anyString; | ||
| import static org.mockito.ArgumentMatchers.eq; | ||
| import static org.mockito.Mockito.CALLS_REAL_METHODS; | ||
| import static org.mockito.Mockito.doReturn; | ||
| import static org.mockito.Mockito.mock; | ||
| import static org.mockito.Mockito.verify; | ||
|
|
||
|
|
||
| public class MysqlJobStatusStateStoreFlowScopeTest { | ||
| @Test | ||
| @SuppressWarnings("unchecked") | ||
| public void testExecutionPrefixIncludesSeparator() throws IOException { | ||
| MysqlJobStatusStateStore<State> store = mock(MysqlJobStatusStateStore.class, CALLS_REAL_METHODS); | ||
| doReturn(Collections.emptyList()).when(store).getAll(eq("group.flow"), anyString(), | ||
| eq(MysqlStateStore.JobStateSearchColumns.TABLE_NAME_ONLY)); | ||
|
|
||
| Assert.assertTrue(store.getAll("group.flow", 1234L).isEmpty()); | ||
|
|
||
| verify(store).getAll("group.flow", "1234.%", MysqlStateStore.JobStateSearchColumns.TABLE_NAME_ONLY); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...vice/src/main/java/org/apache/gobblin/service/modules/orchestration/ForceKillHandler.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * 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.gobblin.service.modules.orchestration; | ||
|
|
||
| import java.io.Closeable; | ||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| import org.apache.gobblin.configuration.State; | ||
|
|
||
|
|
||
| /** | ||
| * Backend-specific handling of an existing KILL action after its active DAG has been removed. | ||
| * | ||
| * <p>The supplied states are the only retained execution metadata source. Implementations must validate backend | ||
| * handles, destinations and their original submission identities, without consulting archived DAGs or guessing | ||
| * destinations from current routing. A flow-summary state is context, not an execution to stop. Implementations | ||
| * must not rewrite terminal job status or emit normal flow/job cancellation events. Bind implementations as | ||
| * singletons so the service manager can close the same instance used by KILL processing.</p> | ||
| */ | ||
| @FunctionalInterface | ||
| public interface ForceKillHandler extends Closeable { | ||
| enum Result { | ||
| /** All identified stop requests were acknowledged; this does not establish physical process termination. */ | ||
| ACKNOWLEDGED, | ||
| /** No execution could be resolved, or at least one stop was not acknowledged. */ | ||
| NOT_ACKNOWLEDGED, | ||
| /** An active DAG was observed; stop retained processing and let normal DAG cancellation take over. */ | ||
| ACTIVE_DAG_PRESENT | ||
| } | ||
|
|
||
| @FunctionalInterface | ||
| interface ActiveDagCheck { | ||
| boolean isActive() throws IOException; | ||
| } | ||
|
|
||
| /** | ||
| * Attempt bounded, backend-specific stopping using defensive copies of the retained job states. | ||
| * | ||
| * @param action the exact flow execution and optional job requested for cancellation | ||
| * @param jobStates scoped job states and, if retained, the flow-summary state; the list is unmodifiable | ||
| * @param activeDagCheck must be checked before each backend stop; return {@link Result#ACTIVE_DAG_PRESENT} if true. | ||
| * This reduces, but does not atomically exclude, concurrent resume. | ||
| * @throws IOException when the operation cannot be completed; failures must not be reported as acknowledgements | ||
| */ | ||
| Result forceKill(DagActionStore.DagAction action, List<State> jobStates, ActiveDagCheck activeDagCheck) | ||
| throws IOException; | ||
|
|
||
| /** Stop accepting work and release local resources without waiting indefinitely for remote calls. Must be idempotent. */ | ||
| @Override | ||
| default void close() { | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.