Class ShareConsumeRequestManagerTest
java.lang.Object
org.apache.kafka.clients.consumer.internals.ShareConsumeRequestManagerTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetup()voidteardown()voidvoidvoidvoidvoidvoidAn acknowledge request state is created for the node that led the partition at the time of the commit.voidAstestFetchResponseWithUnknownTopicIdRefreshesTopicIdOnRecreation()but the UNKNOWN_TOPIC_ID error arrives in a ShareAcknowledge response rather than a ShareFetch response.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidtestCommitWithRenewAcknowledgements(boolean commitSync) voidvoidvoidvoidvoidtestFatalErrorsAcknowledgementResponse(org.apache.kafka.common.protocol.Errors error) voidvoidvoidvoidvoidWhen a broker is fenced, it is dropped from thebrokerslist of subsequent MetadataResponses, soCluster.nodeById()returns null for it, while leadership for its partitions fails over to another live broker.voidWhen a topic is deleted and recreated, its topic ID changes.voidvoidvoidtestHandleFetchResponseError(org.apache.kafka.common.protocol.Errors error, boolean hasTopLevelError, boolean shouldRequestMetadataUpdate) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidWhen the node backing a share session disappears from the cluster metadata, the stale session handler must be removed and any acknowledgements that were queued to be piggybacked on a fetch to that node must be failed with NETWORK_EXCEPTION.voidvoidvoidvoidvoidvoidvoidvoidvoidThe cached leader for a partition in the share session should only be replaced when the ShareFetch response carries a newer leader epoch, following the same rules asMetadata.updateLastSeenEpochIfNewer(TopicPartition, int).voidvoidvoidtestWhenLeadershipChangeBetweenShareFetchRequests(org.apache.kafka.common.protocol.Errors error) Test the scenario that the metadata indicated a change in leadership between ShareFetch requests such as could occur when metadata is periodically updated.voidtestWhenShareFetchResponseReturnsALeadershipChangeErrorButNoNewLeaderInformation(org.apache.kafka.common.protocol.Errors error) Test the scenario that ShareFetchResponse returns with an error indicating leadership change for the partition, but it does not contain new leader info (defined in KIP-951).voidtestWhenShareFetchResponseReturnsWithALeadershipChangeErrorAndNewLeaderInformation(org.apache.kafka.common.protocol.Errors error) Test the scenario that ShareFetchResponse returns with an error indicating leadership change for the partition, along with new leader info (defined in KIP-951).
-
Constructor Details
-
ShareConsumeRequestManagerTest
public ShareConsumeRequestManagerTest()
-
-
Method Details
-
setup
@BeforeEach public void setup() -
teardown
-
testFetchNormal
@Test public void testFetchNormal() -
testFetchWithAcquiredRecords
@Test public void testFetchWithAcquiredRecords() -
testMultipleFetches
@Test public void testMultipleFetches() -
testCommitSync
@Test public void testCommitSync() -
testCommitAsync
@Test public void testCommitAsync() -
testAcknowledgeOnClose
@Test public void testAcknowledgeOnClose() -
testCloseFutureCompletedWhenMemberIdIsNull
@Test public void testCloseFutureCompletedWhenMemberIdIsNull() -
testAcknowledgeOnCloseWithPendingCommitAsync
@Test public void testAcknowledgeOnCloseWithPendingCommitAsync() -
testAcknowledgeOnCloseWithPendingCommitSync
@Test public void testAcknowledgeOnCloseWithPendingCommitSync() -
testResultHandlerOnCommitAsync
@Test public void testResultHandlerOnCommitAsync() -
testResultHandlerOnCommitSync
@Test public void testResultHandlerOnCommitSync() -
testResultHandlerCompleteIfEmpty
@Test public void testResultHandlerCompleteIfEmpty() -
testBatchingAcknowledgeRequestStates
@Test public void testBatchingAcknowledgeRequestStates() -
testPendingCommitAsyncBeforeCommitSync
@Test public void testPendingCommitAsyncBeforeCommitSync() -
testRetryAcknowledgements
@Test public void testRetryAcknowledgements() -
testFatalErrorsAcknowledgementResponse
@ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"FENCED_LEADER_EPOCH","NOT_LEADER_OR_FOLLOWER","UNKNOWN_TOPIC_OR_PARTITION"}) public void testFatalErrorsAcknowledgementResponse(org.apache.kafka.common.protocol.Errors error) -
testRetryAcknowledgementsMultipleCommitAsync
@Test public void testRetryAcknowledgementsMultipleCommitAsync() -
testRetryAcknowledgementsMultipleCommitSync
@Test public void testRetryAcknowledgementsMultipleCommitSync() -
testPiggybackAcknowledgementsInFlight
@Test public void testPiggybackAcknowledgementsInFlight() -
testAcknowledgeErrorMessagePropagatedFromFetchResponse
@Test public void testAcknowledgeErrorMessagePropagatedFromFetchResponse() -
testCommitAsyncWithSubscriptionChange
@Test public void testCommitAsyncWithSubscriptionChange() -
testCommitSyncWithSubscriptionChange
@Test public void testCommitSyncWithSubscriptionChange() -
testCommitWithRenewAcknowledgements
@ParameterizedTest @ValueSource(booleans={true,false}) public void testCommitWithRenewAcknowledgements(boolean commitSync) -
testCloseWithSubscriptionChange
@Test public void testCloseWithSubscriptionChange() -
testSecondFetchBeforeCollectClearsInflightRecords
@Test public void testSecondFetchBeforeCollectClearsInflightRecords() -
testEmptyResponseThenDataResponseBeforeCollectClearsInflightRecords
@Test public void testEmptyResponseThenDataResponseBeforeCollectClearsInflightRecords() -
testDoesNotCloseSessionWhileRecordsBuffered
@Test public void testDoesNotCloseSessionWhileRecordsBuffered() -
testDoesNotCloseSessionWhileAcknowledgementsPending
@Test public void testDoesNotCloseSessionWhileAcknowledgementsPending() -
testRetryAcknowledgementsWithLeaderChange
@Test public void testRetryAcknowledgementsWithLeaderChange() -
testCallbackHandlerConfig
@Test public void testCallbackHandlerConfig() -
testAcknowledgementCommitCallbackMultiplePartitionCommitAsync
@Test public void testAcknowledgementCommitCallbackMultiplePartitionCommitAsync() -
testMultipleTopicsFetch
@Test public void testMultipleTopicsFetch() -
testMultipleTopicsFetchError
@Test public void testMultipleTopicsFetchError() -
testCloseShouldBeIdempotent
@Test public void testCloseShouldBeIdempotent() -
testFetchError
@Test public void testFetchError() -
testRecordLatencyOnFetchResponseLevelError
@Test public void testRecordLatencyOnFetchResponseLevelError() -
testInvalidDefaultRecordBatch
@Test public void testInvalidDefaultRecordBatch() -
testParseInvalidRecordBatch
@Test public void testParseInvalidRecordBatch() -
testHeaders
@Test public void testHeaders() -
testUnauthorizedTopic
@Test public void testUnauthorizedTopic() -
testUnknownTopicIdError
@Test public void testUnknownTopicIdError() -
testHandleFetchResponseError
@ParameterizedTest @MethodSource("handleFetchResponseErrorSupplier") public void testHandleFetchResponseError(org.apache.kafka.common.protocol.Errors error, boolean hasTopLevelError, boolean shouldRequestMetadataUpdate) -
testFetchDisconnected
@Test public void testFetchDisconnected() -
testFetchWithLastRecordMissingFromBatch
@Test public void testFetchWithLastRecordMissingFromBatch() -
testCorruptMessageError
@Test public void testCorruptMessageError() -
testFetchRecoversWhenCachedLeaderNodeDisappearsFromMetadata
@Test public void testFetchRecoversWhenCachedLeaderNodeDisappearsFromMetadata()When a broker is fenced, it is dropped from thebrokerslist of subsequent MetadataResponses, soCluster.nodeById()returns null for it, while leadership for its partitions fails over to another live broker. This test checks that once the cached leader node disappears from the metadata and leadership moves to a still-present node, the next fetch is routed to the new leader. -
testSessionHandlerRemovedAndPiggybackAcksFailedWhenNodeDisappears
@Test public void testSessionHandlerRemovedAndPiggybackAcksFailedWhenNodeDisappears()When the node backing a share session disappears from the cluster metadata, the stale session handler must be removed and any acknowledgements that were queued to be piggybacked on a fetch to that node must be failed with NETWORK_EXCEPTION. -
testAcknowledgeRequestFailedWhenNodeDisappearsBeforeSend
@Test public void testAcknowledgeRequestFailedWhenNodeDisappearsBeforeSend()An acknowledge request state is created for the node that led the partition at the time of the commit. If that node then disappears from the cluster metadata before the request is sent, the acknowledgements must be failed with NOT_LEADER_OR_FOLLOWER. -
testFetchResponseWithUnknownTopicIdRefreshesTopicIdOnRecreation
@Test public void testFetchResponseWithUnknownTopicIdRefreshesTopicIdOnRecreation()When a topic is deleted and recreated, its topic ID changes. The request manager caches the mapping from topic-partition to topic ID (and leader). A partition-level UNKNOWN_TOPIC_ID error in a ShareFetch response must clear that cached mapping so that, once the metadata reflects the recreated topic, the stale topic ID is forgotten from the share session and the new one is fetched. -
testAcknowledgeResponseWithUnknownTopicIdRefreshesTopicIdOnRecreation
@Test public void testAcknowledgeResponseWithUnknownTopicIdRefreshesTopicIdOnRecreation()AstestFetchResponseWithUnknownTopicIdRefreshesTopicIdOnRecreation()but the UNKNOWN_TOPIC_ID error arrives in a ShareAcknowledge response rather than a ShareFetch response. -
testFetchOneNodeAtATimeForRecordLimitMode
@Test public void testFetchOneNodeAtATimeForRecordLimitMode()
-