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
[issues 5698]Handle replicator producer as generated name producer #5701
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, just left some comments about the code format
@@ -316,6 +316,11 @@ private void tryOverwriteOldProducer(Producer oldProducer, Producer newProducer) | |||
} | |||
} | |||
|
|||
private boolean isUserProvidedProducerName(Producer producer){ | |||
//considered replicator producer as generated name producer | |||
return producer.isUserProvidedProducerName() && !producer.getProducerName().startsWith(replicatorPrefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems 2 space here, please keep 1 space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
topic.removeProducer(producer4); | ||
Assert.assertEquals(topic.getProducers().size(), 0); | ||
|
||
Producer producer5= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space before =, please also check other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
run java8 tests |
topic.removeProducer(producer4); | ||
Assert.assertEquals(topic.getProducers().size(), 0); | ||
|
||
Producer producer5= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Producer producer5= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", | |
Producer producer5 = new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
topic.addProducer(producer5); | ||
Assert.assertEquals(topic.getProducers().size(), 1); | ||
|
||
Producer producer6= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Producer producer6= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", | |
Producer producer6 = new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
|
||
topic.getProducers().values().forEach(producer -> Assert.assertEquals(producer.getEpoch(), 2)); | ||
|
||
Producer producer7= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Producer producer7= new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", | |
Producer producer7 = new Producer(topic, serverCnx, 2 /* producer id */, "pulsar.repl.cluster1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@@ -316,6 +316,11 @@ private void tryOverwriteOldProducer(Producer oldProducer, Producer newProducer) | |||
} | |||
} | |||
|
|||
private boolean isUserProvidedProducerName(Producer producer){ | |||
//considered replicator producer as generated name producer | |||
return producer.isUserProvidedProducerName() && !producer.getProducerName().startsWith(replicatorPrefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return producer.isUserProvidedProducerName() && !producer.getProducerName().startsWith(replicatorPrefix); | |
return producer.isUserProvidedProducerName() && !producer.getProducerName().startsWith(replicatorPrefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
8258e51
to
2e60c48
Compare
run java8 tests |
run java8 tests |
run integration tests |
Fixes #5698
Motivation
Since #5571 handle the generated producer name, the replicator producer was created by broker, only one producer for a replicated topic.
So, we can handle it simple by considered replicator producer as generated name producer.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changes