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

[PIP-236][fix][broker]Fix using schema to create consumer fails after using AUTO_CONSUME consumer to subscribe topic #17449

Merged
merged 26 commits into from
Mar 7, 2023

Conversation

Denovo1998
Copy link
Contributor

@Denovo1998 Denovo1998 commented Sep 3, 2022

Fixes #17354
PIP #19113

Motivation

Fixed the failure to use schema to create consumer after using AUTO-CONSUME consumer to subscribe an empty topic, and Broker returned the error message as IncompatibleSchemaException("Topic does not have schema to check").

Modifications

In PersistentTopic::addSchemaIfIdleOrCheckCompatible, when there is an active consumer, but the consumer is using the AUTO_CONSUME schema to subscribe to the topic. Continuing to create a schema consumer to subscribe to the topic will fail.

  • When numActiveConsumers != 0, and check the schema of the currently existing consumers is AUTO_CONSUME schema.

Verifying this change

  • Make sure that the change passes the CI checks.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Matching PR in forked repository

PR in forked repository: Denovo1998#1

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 3, 2022
@Denovo1998 Denovo1998 closed this Sep 3, 2022
@Denovo1998 Denovo1998 deleted the issue17354 branch September 3, 2022 16:32
@Denovo1998 Denovo1998 restored the issue17354 branch September 3, 2022 16:32
@Denovo1998 Denovo1998 reopened this Sep 3, 2022
@Denovo1998 Denovo1998 changed the title Fix using schema to create consumer fails after using AUTO_CONSUME consumer to subscribe topic [fix][broker]Fix using schema to create consumer fails after using AUTO_CONSUME consumer to subscribe topic Sep 3, 2022
@Technoboy-
Copy link
Contributor

Hi @Denovo1998 , we'd better add test for this.

@Denovo1998
Copy link
Contributor Author

Already done @Technoboy-

…ls after using AUTO_CONSUME consumer to subscribe topic
@Denovo1998
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@Denovo1998
Copy link
Contributor Author

@congbobo184 @mattisonchao PTAL

@Denovo1998
Copy link
Contributor Author

…O. Reduce the duplication of convertAutoConsumeSchema code and reuse convertSchema.
…hemaType(SchemaType type), and delete the judgment of schema as AutoConsume in ServerCnx.
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

@Denovo1998
Copy link
Contributor Author

This is my first contribution. Maybe now I need more review and approval? Or add a ready-to-test label to the PR? In my own forked repository, all the tests are already passing.

@congbobo184
Copy link
Contributor

congbobo184 commented Feb 9, 2023

@liangyepianzhou please help review this PR

@codelipenghui
Copy link
Contributor

/pulsarbot run-failure-checks

1 similar comment
@Denovo1998
Copy link
Contributor Author

/pulsarbot run-failure-checks

@congbobo184
Copy link
Contributor

congbobo184 commented Feb 28, 2023

@Denovo1998 hi, could you merge apache/master and rerun the test?

@Denovo1998
Copy link
Contributor Author

@congbobo184 I'm done. But in this pr I see 2 workflows awaiting approval.

@tisonkun
Copy link
Member

tisonkun commented Mar 2, 2023

@Denovo1998 I've triggered the CI workflow for you :)

@Denovo1998
Copy link
Contributor Author

@tisonkun Thanks for your help.

@Denovo1998
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@Denovo1998
Copy link
Contributor Author

/pulsarbot run-failure-checks

@Denovo1998
Copy link
Contributor Author

That's weird. I ran this test a few times and sometimes it worked and sometimes it failed.
org.apache.pulsar.client.api.TopicReaderTest#testMultiReaderIsAbleToSeekWithTimeOnMiddleOfTopic


Expected :true
Actual   :false
<Click to see difference>

java.lang.AssertionError: Received duplicate message msg num 6
	at org.testng.Assert.fail(Assert.java:110)
	at org.testng.Assert.failNotEquals(Assert.java:1413)
	at org.testng.Assert.assertTrue(Assert.java:56)
	at org.apache.pulsar.client.api.TopicReaderTest.testMultiReaderIsAbleToSeekWithTimeOnMiddleOfTopic(TopicReaderTest.java:1401)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:969)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.testng.TestRunner.privateRun(TestRunner.java:829)
	at org.testng.TestRunner.run(TestRunner.java:602)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:437)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391)
	at org.testng.SuiteRunner.run(SuiteRunner.java:330)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
	at org.testng.TestNG.runSuites(TestNG.java:1099)
	at org.testng.TestNG.run(TestNG.java:1067)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

I found some issues and pr that might be related.
#17407
#17443
#18202

Do I need to continue running `run-fail-checks`` for the test to succeed?

@Denovo1998
Copy link
Contributor Author

/pulsarbot run-failure-checks

@Denovo1998
Copy link
Contributor Author

@congbobo184 Now we can merge.

@congbobo184 congbobo184 merged commit af1360f into apache:master Mar 7, 2023
@Denovo1998 Denovo1998 deleted the issue17354 branch March 18, 2023 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Subscription with schema fails if there is an AUTO-CONSUME consumer attached to a topic
10 participants