Yes, it’s better to bump a protocol version to keep the compatibility.

Regards,
Penghui

On Thu, Feb 29, 2024 at 16:13 Enrico Olivelli <eolive...@gmail.com> wrote:

> Il Gio 29 Feb 2024, 08:46 PengHui Li <peng...@apache.org> ha scritto:
>
> > +1 for the motivation
> >
> > We should not create partitioned topics when calling
> > `pulsarClient.getPartitionsForTopic`
> >
> > The tricky part is the broker doesn't know if the partition metadata
> > getting request is from create produce/consumer or just from
> > pulsarClient.getPartitionsForTopic(topicName).
> >
> > We can follow the same way that Admin API does to have a field
> > `createIfAutoCreationEnabled` in the `CommandPartitionedTopicMetadata`
> >
> > The producer/consumer will set this flag to true to create partitioned
> > topics if topic auto-creation is enabled.
> > We will use false as the default value.
> >
>
>
> We should bump the protocol version of we change the default behaviour.
> This is a wire protocol thing, not about the Java client.
>
> We shuold assume that it is true if not set.
>  if we detect that he client is using a newer version of the protocol then
> the default is false.
>
> We cannot break old clients
>
>
> Enrico
>
>
> > Regards,
> > Penghui
> >
> > On Thu, Feb 29, 2024 at 11:05 AM Yubiao Feng
> > <yubiao.f...@streamnative.io.invalid> wrote:
> >
> > > Hi all
> > >
> > > ### Background
> > > - When calling `pulsarClient.getPartitionsForTopic(topicName)`, Pulsar
> > will
> > > automatically create the partitioned topic metadata if it does not
> exist,
> > > either using `HttpLookupService` or `BinaryProtoLookupService`.
> > > - The partitioned topic auto-creation is dependent on
> > > `pulsarClient.getPartitionsForTopic`
> > >   - It triggers partitioned metadata creation by
> > > `pulsarClient.getPartitionsForTopic`
> > >   - And triggers the topic partition creation by producers'
> registration
> > > and consumers' registration.
> > >
> > > ### Issue
> > > Since the method `pulsarClient.getPartitionsForTopic` is a public API,
> > and
> > > it is named `getxxx,` it should edit nothing.
> > >
> > > ### Solution
> > > - Solution-1: remove the public API
> `pulsarClient.getPartitionsForTopic`
> > > and only use it internally.
> > > - Solution-2: provide an internal API to trigger partitioned metadata
> > > creation and make the public API `pulsarClient.getPartitionsForTopic`
> > edit
> > > nothing.
> > > - Solution-3: redesign the flow of partitioned topic auto-creation.
> > >
> > > I would like to recommend solution 2, and hope to hear more voices.
> > >
> > > Thanks
> > > Yubiao Feng
> > >
> >
>

Reply via email to