This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
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.
What changes were proposed in this pull request?
After switching to testcontainers instead of the embedded kafka in runLocal mode, kafka transactions stopped working, because until the latest version of testcontainers 1.15.2, the properties required for kafka transactions working in single-node mode were not set in the base container:
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1
these changes were added recently in the latest release.
more details about the issue: testcontainers/testcontainers-java#1816
changes in testcontainers in question:
https://github.com/testcontainers/testcontainers-java/blob/master/modules/kafka/src/main/java/org/testcontainers/containers/KafkaContainer.java#L67
Why are the changes needed?
Fixes runLocal mode when using kafka transactions.
Does this PR introduce any user-facing change?
No
How was this patch tested?
docker ps
docker logs -f :container_name
with testcontainers version 1.15.1 logs contains:
[2021-02-21 16:13:36,788] ERROR [KafkaApi-1] Number of alive brokers '1' does not meet the required replication factor '3' for the transactions state topic (configured via 'transaction.state.log.replication.factor'). This error can be ignored if the cluster is starting up and not all brokers are up yet. (kafka.server.KafkaApis)
with version 1.15.2 all's ok:
[2021-02-21 16:12:32,538] INFO [Transaction State Manager 1]: Completed loading transaction metadata from __transaction_state-18 for coordinator epoch 0 (kafka.coordinator.transaction.TransactionStateManager)