Track ZooKeeper errors as causes of ZKException

Descriptions of the changes in this PR:

### Motivation

Every time a problem with ZK arises you don't see it in the exception chain of the BKException (in this case ZKException) and you end up with errors like:
```
org.apache.bookkeeper.client.BKException$ZKException: Error while using ZooKeeper
        at org.apache.bookkeeper.client.SyncCallbackUtils.finish(SyncCallbackUtils.java:83)
        at org.apache.bookkeeper.client.SyncCallbackUtils$SyncAddCallback.addComplete(SyncCallbackUtils.java:251)
        at org.apache.bookkeeper.client.AsyncCallback$AddCallback.addCompleteWithLatency(AsyncCallback.java:91)
        at org.apache.bookkeeper.client.PendingAddOp.submitCallback(PendingAddOp.java:430)
        at org.apache.bookkeeper.client.LedgerHandle.errorOutPendingAdds(LedgerHandle.java:1784)
        at org.apache.bookkeeper.client.LedgerHandle$5.safeRun(LedgerHandle.java:574)
```

### Changes
Add a "cause" to every ZKException.

### Notes
There are very few places that cannot be fixed because they are still using the old callback based mechanism without CompletableFuture. Those points are not changed in order to make the patch simple but still useful.





Reviewers: Jia Zhai <zhaijia@apache.org>

This closes #2384 from eolivelli/fix/zkexception-chain
4 files changed
tree: 16393309c7bf239c2fc2e53e6eec806da4ad7571
  1. .github/
  2. .gitignore
  3. .test-infra/
  4. LICENSE
  5. NOTICE
  6. README.md
  7. bin/
  8. bookkeeper-benchmark/
  9. bookkeeper-common-allocator/
  10. bookkeeper-common/
  11. bookkeeper-dist/
  12. bookkeeper-http/
  13. bookkeeper-proto/
  14. bookkeeper-server/
  15. bookkeeper-stats-providers/
  16. bookkeeper-stats/
  17. buildtools/
  18. circe-checksum/
  19. conf/
  20. cpu-affinity/
  21. deploy/
  22. dev/
  23. docker/
  24. metadata-drivers/
  25. microbenchmarks/
  26. pom.xml
  27. shaded/
  28. site/
  29. stats/
  30. stream/
  31. tests/
  32. tools/
README.md

Build Status Build Status Coverage Status Maven Central

Apache BookKeeper

Apache BookKeeper is a scalable, fault tolerant and low latency storage service optimized for append-only workloads.

It is suitable for being used in following scenarios:

  • WAL (Write-Ahead-Logging), e.g. HDFS NameNode.
  • Message Store, e.g. Apache Pulsar.
  • Offset/Cursor Store, e.g. Apache Pulsar.
  • Object/Blob Store, e.g. storing state machine snapshots.

Get Started

  • Concepts: Start with the basic concepts of Apache BookKeeper. This will help you to fully understand the other parts of the documentation.
  • Getting Started to setup BookKeeper to write logs.

Documentation

Developers

You can also read Turning Ledgers into Logs to learn how to turn ledgers into continuous log streams. If you are looking for a high level log stream API, you can checkout DistributedLog.

Administrators

Contributors

Get In Touch

Report a Bug

For filing bugs, suggesting improvements, or requesting new features, help us out by opening a Github issue or opening an Apache jira.

Need Help?

Subscribe or mail the user@bookkeeper.apache.org list - Ask questions, find answers, and also help other users.

Subscribe or mail the dev@bookkeeper.apache.org list - Join development discussions, propose new ideas and connect with contributors.

Join us on Slack - This is the most immediate way to connect with Apache BookKeeper committers and contributors.

Contributing

We feel that a welcoming open community is important and welcome contributions.

Contributing Code

  1. See Developer Setup to get your local environment setup.

  2. Take a look at our open issues: JIRA Issues Github Issues.

  3. Review our coding style and follow our pull requests to learn about our conventions.

  4. Make your changes according to our contribution guide.

Improving Website and Documentation

  1. See Building the website and documentation on how to build the website and documentation.