Skip to content
Browse files
Fixed size history for Scheduled Workflow tasks (#2036)
Once we execute scheduled workflow task, we append entry to history.
Each entry is of the format "<taskname>-<timestamp>"

But we never purged old entries.
This will result in hitting size limit of Znode.

Introducing fixed size history of 20 and purge all the previous entries.
  • Loading branch information
desaikomal committed Apr 16, 2022
1 parent 9c1a90d commit 5335b6339a64760c9e1442120c12c6297505ad5d
Showing 1 changed file with 7 additions and 0 deletions.
@@ -57,6 +57,9 @@ protected enum WorkflowContextProperties {
// Otherwise, the context will not be written to ZK by the controller.
private boolean isModified;

// Have fixed size history of Scheduled Workflow Tasks
private final static int SCHEDULED_WORKFLOW_HISTORY_SIZE = 20;

public WorkflowContext(ZNRecord record) {
isModified = false;
@@ -234,6 +237,10 @@ public void setLastScheduledSingleWorkflow(String workflow) {
if (!scheduledWorkflows.contains(workflow)) {
// This while loop is to cleanup existing scheduled workflows
while (scheduledWorkflows.size() >= SCHEDULED_WORKFLOW_HISTORY_SIZE) {

0 comments on commit 5335b63

Please sign in to comment.