Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

[branch-2.8.0] Bump Pulsar to 2.8.0.15 #692

Merged
merged 1 commit into from Aug 30, 2021

Conversation

BewareMyPower
Copy link
Collaborator

Motivation

apache/pulsar#11804 added the custom implementations of equals and hashCode methods of ServiceCnx, which made KoP's spotbugs check fail with

Medium: io.streamnative.pulsar.handlers.kop.InternalServerCnx doesn't override org.apache.pulsar.broker.service.ServerCnx.equals(Object) [io.streamnative.pulsar.handlers.kop.InternalServerCnx] At InternalServerCnx.java:[line 1] EQ_DOESNT_OVERRIDE_EQUALS

Modifications

This PR adds the overrided equals and hashCode methods by calling base class' same name methods simply. On the other hand, since the new equals and hashCode methods are based on ctx field and they are called when removing Producer from Topic, this PR also updates the ctx field of InternalServerCnx.

@BewareMyPower BewareMyPower self-assigned this Aug 30, 2021
@BewareMyPower BewareMyPower merged commit a22a749 into branch-2.8.0 Aug 30, 2021
@BewareMyPower BewareMyPower deleted the bewaremypower/upgrade-2.8.0.15 branch August 30, 2021 16:12
BewareMyPower added a commit that referenced this pull request Sep 1, 2021
…695)

KoP's `KafkaTopicConsumerManager` (aka TCM) maintains some non-durable cursors and the associated offsets for a consumer on a specific topic. If the fetch offset doesn't exist in TCM, TCM will create a non-durable cursor whose position is associated with the offset. Each time a message is consumed, the offset and cursor pair will be removed.

Currently there's a global map `consumerTopicManagers` whose key is topic name and value is the future of TCM. However, for a topic with multiple consumer groups (subscriptions), all consumers share the same TCM. There's a great possibility that different consumers fetch different offsets concurrently from the same TCM. In this case, a lot of non-durable cursors could be created.

Add a singleton class `KafkaTopicConsumerManagerCache` to manage TCMs. The internal cache has two keys. The first key is the topic name, the second key is the remote address to identify different consumers on the same topic.

To ensure only one non-durable cursor is created for a TCM if no reconnection happened, this PR adds a field `numCreatedCursors` to record the total count of non-durable cursor creations. `testCursorCountForMultiGroups` was added to verify this behavior, it creates 5 consumers to consume the same topic with different group id in parallel. After consuming completed, check all TCMs to ensure each TCM's `numCreatedCursors` is 1.

Solve the conflict by #692 that
updates the `ctx` field of `ServerCnx`.
BewareMyPower added a commit that referenced this pull request Sep 26, 2021
This PR migrates #692 for master branch.

Since we will upgrade Pulsar to 2.9.0 later, which might bring more incompatibilities, this PR migrates the fix for branch-2.8.1 first.
BewareMyPower added a commit that referenced this pull request Dec 13, 2021
Fix the spotbugs check like what #692 and #746 did.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant