Skip to content

Lower the replication factor for transactions topic when using embedded Kafka broker for tests #3557

Closed
@dlyash

Description

@dlyash

Expected Behavior

It would be nice if the embedded broker started by @EmbeddedKafka (or the similar JUnit Rule) defaulted the replication factor for the transaction state topic to the number of brokers, or a min(<number-of-brokers>, 3).

Current Behavior
The embedded broker starts with the default configuration of transaction.state.log.replication.factor = 3 which doesn't make sense for a single-broker cluster, which is quite common in tests:

org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 3 larger than available brokers: 1.

Context
It's not a big deal, as it can be resolved by explicitly setting broker properties like follows. But a meaningful default would save some time for thousands of developers googling the problem again and again.

@EmbeddedKafka(brokerProperties={
    "transaction.state.log.replication.factor=1"
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions