Skip to content

Commit

Permalink
Clear out the cache entirely on master->non-master
Browse files Browse the repository at this point in the history
  • Loading branch information
joegallo committed Jan 6, 2022
1 parent 333215d commit 3126e40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Expand Up @@ -303,6 +303,7 @@ public void clusterChanged(ClusterChangedEvent event) {
} else {
// we were the master, and now we aren't
cancelJob();
policyRegistry.clear();
}
}

Expand Down
Expand Up @@ -163,6 +163,18 @@ public void delete(Index deleted) {
cachedSteps.remove(deleted);
}

/**
* Clear internal maps that were populated by update (and others).
*/
public void clear() {
// this is potentially large, so it's important to clear it
cachedSteps.clear();
// these are relatively small, but there's no harm in clearing them
lifecyclePolicyMap.clear();
firstStepMap.clear();
stepMap.clear();
}

/**
* Return all ordered steps for the current policy for the index. Does not
* resolve steps using the phase caching, but only for the currently existing policy.
Expand Down

0 comments on commit 3126e40

Please sign in to comment.