Skip to content

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

Closed

Description

@cbornet

Search before asking

  • I searched in the issues and found nothing similar.

Version

2.10.1, master

Minimal reproduce step

  • create an auto-consumer : bin/pulsar-client consume topic-a -s sub0 -n 0 -t Shared -st auto_consume
  • create a consumer on same topic, same sub this time with a schema
    @Test
    private void test() throws Exception {
        try (PulsarClient client = PulsarClient.builder()
            .serviceUrl("pulsar://localhost:6650")
            .build()) {
            try (Consumer<CustomObject> ignored = client.newConsumer(Schema.AVRO(CustomObject.class))
                .topic("topic-a")
                .subscriptionType(SubscriptionType.Shared)
                .subscriptionName("sub0")
                .subscribe()) {
            }
        }
    }
  • ==> failure with IncompatibleSchemaException("Topic does not have schema to check")
  • stop the first consumer and start the test again ==> success

What did you expect to see?

Not failing

What did you see instead?

Failing

Anything else?

This happens because in PersistentTopic::addSchemaIfIdleOrCheckCompatible, we call checkSchemaCompatibleForConsumer if there are active consumers but no topic schema.
And checkSchemaCompatibleForConsumer fails if there's no schema.
Also addSchemaIfIdleOrCheckCompatible will not try to add the new consumer schema.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    type/bug
    on Aug 30, 2022
  2. Technoboy- commented on Aug 31, 2022

    @Technoboy-
    Contributor

    Fixed by #17353

  3. cbornet commented on Aug 31, 2022

    @cbornet
    ContributorAuthor

    No it's not fixed by #17353.
    Can we reopen ?

  4. eolivelli commented on Aug 31, 2022

    @eolivelli
    Contributor

    reopened

  5. Denovo1998 commented on Sep 3, 2022

    @Denovo1998
    Contributor

    Fixed by #17449

  6. github-actions commented on Oct 4, 2022

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  7. added a commit that references this issue on Mar 7, 2023
    af1360f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Staletype/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions