Repository navigation
Conversation
… per Session Report the largest total size of ephemeral paths owned by one session as max_session_ephemeral_path_bytes, measured in UTF-8 bytes. This helps estimate closeSession transaction sizes relative to jute.maxbuffer. Cache session totals and update them as nodes are added or removed. Rebuild the totals when loading a snapshot and collect the gauge from the current tree so restore and database replacement use current values. Add tests for UTF-8 boundaries and session lifecycle, and document the metric in the monitoring and command references.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a session owns many ephemeral znodes, the path list in its
closeSessiontransaction can exceedjute.maxbuffer. The existingephemerals_countexposes the server-wide node count, but gives no indication of the path bytes owned by one session.Fix
Add
max_session_ephemeral_path_bytes, the largest total size of full ephemeral paths owned by one session on the server, measured in UTF-8 bytes. The value decreases after deletion or session closure and returns to zero when no ephemeral nodes remain. It counts path bytes; serialized transactions also contain length prefixes and headers.DataTreecaches a byte total for each session and updates it when ephemeral paths are added or removed. Reading the gauge takes O(S) time and the cache adds O(S) memory, where S is the number of tracked session records.monitor, and aszk_max_session_ephemeral_path_bytesthroughmntr. The monitoring and command references document its meaning and serialization overhead, marked new in 3.10.0.Tests
DataTreeTestchecks the maximum across sessions, UTF-8 boundaries, duplicate creation, deletion and session closure. It also checks snapshot reloads and that persistent, container and TTL nodes do not affect the total.ZooKeeperServerTestchecks gauge registration and removal, and reads after database or tree replacement.CommandsTest.testMonitorMaxSessionEphemeralPathByteschecks the exported value with a real client.All 56 selected tests passed, including
ZookeeperServerRestoreTest, as did Java Checkstyle. The tests detected all 26 targeted source mutations. I also checked Prometheus, AdminServer andmntrlocally with two sessions and Unicode paths, including decreases after deletion and session closure.