temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Add namespace.ActiveInCluster(clusterName) check in archival task executor

Open tsurdilo opened this issue 5 months ago • 2 comments

Currently archival task executor is not gated behind a namespace.ActiveInCluster(clusterName) check, meaning with replication both active and standby cluster are archiving executions for global namespace (both history and visibility archival) this situation can potentially put extra pressure archival store

server includes check if record exists before writing, for history archival, but seems not to have this check for visibility data archival

ask here is to add a gate for archival executor to push to archival only if namespace is active

tsurdilo avatar Jun 30 '26 12:06 tsurdilo

Hi, I'd like to take on this issue. Can I?

If I can, two quick questions before I open a PR:

  1. The title says ActiveInCluster, but since the task is per-workflow, would you rather use the businessID-aware ActiveClusterName? Same result for a normal global namespace, but it also handles active-active correctly.
  2. Skipping archival on standby is easy since deletion runs separately per cluster. My only worry: if the active check is ever wrong on the real active cluster, we'd skip archival but still delete, dropping history that was never archived (visibility has no dedup). Worth putting behind a dynamic config kill switch (default on), or keep it unconditional?

Scope I'm assuming: gate covers both history and visibility, deletion untouched. Sound right?

ridwanakf avatar Jul 08 '26 04:07 ridwanakf

Opened #10990 for this.

Assumptions I made, happy to change any of them:

  • Used ActiveClusterName(RoutingKey{ID: workflowID}) rather than ActiveInCluster — the task is per-workflow, and the linter steers workflow-scoped checks to the routing-key API, which also handles active-active namespaces correctly. Same result for a normal global namespace.
  • Gate covers both history and visibility, and only global namespaces (local namespaces are active everywhere, so they still archive).
  • Deletion is untouched: a standby cluster skips the archive push but still schedules the retention deletion task, and the archival task acks as usual.
  • Put it behind history.archivalQueueArchiveOnlyOnActiveCluster (default on) so it can be turned off without a deploy if the activeness check ever misfires — visibility archival has no exists-check to fall back on. Happy to drop the flag if you'd rather it be unconditional.

ridwanakf avatar Jul 09 '26 07:07 ridwanakf