temporalio / temporalio/temporal

Replication tasks not cleaned up on source when source/target shard counts differ (pull replication)

Open
#10,224 1 comment 0 reactions 1 assignee View on GitHub

@yux0 is already working on this.

Since Jun 2, 2026.

potential-bug teams/cgs
Dominant language
Go
Stars
23.2k
Forks
1.9k
Avg merge
2d 8h
Merged PRs (30d)
228

Description

Expected behavior

In pull-based replication (history.enableReplicationStream = false), after the standby acks task ID X, the source's per-shard cleanup loop should delete acked replication tasks (type = 4 rows in executions), in case the standby cluster has twice the number of shards as the source cluster

Actual behavior

When the target cluster has twice the number of shards as the source, replication tasks on the source cluster are never deleted, even after:

  • The standby has fully applied all generated replication tasks.
  • A namespace handover successfully promotes the standby to active.

All replication tasks in source cluster accumulate indefinitely. No error is logged.

Steps to reproduce

  1. Set up two clusters with global replication:
    • Cluster A (source): history.numberOfShards = 8192.
    • Cluster B (standby): history.numberOfShards = 16384 (double A's numberOfShards)
    • history.enableReplicationStream = false (default).
    • Both clusters are Enabled = true in the other's cluster metadata.
  2. Register a global namespace replicated from A to B.
  3. Run workflows on A; let B apply the tasks.
  4. Wait several history.ReplicationTaskProcessorCleanupInterval cycles (default 1 minute).
  5. Query Cassandra: SELECT count(*) FROM executions WHERE shard_id = <s> AND type = 4 .... Count grows monotonically, never shrinks.

Specifications

$ tdbg shard describe --shard-id 19
{
  "shardId": 19,
  "rangeId": "187",
  "owner": "10.0.73.95:7234-108-15476a71-98f8-443f-998f-c530e0db169c",
  "updateTime": "2026-05-07T06:24:20.449962317Z",
  "queueStates": {
    "1": {
      "exclusiveReaderHighWatermark": {
        "fireTime": "1970-01-01T00:00:00Z",
        "taskId": "196681394"
      }
    },
    "2": {
      "exclusiveReaderHighWatermark": {
        "fireTime": "2026-05-07T06:23:39.096Z"
      }
    },
    "3": {
      "readerStates": {
        "12884901907": {
          "scopes": [
            {
              "range": {
                "inclusiveMin": {
                  "fireTime": "1970-01-01T00:00:00Z",
                  "taskId": "196681394"
                },
                "exclusiveMax": {
                  "fireTime": "1970-01-01T00:00:00Z",
                  "taskId": "9223372036854775807"
                }
              },
              "predicate": {
                "predicateType": "Universal"
              }
            }
          ]
        }
      }
    },
    "4": {
      "exclusiveReaderHighWatermark": {
        "fireTime": "1970-01-01T00:00:00Z",
        "taskId": "196681394"
      }
    }
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.