GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [fix][broker] Don't lose the topic changes made while a topic list watcher lists its initial topics by merlimat · Pull Request #27525 · apache/pulsar Conversation
Contributor
MotivationA pattern consumer's topic list watcher can miss topics created (or deleted) while the broker sets it up, and then
This happens when topics change right after a pattern consumer subscribes, which is what these tests do and what fails The variants that wait for the watcher before creating topics ( // TopicListService.initializeTopicsListWatcher() Consumer<List<String>> afterListing = topics -> { // register watcher immediately so that we don't lose events TopicListWatcher watcher = new TopicListWatcher(this, watcherId, namespace, topicsPattern, topics, ...); watcherRef.set(watcher); topicResources.registerPersistentTopicListener(watcher); // after the listing read the namespace }; getTopics(namespace, afterListing, cancelled)... Modifications
Runnable beforeListing = () -> { // Register the watcher before the listing reads the namespace, so that it receives the topic changes that // the listing misses. It applies them to the listed topics. TopicListWatcher watcher = new TopicListWatcher(this, watcherId, namespace, topicsPattern, ...); watcherRef.set(watcher); topicResources.registerPersistentTopicListener(watcher); }; ... w.initializeMatchingTopics(topics); // TopicListWatcher.onTopicEvent(), for a matching topic if (topicChangesWhileListing != null) { // the success response of the watch request sends the topics, including this change topicChangesWhileListing.put(topicName, notificationType); return; } Known residual, not changed here: Verifying this change
Does this pull request potentially affect one of the following parts:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…tcher lists its initial topics TopicListService registered a new topic list watcher as a topic listener only after listing the namespace's topics. A topic created or deleted after the listing read the namespace, but before the registration, was in neither: the watch request's success response had the stale topics, whose hash matched the client's, and no update followed, so the pattern consumer only noticed at its next reconciliation, patternAutoDiscoveryPeriod later. This fails TopicsConsumerImplTest.testPartitionsUpdatesForMultipleTopics and PatternTopicsConsumerImplTest's watcher tests when topics change right after the consumer subscribes. The watcher is now registered right before the listing reads the namespace. Until the listing completes, it keeps the last change of each matching topic and applies them to the listed topics, which the success response then sends. Session events received meanwhile are handled once the topics are listed, so that an update they start isn't overwritten by the older initial listing. …mer-shared-broker-flakes
codelipenghui
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
…tcher lists its initial topics (apache#27525) (cherry picked from commit 97f3ecb)
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
…tcher lists its initial topics (apache#27525) (cherry picked from commit 97f3ecb)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |