Add ZooKeeper connection log#79494
Conversation
|
Why not to add a new type to existing |
Zookeeper log is unusable in the long term due to the high volume of messages it stores. |
|
Yes, exactly what @Algunenano said. This should be a much more lightweight table that we might even enable in our cloud. Recently both @vdimir run into issues where this would have been a valuable information. |
|
Github suggested me to ask Copilot for a review. I cannot stand not to do so. Let's see how good is that :D |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new system table for logging ZooKeeper connection information and integrates it into both the Context and SystemLog machinery while also replacing legacy print statements in integration helpers with proper logging.
- Replaces print() calls with logging.debug in helper modules
- Introduces ZooKeeperConnectionLog (header and implementation) and integrates connection/disconnection event logging in Context and ZooKeeper-related modules
- Updates related components (SystemLog, ZooKeeper classes, etc.) to support the new logging mechanism
Reviewed Changes
Copilot reviewed 18 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/helpers/cluster.py | Replaces print statements with logging.debug calls for better logging consistency |
| src/Storages/System/StorageSystemZooKeeperConnection.cpp | Updates retrieval of enabled feature flags and uses the new default ZooKeeper name from ZooKeeperConnectionLog |
| src/Interpreters/ZooKeeperConnectionLog.{h,cpp} | Introduces new system log element and logging API for ZooKeeper connection events |
| src/Interpreters/SystemLog.{h,cpp} | Integrates the new ZooKeeperConnectionLog into the system logs |
| src/Interpreters/Context.{h,cpp} | Adds and updates functions to log ZooKeeper connection events and to use the default ZooKeeper name consistently |
| src/Common/ZooKeeper/{ZooKeeperImpl.h, ZooKeeper.h, ZooKeeper.cpp} | Improves const correctness and minor naming clarifications |
| src/Common/SystemLogBase.{h,cpp} | Maps the new ZooKeeperConnectionLogElement in the system log base |
Files not reviewed (5)
- programs/server/config.d/zookeeper_connection_log.xml: Language not supported
- tests/integration/log.txt: Language not supported
- tests/integration/test_reload_auxiliary_zookeepers/configs/config.xml: Language not supported
- tests/integration/test_reload_auxiliary_zookeepers/configs/users.xml: Language not supported
- tests/integration/test_zookeeper_connection_log/configs/auxiliary_zookeepers.xml: Language not supported
Comments suppressed due to low confidence (1)
src/Interpreters/Context.cpp:4365
- [nitpick] The parameter name 'zk_conection_log' seems to have a typo; consider renaming it to 'zk_connection_log' for clarity and consistency.
std::shared_ptr<ZooKeeperConnectionLog> zk_conection_log,
6d7123d to
fe01c37
Compare
| element.port = static_cast<UInt16>(Poco::NumberParser::parseUnsigned(host_port.substr(offset + 1))); | ||
| } | ||
| element.index = zookeeper.getConnectedHostIdx(); | ||
| element.keeper_api_version = 0; |
There was a problem hiding this comment.
The same is done in system.zookeeper_connection. I tried to expose the API version, but for some reason it sometimes returned non-sense values, therefore I decided to do the same as in zookeeper_connection as it is not a very important information (enabled feature flags contain the necessary information).
…order By changing the normal zookeeper config first we can ensure that the order of events in `zookeeper_connection_log` will match the expected one even in cases when the config reload is triggered automatically while only one of the files are modified.
antaljanosbenjamin
left a comment
There was a problem hiding this comment.
One more thing I just realized: we don't log disconnected events in case of server shutdown/restart. However because of the initialization events it should be obvious. That can be added later.
|
I have to fix the test, it failed in private for some reason. |
|
Dear @Avogar, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
3972702 to
4ec7cff
Compare
…ializing `ZooKeeperConnectionLog`
4ec7cff to
f35e504
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add
zookeeper_connection_logsystem table to store historical information about ZooKeeper connections.Documentation entry for user-facing changes