You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/11/21 04:27:55 UTC
[GitHub] [pulsar] mattisonchao opened a new pull request, #18555: [fix][schema] Fix break change about topic deletion.
mattisonchao opened a new pull request, #18555:
URL: https://github.com/apache/pulsar/pull/18555
### Motivation
#14608 Introduce a new break change about the delete schema logic of topic deletion starting from 2.11(milestone), #18320 cherry-picked this logic to branch-2.10 and branch-2.9. I'm wondering if it's better to roll back this kind of logic.
### Modifications
- Roll back delete schema logic of topic deletion.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] mattisonchao commented on a diff in pull request #18555: [fix][schema] Fix cherry-pick issue from #18283
Posted by GitBox <gi...@apache.org>.
mattisonchao commented on code in PR #18555:
URL: https://github.com/apache/pulsar/pull/18555#discussion_r1027657460
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PersistentTopicTest.java:
##########
@@ -271,4 +272,70 @@ public void testPersistentPartitionedTopicUnload() throws Exception {
producer.close();
}
}
+
+ @Test
+ public void testCreateSchemaAfterDeletion() throws Exception {
+ //init namespace
+ final String myNamespace = "prop/ns";
+ admin.namespaces().createNamespace(myNamespace, Sets.newHashSet("test"));
+ final String topicName = "persistent://prop/ns/test-create-schema-after-deletion" + UUID.randomUUID();
+
+ // create namespace
+ // Create a topic with `Person`
+ try (Producer<Person> producer = pulsarClient.newProducer(Schema.AVRO(Person.class))
+ .topic(topicName)
+ .create()
+ ) {
+ Person person = new Person();
+ person.setName("Tom Hanks");
+ person.setAge(60);
+
+ producer.send(person);
+
+ }
+
+ // delete the topic
+ admin.topics().delete(topicName);
+
+ try (Producer<Student> ignored = pulsarClient.newProducer(Schema.AVRO(Student.class))
+ .topic(topicName)
+ .create()) {
+ Assert.fail("Should fail to create a the producer with a new schema since the schema is not deleted.");
+ } catch (PulsarClientException pce) {
+ Assert.assertTrue(pce instanceof PulsarClientException.IncompatibleSchemaException);
+ }
+
+ // delete the schema
+ admin.schemas().deleteSchema(topicName);
+
+ // after deleting the schema, try to create a topic with a different schema
+ try (Producer<Student> producer = pulsarClient.newProducer(Schema.AVRO(Student.class))
+ .topic(topicName)
+ .create()
+ ) {
+ Student student = new Student();
+ student.setName("Tom Jerry");
+ student.setAge(30);
+ student.setGpa(6);
+ student.setGpa(10);
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on pull request #18555: [fix][schema] Fix break change about delete schema of topic deletion.
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on PR #18555:
URL: https://github.com/apache/pulsar/pull/18555#issuecomment-1321461527
It should be a cherry-pick issue from https://github.com/apache/pulsar/pull/18283
It's better to change the PR title to "Fix cherry-pick issue from #18283"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] yaalsn commented on a diff in pull request #18555: [fix][schema] Fix cherry-pick issue from #18283
Posted by GitBox <gi...@apache.org>.
yaalsn commented on code in PR #18555:
URL: https://github.com/apache/pulsar/pull/18555#discussion_r1027617104
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/persistent/PersistentTopicTest.java:
##########
@@ -271,4 +272,70 @@ public void testPersistentPartitionedTopicUnload() throws Exception {
producer.close();
}
}
+
+ @Test
+ public void testCreateSchemaAfterDeletion() throws Exception {
+ //init namespace
+ final String myNamespace = "prop/ns";
+ admin.namespaces().createNamespace(myNamespace, Sets.newHashSet("test"));
+ final String topicName = "persistent://prop/ns/test-create-schema-after-deletion" + UUID.randomUUID();
+
+ // create namespace
+ // Create a topic with `Person`
+ try (Producer<Person> producer = pulsarClient.newProducer(Schema.AVRO(Person.class))
+ .topic(topicName)
+ .create()
+ ) {
+ Person person = new Person();
+ person.setName("Tom Hanks");
+ person.setAge(60);
+
+ producer.send(person);
+
+ }
+
+ // delete the topic
+ admin.topics().delete(topicName);
+
+ try (Producer<Student> ignored = pulsarClient.newProducer(Schema.AVRO(Student.class))
+ .topic(topicName)
+ .create()) {
+ Assert.fail("Should fail to create a the producer with a new schema since the schema is not deleted.");
+ } catch (PulsarClientException pce) {
+ Assert.assertTrue(pce instanceof PulsarClientException.IncompatibleSchemaException);
+ }
+
+ // delete the schema
+ admin.schemas().deleteSchema(topicName);
+
+ // after deleting the schema, try to create a topic with a different schema
+ try (Producer<Student> producer = pulsarClient.newProducer(Schema.AVRO(Student.class))
+ .topic(topicName)
+ .create()
+ ) {
+ Student student = new Student();
+ student.setName("Tom Jerry");
+ student.setAge(30);
+ student.setGpa(6);
+ student.setGpa(10);
Review Comment:
Is there any reason to invoke `setGpa` twice?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] mattisonchao merged pull request #18555: [fix][schema] Fix cherry-pick issue from #18283
Posted by GitBox <gi...@apache.org>.
mattisonchao merged PR #18555:
URL: https://github.com/apache/pulsar/pull/18555
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org