Class FetchRequestManagerTest
java.lang.Object
org.apache.kafka.clients.consumer.internals.FetchRequestManagerTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetup()voidteardown()voidvoidvoidvoidvoidvoidvoidvoidA fetch response that carries no records must still wake up a thread blocked on the fetch buffer.voidvoidvoidTest the scenario where a partition with fetched but not consumed records (i.e.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidTest the case where the client makes a post KIP-74 FetchRequest, but the server replies with only a partial request.voidvoidvoidvoidvoidvoidvoidvoidThis test makes several calls tosendFetches(), and after each, the buffered partitions are modified to either cause (or prevent) a fetch from being requested.voidvoidvoidvoidvoidvoidThis validates that no records are fetched for partitions that are waiting for the onPartitionsAssigned callback to complete.voidvoidvoidvoidvoidvoidvoidtestHandleFetchResponseError(org.apache.kafka.common.protocol.Errors error, long highWatermark, boolean hasTopLevelError, boolean shouldRequestMetadataUpdate) voidvoidvoidvoidThis validates that in-flight fetch requests are not completed for partitions that are waiting for the onPartitionsAssigned callback to complete.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidtestWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInformation(org.apache.kafka.common.protocol.Errors error) Test the scenario that FetchResponse returns with an error indicating leadership change for the partition, along with new leader info(defined in KIP-951).voidtestWhenFetchResponseReturnsALeaderShipChangeErrorButNoNewLeaderInformation(org.apache.kafka.common.protocol.Errors error) Test the scenario that FetchResponse returns with an error indicating leadership change for the partition, but it does not contain new leader info(defined in KIP-951).
-
Constructor Details
-
FetchRequestManagerTest
public FetchRequestManagerTest()
-
-
Method Details
-
setup
@BeforeEach public void setup() -
teardown
-
testFetchNormal
@Test public void testFetchNormal() -
testEmptyFetchResponseWakesUpBuffer
A fetch response that carries no records must still wake up a thread blocked on the fetch buffer.- Throws:
InterruptedException
-
testFailedFetchResponseWakesUpBuffer
- Throws:
InterruptedException
-
testFetchSessionErrorResponseWakesUpBuffer
- Throws:
InterruptedException
-
testNoFetchablePartitionsDoesNotWakeUpBuffer
- Throws:
InterruptedException
-
testMaximumTimeToWaitUnboundedWhenFetchSent
@Test public void testMaximumTimeToWaitUnboundedWhenFetchSent() -
testMaximumTimeToWaitBoundedWhenNoInflightRequest
@Test public void testMaximumTimeToWaitBoundedWhenNoInflightRequest() -
testMaximumTimeToWaitUnboundedWhenPartitionsSkippedDueToInflight
@Test public void testMaximumTimeToWaitUnboundedWhenPartitionsSkippedDueToInflight() -
testMaximumTimeToWaitBoundedWhenPartitionsSkippedDueToBackoff
@Test public void testMaximumTimeToWaitBoundedWhenPartitionsSkippedDueToBackoff() -
testPartitionsSkippedDueToBackoffDoesNotWakeUpBuffer
@Test public void testPartitionsSkippedDueToBackoffDoesNotWakeUpBuffer() throws InterruptedException- Throws:
InterruptedException
-
testInflightFetchOnPendingPartitions
@Test public void testInflightFetchOnPendingPartitions() -
testInflightFetchResultNotProcessedForPartitionsAwaitingCallbackCompletion
@Test public void testInflightFetchResultNotProcessedForPartitionsAwaitingCallbackCompletion()This validates that in-flight fetch requests are not completed for partitions that are waiting for the onPartitionsAssigned callback to complete. Note that this markPendingOnAssignedCallback functionality is only used from theAsyncKafkaConsumer. -
testFetchResultNotProcessedForPartitionsAwaitingCallbackCompletion
@Test public void testFetchResultNotProcessedForPartitionsAwaitingCallbackCompletion()This validates that no records are fetched for partitions that are waiting for the onPartitionsAssigned callback to complete. Note that this markPendingOnAssignedCallback functionality is only used from theAsyncKafkaConsumer. -
testCloseShouldBeIdempotent
@Test public void testCloseShouldBeIdempotent() -
testFetcherCloseClosesFetchSessionsInBroker
@Test public void testFetcherCloseClosesFetchSessionsInBroker() -
testFetchingPendingPartitions
@Test public void testFetchingPendingPartitions() -
testFetchWithNoTopicId
@Test public void testFetchWithNoTopicId() -
testFetchWithTopicId
@Test public void testFetchWithTopicId() -
testFetchForgetTopicIdWhenUnassigned
@Test public void testFetchForgetTopicIdWhenUnassigned() -
testFetchForgetTopicIdWhenReplaced
@Test public void testFetchForgetTopicIdWhenReplaced() -
testFetchTopicIdUpgradeDowngrade
@Test public void testFetchTopicIdUpgradeDowngrade() -
testMissingLeaderEpochInRecords
@Test public void testMissingLeaderEpochInRecords() -
testLeaderEpochInConsumerRecord
@Test public void testLeaderEpochInConsumerRecord() -
testClearBufferedDataForTopicPartitions
@Test public void testClearBufferedDataForTopicPartitions() -
testFetchSkipsBlackedOutNodes
@Test public void testFetchSkipsBlackedOutNodes() -
testFetcherIgnoresControlRecords
@Test public void testFetcherIgnoresControlRecords() -
testFetchError
@Test public void testFetchError() -
testFetchedRecordsRaisesOnSerializationErrors
@Test public void testFetchedRecordsRaisesOnSerializationErrors() -
testParseCorruptedRecord
-
testInvalidDefaultRecordBatch
@Test public void testInvalidDefaultRecordBatch() -
testParseInvalidRecordBatch
@Test public void testParseInvalidRecordBatch() -
testHeaders
@Test public void testHeaders() -
testFetchMaxPollRecords
@Test public void testFetchMaxPollRecords() -
testFetchAfterPartitionWithFetchedRecordsIsUnassigned
@Test public void testFetchAfterPartitionWithFetchedRecordsIsUnassigned()Test the scenario where a partition with fetched but not consumed records (i.e. max.poll.records is less than the number of fetched records) is unassigned and a different partition is assigned. This is a pattern used by Streams state restoration and KAFKA-5097 would have been caught by this test. -
testFetchNonContinuousRecords
@Test public void testFetchNonContinuousRecords() -
testFetchRequestInternalError
@Test public void testFetchRequestInternalError()Test the case where the client makes a post KIP-74 FetchRequest, but the server replies with only a partial request. For v3 and later FetchRequests, the implementation of KIP-74 changed the behavior so that at least one message is always returned. Therefore, this case should not happen, and it indicates that an internal error has taken place. -
testUnauthorizedTopic
@Test public void testUnauthorizedTopic() -
testFetchDuringEagerRebalance
@Test public void testFetchDuringEagerRebalance() -
testFetchDuringCooperativeRebalance
@Test public void testFetchDuringCooperativeRebalance() -
testInFlightFetchOnPausedPartition
@Test public void testInFlightFetchOnPausedPartition() -
testFetchOnPausedPartition
@Test public void testFetchOnPausedPartition() -
testFetchOnCompletedFetchesForPausedAndResumedPartitions
@Test public void testFetchOnCompletedFetchesForPausedAndResumedPartitions() -
testFetchOnCompletedFetchesForSomePausedPartitions
@Test public void testFetchOnCompletedFetchesForSomePausedPartitions() -
testFetchOnCompletedFetchesForAllPausedPartitions
@Test public void testFetchOnCompletedFetchesForAllPausedPartitions() -
testPartialFetchWithPausedPartitions
@Test public void testPartialFetchWithPausedPartitions() -
testFetchDiscardedAfterPausedPartitionResumedAndSeekedToNewOffset
@Test public void testFetchDiscardedAfterPausedPartitionResumedAndSeekedToNewOffset() -
testFetchSessionIdError
@Test public void testFetchSessionIdError() -
testRecordLatencyOnFetchResponseLevelError
@Test public void testRecordLatencyOnFetchResponseLevelError() -
testHandleFetchResponseError
@ParameterizedTest @MethodSource("handleFetchResponseErrorSupplier") public void testHandleFetchResponseError(org.apache.kafka.common.protocol.Errors error, long highWatermark, boolean hasTopLevelError, boolean shouldRequestMetadataUpdate) -
testEpochSetInFetchRequest
@Test public void testEpochSetInFetchRequest() -
testFetchOffsetOutOfRange
@Test public void testFetchOffsetOutOfRange() -
testStaleOutOfRangeError
@Test public void testStaleOutOfRangeError() -
testFetchedRecordsAfterSeek
@Test public void testFetchedRecordsAfterSeek() -
testFetchOffsetOutOfRangeException
@Test public void testFetchOffsetOutOfRangeException() -
testFetchPositionAfterException
@Test public void testFetchPositionAfterException() -
testFetchResponseWithUnexpectedPartitionIsIgnored
@Test public void testFetchResponseWithUnexpectedPartitionIsIgnored() -
testCompletedFetchRemoval
@Test public void testCompletedFetchRemoval() -
testSeekBeforeException
@Test public void testSeekBeforeException() -
testFetchDisconnected
@Test public void testFetchDisconnected() -
testQuotaMetrics
@Test public void testQuotaMetrics() -
testFetcherMetrics
@Test public void testFetcherMetrics() -
testFetcherLeadMetric
@Test public void testFetcherLeadMetric() -
testReadCommittedLagMetric
@Test public void testReadCommittedLagMetric() -
testFetchResponseMetrics
@Test public void testFetchResponseMetrics() -
testFetchResponseMetricsWithSkippedOffset
@Test public void testFetchResponseMetricsWithSkippedOffset() -
testFetchResponseMetricsWithOnePartitionError
@Test public void testFetchResponseMetricsWithOnePartitionError() -
testFetchResponseMetricsWithOnePartitionAtTheWrongOffset
@Test public void testFetchResponseMetricsWithOnePartitionAtTheWrongOffset() -
testFetcherMetricsTemplates
@Test public void testFetcherMetricsTemplates() -
testSkippingAbortedTransactions
@Test public void testSkippingAbortedTransactions() -
testReturnCommittedTransactions
@Test public void testReturnCommittedTransactions() -
testReadCommittedWithCommittedAndAbortedTransactions
@Test public void testReadCommittedWithCommittedAndAbortedTransactions() -
testMultipleAbortMarkers
@Test public void testMultipleAbortMarkers() -
testReadCommittedAbortMarkerWithNoData
@Test public void testReadCommittedAbortMarkerWithNoData() -
testUpdatePositionWithLastRecordMissingFromBatch
@Test public void testUpdatePositionWithLastRecordMissingFromBatch() -
testUpdatePositionOnEmptyBatch
@Test public void testUpdatePositionOnEmptyBatch() -
testReadCommittedWithCompactedTopic
@Test public void testReadCommittedWithCompactedTopic() -
testReturnAbortedTransactionsInUncommittedMode
@Test public void testReturnAbortedTransactionsInUncommittedMode() -
testConsumerPositionUpdatedWhenSkippingAbortedTransactions
@Test public void testConsumerPositionUpdatedWhenSkippingAbortedTransactions() -
testConsumingViaIncrementalFetchRequests
@Test public void testConsumingViaIncrementalFetchRequests() -
testEmptyControlBatch
@Test public void testEmptyControlBatch() -
testSubscriptionPositionUpdatedWithEpoch
@Test public void testSubscriptionPositionUpdatedWithEpoch() -
testPreferredReadReplica
@Test public void testPreferredReadReplica() -
testFetchDisconnectedShouldClearPreferredReadReplica
@Test public void testFetchDisconnectedShouldClearPreferredReadReplica() -
testFetchDisconnectedShouldNotClearPreferredReadReplicaIfUnassigned
@Test public void testFetchDisconnectedShouldNotClearPreferredReadReplicaIfUnassigned() -
testFetchErrorShouldClearPreferredReadReplica
@Test public void testFetchErrorShouldClearPreferredReadReplica() -
testPreferredReadReplicaOffsetError
@Test public void testPreferredReadReplicaOffsetError() -
testFetchCompletedBeforeHandlerAdded
@Test public void testFetchCompletedBeforeHandlerAdded() -
testCorruptMessageError
@Test public void testCorruptMessageError() -
testWhenFetchResponseReturnsALeaderShipChangeErrorButNoNewLeaderInformation
@ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"FENCED_LEADER_EPOCH","NOT_LEADER_OR_FOLLOWER"}) public void testWhenFetchResponseReturnsALeaderShipChangeErrorButNoNewLeaderInformation(org.apache.kafka.common.protocol.Errors error) Test the scenario that FetchResponse returns with an error indicating leadership change for the partition, but it does not contain new leader info(defined in KIP-951). -
testWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInformation
@ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"FENCED_LEADER_EPOCH","NOT_LEADER_OR_FOLLOWER"}) public void testWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInformation(org.apache.kafka.common.protocol.Errors error) Test the scenario that FetchResponse returns with an error indicating leadership change for the partition, along with new leader info(defined in KIP-951). -
testPollWithoutCreateFetchRequests
@Test public void testPollWithoutCreateFetchRequests() -
testPollWithCreateFetchRequests
@Test public void testPollWithCreateFetchRequests() -
testPollWithCreateFetchRequestsError
@Test public void testPollWithCreateFetchRequestsError() -
testPollWithRedundantCreateFetchRequests
@Test public void testPollWithRedundantCreateFetchRequests() -
testFetchRequestWithBufferedPartitions
@Test public void testFetchRequestWithBufferedPartitions()This test makes several calls tosendFetches(), and after each, the buffered partitions are modified to either cause (or prevent) a fetch from being requested. -
testFetchRequestWithBufferedPartitionNotAssigned
@Test public void testFetchRequestWithBufferedPartitionNotAssigned() -
testFetchRequestWithBufferedPartitionMissingLeader
@Test public void testFetchRequestWithBufferedPartitionMissingLeader() -
testFetchRequestWithBufferedPartitionMissingPosition
@Test public void testFetchRequestWithBufferedPartitionMissingPosition() -
testFetchRequestWithBufferedPartitionPaused
@Test public void testFetchRequestWithBufferedPartitionPaused() -
testFetchRequestWithBufferedPartitionPendingRevocation
@Test public void testFetchRequestWithBufferedPartitionPendingRevocation() -
testFetchRequestWithBufferedPartitionPendingAssignment
@Test public void testFetchRequestWithBufferedPartitionPendingAssignment() -
testFetchRequestWithBufferedPartitionResetOffset
@Test public void testFetchRequestWithBufferedPartitionResetOffset()
-