Skip to content

P02: Port backup and restore to ZooKeeper 3.8.7 - #175

Merged
bellatrix007 merged 2 commits into
adbansal/zk-387-p01-buildfrom
adbansal/zk-387-p02-backup
Dec 3, 2026
Merged

bellatrix007 merged 2 commits into
adbansal/zk-387-p01-buildfrom
adbansal/zk-387-p02-backup

Conversation

@bellatrix007

@bellatrix007 bellatrix007 commented Nov 12, 2026 •

Copy link
Copy Markdown

Description

Port LinkedIn backup/restore to ZooKeeper 3.8.7, stacked on #174. The 43 files / 7,561 added lines are primarily existing fork code: #129 is the seed, reconciled with branch-3.6 at 9d245933.

Area Changes
Backup and restore Snapshot/transaction-log backup, filesystem storage, status and retention, timetable/JMX metrics, quorum startup/configuration, offline zxid/timestamp/latest restore, and CLI spot restoration.
Fork reconciliation Include snapshot-metric, restore-error, resource-handling, timetable-initialization and source-license fixes missing from #129.
3.8.7 integration Preserve getDataLogDir(), register RESTORE through CommandFactory, and omit the unused duplicate storage-provider interface.
Dependencies Retain Guava 27.0.1-jre; package MIT notices for its checker-qual and animal-sniffer annotation dependencies.

Two new runtime fixes beyond fork parity:

  1. Compressed snapshot ranges: remove recognized .gz/.snappy suffixes before zxid parsing and reuse that parser for backup metadata. Previously, valid compressed names produced invalid ranges and restore failures.
  2. Initial snapshot restore: allow snapshot zxid 0 to use logs starting at 1, while still rejecting a missing first transaction.

Tests

  • Local code review completed

  • Migrate six carried test classes to Jupiter; add seven config/CLI/range-validation checks and strengthen first-transaction and compressed-backup assertions.

  • Java 8/11/17: selected Maven clean verify runs on 74d69630; 74 tests per JDK (47 backup/adaptation + 27 baseline), 222 passing executions, no failures/errors/skips or automatic retries.

  • Six-JVM Java 11 integration: 3 voters, 2 observers and a backup-enabled observer; failover/rejoin, compressed snapshots plus log/timetable backup, checkpoint restore, and verification of 253 persistent znodes and ACLs on a fresh server.

  • Java 11: assembly, RAT, Checkstyle and SpotBugs passed; packaged MIT notices verified.

Both runtime fixes have failing-before/passing-after evidence. The integration harness is local, not a new CI job. Linux deployment, GPFS/NFS, mixed-version rollout/rollback and soak remain unqualified. The inherited SpotBugs scanner cannot analyze the Java 17 runtime; Java 17 runtime tests passed.

Changes that Break Backward Compatibility (Optional)

No intended incompatible API/configuration change; backup remains disabled by default. The fixes do not repair malformed backup filenames produced by older code.

Documentation (Optional)

No wiki changes.

🤖 Generated with GitHub Copilot CLI

@arkmish

arkmish commented Nov 21, 2026

Copy link
Copy Markdown

[IMP] Strict parseBoolean for boolean keys: a bad value in zoo.cfg (e.g. yes, 1, on) now fails startup instead of silently becoming false.

  • Origin: upstream ZOOKEEPER-3721 (Apache 3.7.0). It's open source and comes with the 3.8.7 base, not from the LinkedIn changes in this PR.
  • 13 keys change behavior. branch-3.6 parsed these with lenient Boolean.parseBoolean: localSessionsEnabled, localSessionsUpgradingEnabled, quorumListenOnAllIPs, syncEnabled, sslQuorum, portUnification, sslQuorumReloadCertFiles, quorum.auth.enableSasl, quorum.auth.serverRequireSasl, quorum.auth.learnerRequireSasl, jvm.pause.monitor, multiAddress.enabled, multiAddress.reachabilityCheckEnabled.
  • standaloneEnabled and reconfigEnabled also use the strict parser now, but branch-3.6 already rejected bad values for them.

@arkmish

arkmish commented Nov 21, 2026

Copy link
Copy Markdown

