Class TransactionManagerTest

java.lang.Object
org.apache.kafka.clients.producer.internals.TransactionManagerTest

public class TransactionManagerTest extends Object
  • Constructor Details

    • TransactionManagerTest

      public TransactionManagerTest()
  • Method Details

    • setup

      @BeforeEach public void setup()
    • testSenderShutdownWithPendingTransactions

      @Test public void testSenderShutdownWithPendingTransactions() throws Exception
      Throws:
      Exception
    • testEndTxnNotSentIfIncompleteBatches

      @Test public void testEndTxnNotSentIfIncompleteBatches()
    • testFailIfNotReadyForSendNoProducerId

      @Test public void testFailIfNotReadyForSendNoProducerId()
    • testFailIfNotReadyForSendIdempotentProducer

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testFailIfNotReadyForSendIdempotentProducer(boolean transactionV2Enabled)
    • testFailIfNotReadyForSendIdempotentProducerFatalError

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testFailIfNotReadyForSendIdempotentProducerFatalError(boolean transactionV2Enabled)
    • testFailIfNotReadyForSendNoOngoingTransaction

      @Test public void testFailIfNotReadyForSendNoOngoingTransaction()
    • testFailIfNotReadyForSendAfterAbortableError

      @Test public void testFailIfNotReadyForSendAfterAbortableError()
    • testFailIfNotReadyForSendAfterFatalError

      @Test public void testFailIfNotReadyForSendAfterFatalError()
    • testHasOngoingTransactionSuccessfulAbort

      @Test public void testHasOngoingTransactionSuccessfulAbort()
    • testHasOngoingTransactionSuccessfulCommit

      @Test public void testHasOngoingTransactionSuccessfulCommit()
    • testHasOngoingTransactionAbortableError

      @Test public void testHasOngoingTransactionAbortableError()
    • testHasOngoingTransactionFatalError

      @Test public void testHasOngoingTransactionFatalError()
    • testMaybeAddPartitionToTransaction

      @Test public void testMaybeAddPartitionToTransaction()
    • testMaybeAddPartitionToTransactionInTransactionV2

      @Test public void testMaybeAddPartitionToTransactionInTransactionV2()
    • testAddPartitionToTransactionOverridesRetryBackoffForConcurrentTransactions

      @Test public void testAddPartitionToTransactionOverridesRetryBackoffForConcurrentTransactions()
    • testAddPartitionToTransactionRetainsRetryBackoffForRegularRetriableError

      @Test public void testAddPartitionToTransactionRetainsRetryBackoffForRegularRetriableError()
    • testAddPartitionToTransactionRetainsRetryBackoffWhenPartitionsAlreadyAdded

      @Test public void testAddPartitionToTransactionRetainsRetryBackoffWhenPartitionsAlreadyAdded()
    • testNotReadyForSendBeforeInitTransactions

      @Test public void testNotReadyForSendBeforeInitTransactions()
    • testNotReadyForSendBeforeBeginTransaction

      @Test public void testNotReadyForSendBeforeBeginTransaction()
    • testNotReadyForSendAfterAbortableError

      @Test public void testNotReadyForSendAfterAbortableError()
    • testNotReadyForSendAfterFatalError

      @Test public void testNotReadyForSendAfterFatalError()
    • testIsSendToPartitionAllowedWithPendingPartitionAfterAbortableError

      @Test public void testIsSendToPartitionAllowedWithPendingPartitionAfterAbortableError()
    • testIsSendToPartitionAllowedWithInFlightPartitionAddAfterAbortableError

      @Test public void testIsSendToPartitionAllowedWithInFlightPartitionAddAfterAbortableError()
    • testIsSendToPartitionAllowedWithPendingPartitionAfterFatalError

      @Test public void testIsSendToPartitionAllowedWithPendingPartitionAfterFatalError()
    • testIsSendToPartitionAllowedWithInFlightPartitionAddAfterFatalError

      @Test public void testIsSendToPartitionAllowedWithInFlightPartitionAddAfterFatalError()
    • testIsSendToPartitionAllowedWithAddedPartitionAfterAbortableError

      @Test public void testIsSendToPartitionAllowedWithAddedPartitionAfterAbortableError()
    • testIsSendToPartitionAllowedWithAddedPartitionAfterFatalError

      @Test public void testIsSendToPartitionAllowedWithAddedPartitionAfterFatalError()
    • testIsSendToPartitionAllowedWithPartitionNotAdded

      @Test public void testIsSendToPartitionAllowedWithPartitionNotAdded()
    • testDefaultSequenceNumber

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testDefaultSequenceNumber(boolean transactionV2Enabled)
    • testBumpEpochAndResetSequenceNumbersAfterUnknownProducerId

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testBumpEpochAndResetSequenceNumbersAfterUnknownProducerId(boolean transactionV2Enabled)
    • testBatchFailureAfterProducerReset

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testBatchFailureAfterProducerReset(boolean transactionV2Enabled)
    • testBatchCompletedAfterProducerReset

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testBatchCompletedAfterProducerReset(boolean transactionV2Enabled)
    • testDuplicateSequenceAfterProducerReset

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testDuplicateSequenceAfterProducerReset(boolean transactionV2Enabled) throws Exception
      Throws:
      Exception
    • testSequenceNumberOverflow

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testSequenceNumberOverflow(boolean transactionV2Enabled)
    • testProducerIdReset

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testProducerIdReset(boolean transactionV2Enabled)
    • testBasicTransaction

      @Test public void testBasicTransaction() throws InterruptedException
      Throws:
      InterruptedException
    • testTransactionManagerEnablesV2

      @Test public void testTransactionManagerEnablesV2()
    • testTransactionV2AddPartitionAndOffsets

      @Test public void testTransactionV2AddPartitionAndOffsets() throws InterruptedException
      Throws:
      InterruptedException
    • testTransactionManagerDisablesV2

      @Test public void testTransactionManagerDisablesV2()
    • testDisconnectAndRetry

      @Test public void testDisconnectAndRetry()
    • testInitializeTransactionsTwiceRaisesError

      @Test public void testInitializeTransactionsTwiceRaisesError()
    • testUnsupportedFindCoordinator

      @Test public void testUnsupportedFindCoordinator()
    • testUnsupportedInitTransactions

      @Test public void testUnsupportedInitTransactions()
    • testUnsupportedForMessageFormatInTxnOffsetCommit

      @Test public void testUnsupportedForMessageFormatInTxnOffsetCommit()
    • testFencedInstanceIdInTxnOffsetCommitByGroupMetadata

      @Test public void testFencedInstanceIdInTxnOffsetCommitByGroupMetadata()
    • testUnknownMemberIdInTxnOffsetCommitByGroupMetadata

      @Test public void testUnknownMemberIdInTxnOffsetCommitByGroupMetadata()
    • testIllegalGenerationInTxnOffsetCommitByGroupMetadata

      @Test public void testIllegalGenerationInTxnOffsetCommitByGroupMetadata()
    • testGroupMetadataMismatchErrorInTxnOffsetCommit

      @ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"GROUP_ID_NOT_FOUND","STALE_MEMBER_EPOCH"}) public void testGroupMetadataMismatchErrorInTxnOffsetCommit(org.apache.kafka.common.protocol.Errors error)
    • testLookupCoordinatorOnDisconnectAfterSend

      @Test public void testLookupCoordinatorOnDisconnectAfterSend()
    • testLookupCoordinatorOnDisconnectBeforeSend

      @Test public void testLookupCoordinatorOnDisconnectBeforeSend()
    • testLookupCoordinatorOnNotCoordinatorError

      @Test public void testLookupCoordinatorOnNotCoordinatorError()
    • testTransactionalIdAuthorizationFailureInFindCoordinator

      @Test public void testTransactionalIdAuthorizationFailureInFindCoordinator()
    • testTransactionalIdAuthorizationFailureInInitProducerId

      @Test public void testTransactionalIdAuthorizationFailureInInitProducerId()
    • testGroupAuthorizationFailureInFindCoordinator

      @Test public void testGroupAuthorizationFailureInFindCoordinator()
    • testGroupAuthorizationFailureInTxnOffsetCommit

      @Test public void testGroupAuthorizationFailureInTxnOffsetCommit()
    • testFatalErrorWhenProduceResponseWithInvalidPidMapping

      @Test public void testFatalErrorWhenProduceResponseWithInvalidPidMapping() throws InterruptedException
      Throws:
      InterruptedException
    • testTransactionalIdAuthorizationFailureInAddOffsetsToTxn

      @Test public void testTransactionalIdAuthorizationFailureInAddOffsetsToTxn()
    • testInvalidTxnStateFailureInAddOffsetsToTxn

      @Test public void testInvalidTxnStateFailureInAddOffsetsToTxn()
    • testTransactionalIdAuthorizationFailureInTxnOffsetCommit

      @Test public void testTransactionalIdAuthorizationFailureInTxnOffsetCommit()
    • testTopicAuthorizationFailureInAddPartitions

      @Test public void testTopicAuthorizationFailureInAddPartitions() throws InterruptedException
      Throws:
      InterruptedException
    • testCommitWithTopicAuthorizationFailureInAddPartitionsInFlight

      @Test public void testCommitWithTopicAuthorizationFailureInAddPartitionsInFlight() throws InterruptedException
      Throws:
      InterruptedException
    • testRecoveryFromAbortableErrorTransactionNotStarted

      @Test public void testRecoveryFromAbortableErrorTransactionNotStarted() throws Exception
      Throws:
      Exception
    • testRetryAbortTransactionAfterTimeout

      @Test public void testRetryAbortTransactionAfterTimeout() throws Exception
      Throws:
      Exception
    • testRetryCommitTransactionAfterTimeout

      @Test public void testRetryCommitTransactionAfterTimeout() throws Exception
      Throws:
      Exception
    • testRetryInitTransactionsAfterTimeout

      @Test public void testRetryInitTransactionsAfterTimeout()
    • testRecoveryFromAbortableErrorTransactionStarted

      @Test public void testRecoveryFromAbortableErrorTransactionStarted() throws Exception
      Throws:
      Exception
    • testRecoveryFromAbortableErrorProduceRequestInRetry

      @Test public void testRecoveryFromAbortableErrorProduceRequestInRetry() throws Exception
      Throws:
      Exception
    • testTransactionalIdAuthorizationFailureInAddPartitions

      @Test public void testTransactionalIdAuthorizationFailureInAddPartitions()
    • testInvalidTxnStateInAddPartitions

      @Test public void testInvalidTxnStateInAddPartitions()
    • testFlushPendingPartitionsOnCommit

      @Test public void testFlushPendingPartitionsOnCommit() throws InterruptedException
      Throws:
      InterruptedException
    • testMultipleAddPartitionsPerForOneProduce

      @Test public void testMultipleAddPartitionsPerForOneProduce() throws InterruptedException
      Throws:
      InterruptedException
    • testRetriableErrors

      @ParameterizedTest @EnumSource(names={"UNKNOWN_TOPIC_OR_PARTITION","REQUEST_TIMED_OUT","COORDINATOR_LOAD_IN_PROGRESS","CONCURRENT_TRANSACTIONS"}) public void testRetriableErrors(org.apache.kafka.common.protocol.Errors error)
    • testCoordinatorNotAvailable

      @Test public void testCoordinatorNotAvailable()
    • testProducerFencedExceptionInInitProducerId

      @Test public void testProducerFencedExceptionInInitProducerId()
    • testInvalidProducerEpochConvertToProducerFencedInInitProducerId

      @Test public void testInvalidProducerEpochConvertToProducerFencedInInitProducerId()
    • testProducerFencedInAddPartitionToTxn

      @Test public void testProducerFencedInAddPartitionToTxn() throws InterruptedException
      Throws:
      InterruptedException
    • testInvalidProducerEpochConvertToProducerFencedInAddPartitionToTxn

      @Test public void testInvalidProducerEpochConvertToProducerFencedInAddPartitionToTxn() throws InterruptedException
      Throws:
      InterruptedException
    • testProducerFencedInAddOffSetsToTxn

      @Test public void testProducerFencedInAddOffSetsToTxn() throws InterruptedException
      Throws:
      InterruptedException
    • testInvalidProducerEpochConvertToProducerFencedInAddOffSetsToTxn

      @Test public void testInvalidProducerEpochConvertToProducerFencedInAddOffSetsToTxn() throws InterruptedException
      Throws:
      InterruptedException
    • testInvalidProducerEpochConvertToProducerFencedInEndTxn

      @Test public void testInvalidProducerEpochConvertToProducerFencedInEndTxn() throws InterruptedException
      Throws:
      InterruptedException
    • testInvalidProducerEpochFromProduce

      @Test public void testInvalidProducerEpochFromProduce() throws InterruptedException
      Throws:
      InterruptedException
    • testDisallowCommitOnProduceFailure

      @Test public void testDisallowCommitOnProduceFailure() throws InterruptedException
      Throws:
      InterruptedException
    • testAllowAbortOnProduceFailure

      @Test public void testAllowAbortOnProduceFailure() throws InterruptedException
      Throws:
      InterruptedException
    • testAbortableErrorWhileAbortInProgress

      @Test public void testAbortableErrorWhileAbortInProgress() throws InterruptedException
      Throws:
      InterruptedException
    • testCommitTransactionWithUnsentProduceRequest

      @Test public void testCommitTransactionWithUnsentProduceRequest() throws Exception
      Throws:
      Exception
    • testCommitTransactionWithInFlightProduceRequest

      @Test public void testCommitTransactionWithInFlightProduceRequest() throws Exception
      Throws:
      Exception
    • testFindCoordinatorAllowedInAbortableErrorState

      @Test public void testFindCoordinatorAllowedInAbortableErrorState() throws InterruptedException
      Throws:
      InterruptedException
    • testCancelUnsentAddPartitionsAndProduceOnAbort

      @Test public void testCancelUnsentAddPartitionsAndProduceOnAbort() throws InterruptedException
      Throws:
      InterruptedException
    • testAbortResendsAddPartitionErrorIfRetried

      @Test public void testAbortResendsAddPartitionErrorIfRetried() throws InterruptedException
      Throws:
      InterruptedException
    • testAbortResendsProduceRequestIfRetried

      @Test public void testAbortResendsProduceRequestIfRetried() throws Exception
      Throws:
      Exception
    • testHandlingOfUnknownTopicPartitionErrorOnAddPartitions

      @Test public void testHandlingOfUnknownTopicPartitionErrorOnAddPartitions() throws InterruptedException
      Throws:
      InterruptedException
    • testHandlingOfUnknownTopicPartitionErrorOnTxnOffsetCommit

      @Test public void testHandlingOfUnknownTopicPartitionErrorOnTxnOffsetCommit()
    • testHandlingOfCoordinatorLoadingErrorOnTxnOffsetCommit

      @Test public void testHandlingOfCoordinatorLoadingErrorOnTxnOffsetCommit()
    • testHandlingOfNetworkExceptionOnTxnOffsetCommit

      @Test public void testHandlingOfNetworkExceptionOnTxnOffsetCommit()
    • testHandlingOfProducerFencedErrorOnTxnOffsetCommit

      @Test public void testHandlingOfProducerFencedErrorOnTxnOffsetCommit()
    • testHandlingOfTransactionalIdAuthorizationFailedErrorOnTxnOffsetCommit

      @Test public void testHandlingOfTransactionalIdAuthorizationFailedErrorOnTxnOffsetCommit()
    • testHandlingOfInvalidProducerEpochErrorOnTxnOffsetCommit

      @Test public void testHandlingOfInvalidProducerEpochErrorOnTxnOffsetCommit()
    • testHandlingOfUnsupportedForMessageFormatErrorOnTxnOffsetCommit

      @Test public void testHandlingOfUnsupportedForMessageFormatErrorOnTxnOffsetCommit()
    • testTxnOffsetCommitNegotiatesV6WhenAllTopicIdsAreAvailable

      @Test public void testTxnOffsetCommitNegotiatesV6WhenAllTopicIdsAreAvailable()
    • testTxnOffsetCommitDowngradesToV5WhenAnyTopicIdIsMissing

      @Test public void testTxnOffsetCommitDowngradesToV5WhenAnyTopicIdIsMissing()
    • testTxnOffsetCommitRetriesOnUnknownTopicIdAtV6

      @Test public void testTxnOffsetCommitRetriesOnUnknownTopicIdAtV6()
    • shouldNotAddPartitionsToTransactionWhenTopicAuthorizationFailed

      @Test public void shouldNotAddPartitionsToTransactionWhenTopicAuthorizationFailed() throws Exception
      Throws:
      Exception
    • shouldNotSendAbortTxnRequestWhenOnlyAddPartitionsRequestFailed

      @Test public void shouldNotSendAbortTxnRequestWhenOnlyAddPartitionsRequestFailed()
    • shouldNotSendAbortTxnRequestWhenOnlyAddOffsetsRequestFailed

      @Test public void shouldNotSendAbortTxnRequestWhenOnlyAddOffsetsRequestFailed()
    • shouldFailAbortIfAddOffsetsFailsWithFatalError

      @Test public void shouldFailAbortIfAddOffsetsFailsWithFatalError()
    • testSendOffsetsWithGroupMetadata

      @Test public void testSendOffsetsWithGroupMetadata()
    • testSendOffsetWithGroupMetadataFailAsAutoDowngradeTxnCommitNotEnabled

      @Test public void testSendOffsetWithGroupMetadataFailAsAutoDowngradeTxnCommitNotEnabled()
    • testNoDrainWhenPartitionsPending

      @Test public void testNoDrainWhenPartitionsPending() throws InterruptedException
      Throws:
      InterruptedException
    • testAllowDrainInAbortableErrorState

      @Test public void testAllowDrainInAbortableErrorState() throws InterruptedException
      Throws:
      InterruptedException
    • testRaiseErrorWhenNoPartitionsPendingOnDrain

      @Test public void testRaiseErrorWhenNoPartitionsPendingOnDrain() throws InterruptedException
      Throws:
      InterruptedException
    • resendFailedProduceRequestAfterAbortableError

      @Test public void resendFailedProduceRequestAfterAbortableError() throws Exception
      Throws:
      Exception
    • testTransitionToAbortableErrorOnBatchExpiry

      @Test public void testTransitionToAbortableErrorOnBatchExpiry() throws InterruptedException
      Throws:
      InterruptedException
    • testTransitionToAbortableErrorOnMultipleBatchExpiry

      @Test public void testTransitionToAbortableErrorOnMultipleBatchExpiry() throws InterruptedException
      Throws:
      InterruptedException
    • testDropCommitOnBatchExpiry

      @Test public void testDropCommitOnBatchExpiry() throws InterruptedException
      Throws:
      InterruptedException
    • testTransitionToFatalErrorWhenRetriedBatchIsExpired

      @Test public void testTransitionToFatalErrorWhenRetriedBatchIsExpired() throws InterruptedException
      Throws:
      InterruptedException
    • testBumpEpochAfterTimeoutWithoutPendingInflightRequests

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testBumpEpochAfterTimeoutWithoutPendingInflightRequests(boolean transactionV2Enabled)
    • testNoProducerIdResetAfterLastInFlightBatchSucceeds

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testNoProducerIdResetAfterLastInFlightBatchSucceeds(boolean transactionV2Enabled)
    • testEpochBumpAfterLastInFlightBatchFailsIdempotentProducer

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testEpochBumpAfterLastInFlightBatchFailsIdempotentProducer(boolean transactionV2Enabled)
    • testMaybeResolveSequencesTransactionalProducer

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testMaybeResolveSequencesTransactionalProducer(boolean transactionV2Enabled)
    • testEpochUpdateAfterBumpFromEndTxnResponseInV2

      @Test public void testEpochUpdateAfterBumpFromEndTxnResponseInV2() throws InterruptedException
      Throws:
      InterruptedException
    • testProducerIdAndEpochUpdateAfterOverflowFromEndTxnResponseInV2

      @Test public void testProducerIdAndEpochUpdateAfterOverflowFromEndTxnResponseInV2() throws InterruptedException
      Throws:
      InterruptedException
    • testNoFailedBatchHandlingWhenTxnManagerIsInFatalError

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testNoFailedBatchHandlingWhenTxnManagerIsInFatalError(boolean transactionV2Enabled)
    • testAbortTransactionAndReuseSequenceNumberOnError

      @Test public void testAbortTransactionAndReuseSequenceNumberOnError() throws InterruptedException
      Throws:
      InterruptedException
    • testAbortTransactionAndResetSequenceNumberOnUnknownProducerId

      @Test public void testAbortTransactionAndResetSequenceNumberOnUnknownProducerId() throws InterruptedException
      Throws:
      InterruptedException
    • testBumpTransactionalEpochOnAbortableError

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testBumpTransactionalEpochOnAbortableError(boolean transactionV2Enabled) throws InterruptedException
      Throws:
      InterruptedException
    • testBumpTransactionalEpochOnUnknownProducerIdError

      @Test public void testBumpTransactionalEpochOnUnknownProducerIdError() throws InterruptedException
      Throws:
      InterruptedException
    • testBumpTransactionalEpochOnTimeout

      @Test public void testBumpTransactionalEpochOnTimeout() throws InterruptedException
      Throws:
      InterruptedException
    • testBumpTransactionalEpochOnRecoverableAddPartitionRequestError

      @Test public void testBumpTransactionalEpochOnRecoverableAddPartitionRequestError()
    • testBumpTransactionalEpochOnRecoverableAddOffsetsRequestError

      @Test public void testBumpTransactionalEpochOnRecoverableAddOffsetsRequestError() throws InterruptedException
      Throws:
      InterruptedException
    • testHealthyPartitionRetriesDuringEpochBump

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testHealthyPartitionRetriesDuringEpochBump(boolean transactionV2Enabled) throws InterruptedException
      Throws:
      InterruptedException
    • testRetryAbortTransaction

      @Test public void testRetryAbortTransaction() throws InterruptedException
      Throws:
      InterruptedException
    • testRetryCommitTransaction

      @Test public void testRetryCommitTransaction() throws InterruptedException
      Throws:
      InterruptedException
    • testRetryAbortTransactionAfterCommitTimeout

      @Test public void testRetryAbortTransactionAfterCommitTimeout()
    • testRetryCommitTransactionAfterAbortTimeout

      @Test public void testRetryCommitTransactionAfterAbortTimeout()
    • testNeedToTriggerEpochBumpFromClientDuringCoordinatorDisconnect

      @Test public void testNeedToTriggerEpochBumpFromClientDuringCoordinatorDisconnect()
    • testFailedInflightBatchAfterEpochBump

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testFailedInflightBatchAfterEpochBump(boolean transactionV2Enabled) throws InterruptedException
      Throws:
      InterruptedException
    • testBackgroundInvalidStateTransitionIsFatal

      @Test public void testBackgroundInvalidStateTransitionIsFatal()
    • testForegroundInvalidStateTransitionIsRecoverable

      @Test public void testForegroundInvalidStateTransitionIsRecoverable()
    • testTransactionAbortableExceptionInInitProducerId

      @Test public void testTransactionAbortableExceptionInInitProducerId()
    • testTransactionAbortableExceptionInAddPartitions

      @Test public void testTransactionAbortableExceptionInAddPartitions()
    • testTransactionAbortableExceptionInFindCoordinator

      @Test public void testTransactionAbortableExceptionInFindCoordinator()
    • testTransactionAbortableExceptionInEndTxn

      @Test public void testTransactionAbortableExceptionInEndTxn() throws InterruptedException
      Throws:
      InterruptedException
    • testTransactionAbortableExceptionInAddOffsetsToTxn

      @Test public void testTransactionAbortableExceptionInAddOffsetsToTxn()
    • testTransactionAbortableExceptionInTxnOffsetCommit

      @Test public void testTransactionAbortableExceptionInTxnOffsetCommit()