python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

Fix a batch of known issues of TreeCache recipe #489

Closed tonyseek closed 6 years ago

tonyseek commented 6 years ago

This pull request fixes some edge bugs which were found in our production, and improves performance by approaching the behaviors of Apache Curator:

  1. The new TreeCache uses a standalone background queue instead of using the Kazoo handler's one.
  2. The new TreeCache ignores unknown exceptions of async operations instead of crashing.
  3. The tree refreshing operations send \0 to a pipe or socketpair for waking up the connection routine. Those operations will block the session watcher callback and has been moved to the background queue.

Thanks for @mozillazg for detecting those issues.

tonyseek commented 6 years ago

@jeffwidman Thanks for your review. I have added regression test and commit details.

(It seems that Travis CI + ZooKeeper are not very stable)

jeffwidman commented 6 years ago

Hmm... I clicked the "update branch" button on github assuming it would rebase, but it did a merge commit instead... I'm hesitant to merge as I'm not sure what Github will handle it under the covers and I'd rather keep a clean'ish git history... do you mind rebasing and dropping my last commit? We just had a baby, so that's why I've been slow to respond, but I should be a bit more responsive going forward...

tonyseek commented 6 years ago

Sure. I have pushed the branch based on up-to-date master.

Congratulations on your new baby. 😄

jeffwidman commented 6 years ago

Thanks!