[IMP] Gap to flag: ZOOKEEPER-4276 ("Serving only with secureClientPort fails") has been in the fork since #120 in April 2024. It is missing from every port PR (#173, #174, #175, #177, #180, #181), and neither Apache 3.8.7 nor 3.8.8 includes it. The whole backport is missing, not just QuorumPeerConfig.java and QuorumPeerMain.java: 12 files, +888/−130, mostly QuorumPeer.java and tests. Any LinkedIn ensemble that uses only secureClientPort would hit that bug again after the port.

  • The bug (JIRA): setupClientPort takes clientPort from the server's client address even when secureClientPort is set. If both use the same port (as in the documented non-TLS → TLS rolling upgrade), startup fails with java.net.BindException: Address already in use.
  • Config compatibility: ZOOKEEPER-4276. Serving only with secureClientPort fails #120 added a secure-client part to server.N specs, e.g. server.5=125.23.63.23:1234:1235;;1237, which the fork's zookeeperReconfig.md documents as a TLS-only server. 3.8.7's QuorumServer parser throws ConfigException for any spec with more than two ;-separated parts, so a static or dynamic config in that form won't start.
  • Upstream fix: ZOOKEEPER-4276. Serving only with secureClientPort fails apache/zookeeper#2117 is on master only, and the JIRA's fix version is the unreleased 3.10.0, so no 3.8.x or 3.9.x upgrade will bring it in.

@bellatrix007

Copy link
Copy Markdown
Author

[IMP] Strict parseBoolean for boolean keys: a bad value in zoo.cfg (e.g. yes, 1, on) now fails startup instead of silently becoming false.

  • Origin: upstream ZOOKEEPER-3721 (Apache 3.7.0). It's open source and comes with the 3.8.7 base, not from the LinkedIn changes in this PR.
  • 13 keys change behavior. branch-3.6 parsed these with lenient Boolean.parseBoolean: localSessionsEnabled, localSessionsUpgradingEnabled, quorumListenOnAllIPs, syncEnabled, sslQuorum, portUnification, sslQuorumReloadCertFiles, quorum.auth.enableSasl, quorum.auth.serverRequireSasl, quorum.auth.learnerRequireSasl, jvm.pause.monitor, multiAddress.enabled, multiAddress.reachabilityCheckEnabled.
  • standaloneEnabled and reconfigEnabled also use the strict parser now, but branch-3.6 already rejected bad values for them.

Confirmed this, there is no incorrect usage of these flags for Linkedin purpose, so nothing should break.

@bellatrix007

Copy link
Copy Markdown
Author

[IMP] Gap to flag: ZOOKEEPER-4276 ("Serving only with secureClientPort fails") has been in the fork since #120 in April 2024. It is missing from every port PR (#173, #174, #175, #177, #180, #181), and neither Apache 3.8.7 nor 3.8.8 includes it. The whole backport is missing, not just QuorumPeerConfig.java and QuorumPeerMain.java: 12 files, +888/−130, mostly QuorumPeer.java and tests. Any LinkedIn ensemble that uses only secureClientPort would hit that bug again after the port.

  • The bug (JIRA): setupClientPort takes clientPort from the server's client address even when secureClientPort is set. If both use the same port (as in the documented non-TLS → TLS rolling upgrade), startup fails with java.net.BindException: Address already in use.
  • Config compatibility: ZOOKEEPER-4276. Serving only with secureClientPort fails #120 added a secure-client part to server.N specs, e.g. server.5=125.23.63.23:1234:1235;;1237, which the fork's zookeeperReconfig.md documents as a TLS-only server. 3.8.7's QuorumServer parser throws ConfigException for any spec with more than two ;-separated parts, so a static or dynamic config in that form won't start.
  • Upstream fix: ZOOKEEPER-4276. Serving only with secureClientPort fails apache/zookeeper#2117 is on master only, and the JIRA's fix version is the unreleased 3.10.0, so no 3.8.x or 3.9.x upgrade will bring it in.

This is covered by P07 (#183), which ports the fork’s secure-client-only support, including the extended server.N syntax and secure-port configuration. P07 is already included in the cumulative P14 branch.

Aditi Bansal and others added 2 commits November 27, 2026 11:32
P02 stacked on PR #174. Reconcile PR #129 with final branch-3.6 at 9d24593. Preserve target persistence APIs and CLI factory registration; migrate carried backup tests to Jupiter without weakening assertions.

Fix compressed snapshot zxid-range parsing exposed by the six-node quorum/observer/backup restore test. Preserve backup defaults and the source storage/restore contract; no unrelated feature groups are included.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accept the first transaction at zxid 1 for the empty snapshot at zxid 0. Exercise this boundary deterministically and retain rejection when transaction 1 is missing; draw successful restore points only from actual positive transaction zxids. Preserve the existing coverage checks for later snapshots.

Include the upstream MIT license texts for the checker-qual and animal-sniffer annotation jars bundled by the restored Guava dependency.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bellatrix007
bellatrix007 force-pushed the adbansal/zk-387-p02-backup branch from 74d6963 to 8ff8ddf Compare November 27, 2026 06:10
@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 64e2d32 into li-dev/base-3.8.7 Dec 3, 2026
38 of 40 checks passed
@bellatrix007
bellatrix007 deleted the adbansal/zk-387-p02-backup branch December 3, 2026 09:03
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