Skip to content
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

[apache/helix] -- Added cache refresh trigger after cleaning up of a workflow. #2958

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ private void cleanupWorkflow(String workflow) {
// clean all the contexts even if Configs and IdealStates are exists. Then all the workflows
// and jobs will rescheduled again.
removeContexts(workflow, jobs, _clusterDataCache.getTaskDataCache());
// Request for full-data refresh to re-fetch workflow resource configs.
_clusterDataCache.requireFullRefresh();
himanshukandwal marked this conversation as resolved.
Show resolved Hide resolved
}
} else {
LOG.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.helix.task.JobQueue;
import org.apache.helix.task.TaskState;
import org.apache.helix.task.TaskUtil;
import org.apache.helix.task.Workflow;
import org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
Expand Down Expand Up @@ -85,6 +86,36 @@ public void testDeleteWorkflow() throws InterruptedException {
Assert.assertNull(_driver.getWorkflowContext(jobQueueName));
}

@Test
public void testDeleteWorkflowAndRecreate() throws Exception {
himanshukandwal marked this conversation as resolved.
Show resolved Hide resolved
String workflowId_1 = TestHelper.getTestMethodName();
String workflowId_2 = TestHelper.getTestMethodName() + "1";
String workflowId_3 = TestHelper.getTestMethodName() + "2";

Workflow.Builder builder_1 = WorkflowGenerator.generateDefaultSingleJobWorkflowBuilder(workflowId_1);
Workflow.Builder builder_2 = WorkflowGenerator.generateDefaultSingleJobWorkflowBuilder(workflowId_2);
Workflow.Builder builder_3 = WorkflowGenerator.generateDefaultSingleJobWorkflowBuilder(workflowId_3);

_driver.start(builder_1.build());

TaskState polledState = _driver.pollForWorkflowState(workflowId_1, 2_000L, TaskState.COMPLETED, TaskState.FAILED);
Assert.assertEquals(TaskState.COMPLETED, polledState);
Assert.assertNotNull(_driver.getWorkflowConfig(workflowId_1));

// delete workflowId_1 and start other workflows
_driver.start(builder_2.build());
_driver.deleteAndWaitForCompletion(workflowId_1, 2_000);
_driver.start(builder_3.build());
Assert.assertNull(_driver.getWorkflowConfig(workflowId_1));

// re-create workflowId_1
_driver.start(builder_1.build());
TaskState recreatedPolledState = _driver.pollForWorkflowState(workflowId_1, 40_000L, TaskState.COMPLETED, TaskState.FAILED);
Assert.assertEquals(TaskState.COMPLETED, recreatedPolledState);
Assert.assertNotNull(_driver.getWorkflowConfig(workflowId_1));
Assert.assertNotNull(_driver.getWorkflowContext(workflowId_1));
}

@Test
public void testDeleteWorkflowForcefully() throws InterruptedException {
String jobQueueName = TestHelper.getTestMethodName();
Expand Down
Loading