Skip to content

P06: Port per-session ephemeral byte budget to ZooKeeper 3.8.7 - #182

Merged
bellatrix007 merged 4 commits into
adbansal/zk-387-p05-paginationfrom
adbansal/zk-387-p06-ephemeral-budget
Dec 3, 2026
Merged

bellatrix007 merged 4 commits into
adbansal/zk-387-p05-paginationfrom
adbansal/zk-387-p06-ephemeral-budget

Conversation

@bellatrix007

Copy link
Copy Markdown

Description

Port the per-session ephemeral path-byte budget from #118 and #119 to 3.8.7, stacked on #181. zookeeper.ephemeralNodes.total.byte.limit limits the combined Jute-serialized path sizes, including string-length prefixes; the default -1 disables it. Rejected creates emit a log entry and increment ephemeral_node_limit_violation.

This preserves a best-effort check, not a hard quota. Concurrent requests and creates within one multi can overshoot. Snapshot loading does not rebuild byte totals, and the legacy close-session path without a transaction can retain accounting. These inherited limitations are not redesigned here.

Tests

  • Added EphemeralNodeByteLimitTest and BinaryOutputArchiveTest, plus a disabled-mode case in DataTreeTest; ported both ephemeral-throttling test classes to Jupiter.

  • Selected Maven clean verify suite (-pl zookeeper-server -am): 239 tests on each of Java 8, 11 and 17, 717 executions total, with no failures, errors, skips or retries. Run on macOS ARM64 with process-local IPv4/RMI loopback settings.

  • Java 11 assembly packaging, RAT, Checkstyle and SpotBugs passed. Only documentation changed after these runs.

  • The timed concurrency test uses a 32 KiB budget so its existing request window can reach the limit, retaining the 5% tolerance. Its follower assertion now checks the follower session rather than the leader twice.

  • Matching-client interoperability and accounting probes completed. Older-client decoding failures are disclosed below. The published 3.8.4-0 client JAR was separately checked for error-code decoding, not full interoperability.

  • Local code review completed

Changes that Break Backward Compatibility (Optional)

The custom TOTALEPHEMERALLIMITEXCEEDED code is -128, not the older fork's -125, because upstream already uses -125 for QUOTAEXCEEDED.

When this limit is enabled and exceeded, old fork Java clients throw NullPointerException; an unpatched 3.8.7 Java client throws IllegalArgumentException. Async callbacks receive raw -128. Conversely, newer clients interpret an old server's -125 budget rejection as QuotaExceededException.

Keep the budget disabled with incompatible clients. Clients must recognize the custom code before it is enabled; com.linkedin.zookeeper:zookeeper:3.8.4-0 already recognizes it, but an Apache version number alone is not sufficient.

Documentation (Optional)

Updated the ephemeralNodes.total.byte.limit entry in zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md with the setting, best-effort/snapshot limitations and client-compatibility warning.

🤖 Generated with GitHub Copilot CLI

Aditi Bansal and others added 3 commits November 27, 2026 15:37
Adds the opt-in zookeeper.ephemeralNodes.total.byte.limit system
property (default -1, disabled). When set, the leader's request
preparation rejects an ephemeral create whose serialized full path
(4-byte length prefix plus encoded bytes) would push the session's
committed total above the limit, logs the rejection, increments
ephemeral_node_limit_violation and returns TOTALEPHEMERALLIMITEXCEEDED.
DataTree keeps the per-session total on create, delete and close.

The check uses committed state only, so concurrent or batched creates
can exceed the configured value. The error code is -128 because -125
is QUOTAEXCEEDED in 3.8.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the custom -128 client requirement, the published fork client that recognizes it, and the inherited committed-state and snapshot accounting limitations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bellatrix007
bellatrix007 force-pushed the adbansal/zk-387-p06-ephemeral-budget branch from 8150e66 to 1103109 Compare November 27, 2026 10:12
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bellatrix007 bellatrix007 added the upgrade-3.8.x Port of LinkedIn patches onto Apache ZooKeeper 3.8.x label Dec 2, 2026

@arkmish arkmish left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. Thanks for addressing the comments.

@bellatrix007
bellatrix007 merged commit a9c5979 into li-dev/base-3.8.7 Dec 3, 2026
24 checks passed
@bellatrix007
bellatrix007 deleted the adbansal/zk-387-p06-ephemeral-budget branch December 3, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upgrade-3.8.x Port of LinkedIn patches onto Apache ZooKeeper 3.8.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants