apache/pulsar · warning · RestException

Number of transaction coordinators should be more than the c

Error message

Number of transaction coordinators should be more than the current number of transaction coordinator

What it means

Thrown by the broker admin API when scaling up transaction coordinators via internalScaleTransactionCoordinators. The partitioned topic that stores coordinator assignments (persistent://pulsar/system/transaction_coordinator_assign) already has at least as many partitions as the requested replica count. The scale operation only supports increasing the count, so a request that does not grow the partition count is rejected with HTTP 406 NOT_ACCEPTABLE.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TransactionsBase.java:550

            this.topicName = TopicName.get(TopicDomain.persistent.toString(), namespaceName, topic);
        } catch (IllegalArgumentException e) {
            log.warn()
                    .attr("domain", domain())
                    .attr("tenant", tenant)
                    .attr("namespace", namespace)
                    .attr("topic", topic)
                    .exception(e)
                    .log("Failed to validate topic name");
            throw new RestException(Response.Status.PRECONDITION_FAILED, "Topic name is not valid");
        }
    }

    protected CompletableFuture<Void> internalScaleTransactionCoordinators(int replicas) {
        return validateSuperUserAccessAsync()
                .thenCompose((ignore) -> namespaceResources().getPartitionedTopicResources()
                        .updatePartitionedTopicAsync(SystemTopicNames.TRANSACTION_COORDINATOR_ASSIGN, p -> {
                            if (p.partitions >= replicas) {
                                throw new RestException(Response.Status.NOT_ACCEPTABLE,
                                        "Number of transaction coordinators should "
                                                + "be more than the current number of transaction coordinator");
                            }
                            return new PartitionedTopicMetadata(replicas);
                        }));
    }

    protected CompletableFuture<PositionInPendingAckStats> internalGetPositionStatsPendingAckStats(
            boolean authoritative, String subName, Position position, Integer batchIndex) {
        CompletableFuture<PositionInPendingAckStats> completableFuture = new CompletableFuture<>();
        getExistingPersistentTopicAsync(authoritative)
                .thenAccept(topic -> {
                    PositionInPendingAckStats result = topic.getSubscription(subName)
                    .checkPositionInPendingAckState(position, batchIndex);
                    completableFuture.complete(result);
                }).exceptionally(ex -> {
                    completableFuture.completeExceptionally(ex);
                    return null;

View on GitHub (pinned to 820761864e)

Solutions

  1. Query the current partition count of system topic 'persistent://pulsar/system/transaction_coordinator_assign' and only call the scale endpoint when replicas > current count.
  2. If the request is idempotent automation, treat HTTP 406 with this message as success (already at target count) rather than an error.
  3. Downscaling is not supported by this API; if fewer coordinators are needed, follow the Pulsar docs/manual procedure or upgrade to a version that supports shrinking coordinators.

Example fix

// before
admin.transactionCoordinators().scaleTransactionCoordinatorCount(4);

// after
int current = admin.namespaces().getPartitionedTopicMetadata(
        "persistent://pulsar/system/transaction_coordinator_assign").partitions;
if (4 > current) {
    admin.transactionCoordinators().scaleTransactionCoordinatorCount(4);
}
Defensive patterns

Strategy: validation

Validate before calling

final PartitionedTopicMetadata md = admin
    .namespaces()
    .getPartitionedTopicMetadata("persistent://pulsar/system/transaction_coordinator_assign")
    .get();
if (targetReplicas <= md.partitions) {
    throw new IllegalArgumentException("replicas must be > current " + md.partitions);
}
admin.transactionCoordinators().scaleTransactionCoordinatorCount(targetReplicas);

Prevention

When it happens

Trigger: PUT/POST to the transaction-coordinator scale admin endpoint (internalScaleTransactionCoordinators) with replicas <= the current partition count of the transaction_coordinator_assign partitioned topic — e.g. calling scaleTransactionCoordinatorCount(4) when 4 coordinators already exist, or re-submitting the same value.

Common situations: Automation/idempotent deploy scripts that re-apply a desired coordinator count on every run; operators unaware the endpoint only scales up (no shrink supported); copying a config value from another cluster that already has more coordinators; retrying a previously successful scale request.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/d355afee2f1816de. Report an issue: GitHub.