Argument to Support Server-Side Calculated Replication Factor #419
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses issue #409.
The problem centers around self-hosted Confluent Kafka requiring the
replication_factor
in thekafka_topic
resource to be set to-1
for the configuration ofconfluent.placement.constraints
(used for multi-region clusters). The kafka_topic resource requires that the "replication_factor" is at least 1 or greater.This causes a client-side error:
This most likely occurs because of a request being malformed by the client library or the message was sent to an incompatible broker. See the broker logs for more details.
and a server-side InvalidRequestException:Both replicationFactor and confluent.placement.constraints are set. Both cannot be used at the same time.
In this PR, I'm introducing a new argument named
managed_replication_factor
to resolve this issue. This new addition is an optional boolean parameter; when given a 'true' value, it indicates server-side computation of thereplication_factor
. It instructs the provider to disregard any changes to thereplication_factor
, setting the value instead to-1
when creating a topic.This approach enables the usage of
confluent.placement.constraints
config on Confluent Kafka, illustrated as follows:If
managed_replication_factor
is set on an Apache Kafka cluster, the broker will use itsdefault.replication.factor
setting, which defaults to 1.I've also added acceptance tests for a few scenarios like switching the 'managed_replication_factor' on and off, and modifying partition/replication_factor values.
@Mongey, is this something you would consider merging into the provider? Happy to make any changes based on your feedback.