Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #199: Do not stop to replicate when producer throws exception #220

Merged
merged 4 commits into from Feb 17, 2017

Conversation

nkurihar
Copy link
Contributor

Motivation

This closes #199

Modifications

When the replication producer catches an exception,
rewind cursor and continue readMoreEntries (if possible) rather than return immediately.

An unit test for simulating #199 is also added.

Result

Replicator will continue to replicate even when producer exception.

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Feb 17, 2017
@merlimat merlimat added this to the 1.17 milestone Feb 17, 2017
consumer1.receive(10);

// Restrict backlog quota limit to 1
admin1.namespaces().setBacklogQuota("pulsar/global/ns1", new BacklogQuota(1, policy));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we setup the test this way? If you want, you can create another test.

  1. limit quota to 1 message
  2. Publish 10 messages
  3. verify receive times out after first message is received(since quota is full)
  4. Increase quota to 10
  5. Verify we receive the remaining 9 messages.

Copy link
Contributor Author

@nkurihar nkurihar Feb 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saandrews
I modified the test a little:

  1. limit quota to 1
  2. Publish 1 message and wait for reflecting backlog limitation ※
  3. Publish 9 messages and verify they will be pended

※ If I produce 10 messages at once in interval of reflecting backlog limitation, they will be sended

log.debug("[{}][{} -> {}] Message persisted on remote broker", replicator.topicName,
replicator.localCluster, replicator.remoteCluster);
// cursor shoud be rewinded since it was incremented when readMoreEntries
replicator.cursor.rewind();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@merlimat Do you see any side effect if we rewind it for every exception. All failed pending messages would reach here and invoke rewind.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewind is a cheap operation, it just resets the readPosition to markDeletePosition + 1

Copy link
Contributor

@rdhabalia rdhabalia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@merlimat merlimat merged commit 6fd212a into apache:master Feb 17, 2017
rdhabalia pushed a commit that referenced this pull request Feb 24, 2017
* Fix #199: Do not stop to replicate when producer throws exception

* Fix log messages

* testReplicatorProducerClosing shoud be executed at last since it closes pulsar2/pulsar3

* Add unit test for replication resumption on backlog exceeded
hrsakai pushed a commit to hrsakai/pulsar that referenced this pull request Dec 10, 2020
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
fixes apache#220

 if using `computeIfAbsent `, `consumerManagerFuture.complete(null)` will store in `consumerTopicManagers`, and `getTopicConsumerManager ` will always get future null cache for key which should getTopic again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replicator does not resume once paused, due to backlog quota
4 participants