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

Use ZK persistent watches #11198

Merged
merged 6 commits into from
Aug 10, 2021
Merged

Conversation

merlimat
Copy link
Contributor

@merlimat merlimat commented Jul 2, 2021

Motivation

Instead of setting watches each time we do getData or exist operation, it's more efficient and less error prone to set a single persistent recursive watch to do the notifications.

@merlimat merlimat added area/dependency Pull requests that update a dependency file doc-not-needed Your PR changes do not impact docs labels Jul 2, 2021
@merlimat merlimat added this to the 2.9.0 milestone Jul 2, 2021
@merlimat merlimat self-assigned this Jul 2, 2021
@merlimat merlimat requested a review from eolivelli July 2, 2021 14:03
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.

I like this work.
I believe that this feature is great and it will help a lot in saving resources.

@@ -76,6 +79,7 @@ public ZKMetadataStore(String metadataURL, MetadataStoreConfig metadataStoreConf
}
}))
.build();
zkc.addWatch("/", this::handleWatchEvent, AddWatchMode.PERSISTENT_RECURSIVE);
Copy link
Member

Choose a reason for hiding this comment

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

Do you use chroot or does this really mean to watch the entire ZK tree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Chroot is eventually configured on the ZK connection string. This will have 1 single watch to receive notifications for all the updates related to Pulsar/BK

@merlimat merlimat force-pushed the zk-persistent-watches branch from cb28038 to 97bead7 Compare August 9, 2021 17:32
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.

LGTM

We should note that with this change Pulsar won't be able to work with a ZooKeeper 3.5 server
or in case the ZooKeeper is configured with zookeeper.watchManagerName= WatchManagerOptimized

http://zookeeper.apache.org/doc/r3.7.0/zookeeperAdmin.html

so people who want to upgrade from an older version of Pulsar (like 2.7.x) that bundled ZooKeeper 3.5 must upgrade the ZooKeeper nodes before upgrading the Brokers
and the same applies to people who are using a dedicated existing ZooKeeper cluster: they will have to upgrade ZooKeeper to 3.6.x before updating Pulsar

@eolivelli eolivelli added release/note-required and removed doc-not-needed Your PR changes do not impact docs labels Aug 10, 2021
@eolivelli
Copy link
Contributor

I added release/note-required label

@eolivelli eolivelli merged commit 31231d6 into apache:master Aug 10, 2021
@eolivelli
Copy link
Contributor

I have created this follow up issue
#11617

@merlimat merlimat deleted the zk-persistent-watches branch August 10, 2021 13:21
@bharanic-dev
Copy link
Contributor

@merlimat now that this is merged, I would like to merge the unit test that I used to reproduce the problem. Please take a look: #11155

@lhotari
Copy link
Member

lhotari commented Aug 11, 2021

I wonder if this change introduced this issue: #11637 .

@ghost
Copy link

ghost commented Jan 20, 2022

@merlimat I got a problem when I tried to upgrade my pulsar cluster from 2.8.0 to 2.9.1, my existing zookeeper server cluster version is 3.5.5. However, the upgraded pulsar cluster failed to start, because of this exception ### org.apache.zookeeper.KeeperException$UnimplementedException, the stacktrace is as followed:

022-01-20T17:20:32,455+0800 [main] ERROR org.apache.pulsar.broker.PulsarService - Failed to start Pulsar service: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for / org.apache.pulsar.metadata.api.MetadataStoreException: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for / at org.apache.pulsar.metadata.impl.ZKMetadataStore.<init>(ZKMetadataStore.java:89) ~[org.apache.pulsar-pulsar-metadata-2.9.1.jar:2.9.1] at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.newInstance(MetadataStoreFactoryImpl.java:52) ~[org.apache.pulsar-pulsar-metadata-2.9.1.jar:2.9.1] at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.createExtended(MetadataStoreFactoryImpl.java:36) ~[org.apache.pulsar-pulsar-metadata-2.9.1.jar:2.9.1]

I looked into the source code. the above exception is thrown at zkc.addWatch in ZKMetadataStore. I guess that this method call forces me to upgrade my zookeeper to a more update to date version, maybe 3.6.3. right? I am wondering is there any problem with my cluster metadata when I migrate my data from the old zookeeper ?
Thanks a lot!

@dik111
Copy link

dik111 commented Feb 16, 2022

@merlimat I got a problem when I tried to upgrade my pulsar cluster from 2.8.0 to 2.9.1, my existing zookeeper server cluster version is 3.5.5. However, the upgraded pulsar cluster failed to start, because of this exception ### org.apache.zookeeper.KeeperException$UnimplementedException, the stacktrace is as followed:

022-01-20T17:20:32,455+0800 [main] ERROR org.apache.pulsar.broker.PulsarService - Failed to start Pulsar service: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for / org.apache.pulsar.metadata.api.MetadataStoreException: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for / at org.apache.pulsar.metadata.impl.ZKMetadataStore.<init>(ZKMetadataStore.java:89) ~[org.apache.pulsar-pulsar-metadata-2.9.1.jar:2.9.1] at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.newInstance(MetadataStoreFactoryImpl.java:52) ~[org.apache.pulsar-pulsar-metadata-2.9.1.jar:2.9.1] at org.apache.pulsar.metadata.impl.MetadataStoreFactoryImpl.createExtended(MetadataStoreFactoryImpl.java:36) ~[org.apache.pulsar-pulsar-metadata-2.9.1.jar:2.9.1]

I looked into the source code. the above exception is thrown at zkc.addWatch in ZKMetadataStore. I guess that this method call forces me to upgrade my zookeeper to a more update to date version, maybe 3.6.3. right? I am wondering is there any problem with my cluster metadata when I migrate my data from the old zookeeper ? Thanks a lot!

I have encountered the same mistake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dependency Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants