Skip to content

Issue #4917: DistributedLog: allow ignoring unresolvable ZooKeeper servers stored in the namespace config - #4918

Closed
AlvaroStream wants to merge 1 commit into
apache:masterfrom
AlvaroStream:ignore-unresolvable-stored-zk-servers
Closed

AlvaroStream wants to merge 1 commit into
apache:masterfrom
AlvaroStream:ignore-unresolvable-stored-zk-servers

Conversation

@AlvaroStream

Copy link
Copy Markdown
Contributor

Descriptions of the changes in this PR:

Fix #4917

Motivation

The BKDLConfig stored in a DistributedLog namespace carries the ZooKeeper servers that the BookKeeper client and the
reader ZooKeeper client connect to. When these are in-cluster service names that a client outside the cluster cannot
resolve, while the namespace URI holds a reachable address, the client has no way to prefer the URI's servers.
See #4917 for details.

Changes

  • Add DistributedLogConfiguration#zkServersIgnorePattern (getZkServersIgnorePattern / setZkServersIgnorePattern),
    default empty so behavior is unchanged.
  • Add BKNamespaceDriver#selectZkServers: if a stored ZooKeeper servers value matches the pattern, use the
    namespace URI's servers instead and log a warning. Applied to the DL writer/reader and BK writer/reader values, and
    to the reader servers in ZKMetadataAccessor.
  • Add TestBKNamespaceDriverZkServers: unit tests for the selection and configuration, a baseline read/write, and an
    end-to-end read/write against a namespace whose stored BookKeeper ZooKeeper servers are an unresolvable
    *.svc.cluster.local name with the pattern set. The same end-to-end test fails when the pattern is not set.

What is affected

  • Code: only stream/distributedlog/core. Anything that opens a DistributedLog namespace through
    BKNamespaceDriver or ZKMetadataAccessor can use the new setting: client applications, and the modules in this
    repo that use the library (stream/server, tools/perf, stream/distributedlog/io/dlfs).
  • New public interface: the client configuration key zkServersIgnorePattern. It defaults to empty, so behavior
    is unchanged for everyone who does not set it.
  • Not affected: ZooKeeper and bookies, bookkeeper-server, the stored namespace config (nothing is written and
    there is no metadata or wire format change), and clients with and without the setting can use the same namespace.
  • Not covered: the admin tools DistributedLogTool and DLAuditor still read the stored ZooKeeper servers
    directly and ignore the new setting.

Testing

mvn -pl stream/distributedlog/core -am test -Dtest='TestBKNamespaceDriverZkServers,TestDistributedLogConfiguration,TestZkMetadataResolver'
(20 tests pass, checkstyle passes).

…in the namespace config

The namespace config stored in ZooKeeper (BKDLConfig) carries the ZooKeeper
servers that the DistributedLog and BookKeeper clients connect to. When the
ensemble runs in Kubernetes and clients reach it through a load balancer, these
stored values can be in-cluster service names that clients outside the cluster
cannot resolve, while the namespace URI holds the address they can reach.

Add an opt-in configuration key, zkServersIgnorePattern (default empty, so
behavior is unchanged). When a stored ZooKeeper servers value matches the
regex, the client uses the ZooKeeper servers of the namespace URI instead.
Applied to the DL writer/reader and BK writer/reader values read by
BKNamespaceDriver, and to the reader ZooKeeper servers in ZKMetadataAccessor.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AlvaroStream

Copy link
Copy Markdown
Contributor Author

Closed, I tried to reproduce the issue locally and it was not possible.

This won't resolve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DistributedLog: allow clients to ignore unresolvable ZooKeeper servers stored in the namespace config

1 participant