Skip to content

Log only the bookie settings that differ from the built-in defaults - #4892

Open
merlimat wants to merge 1 commit into
apache:masterfrom
merlimat:wt/bookie-settings-overrides-log-d974ab
Open

merlimat wants to merge 1 commit into
apache:masterfrom
merlimat:wt/bookie-settings-overrides-log-d974ab

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

Descriptions of the changes in this PR:

Follow-up to #4768.

Motivation

The Starting Bookie server log line introduced in #4768 was meant to print only the settings overridden from the defaults, but in practice it printed every key ever set on the configuration. It compared each key against an empty ServerConfiguration, and the defaults are not stored in the configuration object: they are hard-coded inside the getters (e.g. getInt(BOOKIE_PORT, 3181)). The lookup therefore returned null for every key, and all of them were reported as overrides.

This is especially noisy when the configuration is shared with other components. Pulsar standalone loads the broker settings into the same properties object, so the bookie printed hundreds of unrelated broker entries at startup.

Changes

  • BookieServer.overriddenConfig() now invokes every public get*/is* getter of ServerConfiguration on both the actual configuration and an empty one, through a small subclass that records which property keys each getter reads. When the two results differ, the recorded keys that are explicitly set in the configuration are reported with their raw values.
  • Keys that no ServerConfiguration getter reads are not reported. This drops the unrelated entries (e.g. Pulsar broker settings), but also component-owned keys such as dbStorage_*. DbLedgerStorage already logs its cache sizes at startup.
  • A getter that throws on the configured value (e.g. an unknown class name) counts as differing, so the offending setting is still shown.
  • CompositeConfiguration implements getList/getStringArray by reading its child configurations directly, bypassing getPropertyInternal, so the recording subclass overrides getList as well. Without it, list-valued settings such as ledgerDirectories were missed.
  • Added BookieServerOverriddenConfigTest covering values equal to the defaults, changed values, fallback keys, unknown keys and values rejected by a getter.

Example output for a bookie started by BookieClientTest; only the settings the test configuration explicitly changes are listed:

Starting Bookie server {overrides={allocatorPoolingPolicy=UnpooledHeap, allowLoopback=true, bookiePort=13645, diskUsageThreshold=0.999, diskUsageWarnThreshold=0.99, gcWaitTime=100000, journalDirectories=/tmp/.../bookieClient...test, journalFlushWhenQueueEmpty=true, journalFormatVersionToWrite=5, ledgerDirectories=/tmp/.../bookieClient...test, listeningInterface=lo0, tlsEnabledProtocols=[TLSv1.2, TLSv1.1], zkRetryBackoffMaxRetries=0}}

The "Starting Bookie server" log line introduced in apache#4768 was meant to
print only the overridden settings, but it compared every key against an
empty ServerConfiguration. The defaults are not stored in the
configuration object, they are hard-coded inside the getters, so the
lookup returned null for every key and all of them were reported as
overrides. When the configuration is shared with other components, for
example Pulsar standalone loading the broker settings into the same
properties, hundreds of unrelated entries were printed.

Compute the overrides by invoking every ServerConfiguration getter on
both the actual configuration and an empty one, through a subclass that
records the property keys each getter reads. When the two results differ,
the recorded keys that are explicitly set are reported with their raw
values. Keys that no getter reads are left out.
@merlimat
merlimat requested review from lhotari and a lite review from Copilot September 16, 2026 23:22

Copilot AI 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.

🟢 Approval recommended

Changes are fully reviewed, tested, and introduce no unresolved blocking issues.

Pull request overview

Updates bookie startup logging to report only explicitly configured settings that differ from built-in defaults.

Changes:

  • Compares configuration getters against an empty configuration while recording accessed keys.
  • Excludes unrelated and unknown properties.
  • Adds tests covering defaults, overrides, fallback keys, unknown keys, and invalid values.
File summaries
File Description
bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/BookieServerOverriddenConfigTest.java Tests override detection behavior and edge cases.
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java Implements getter-based override detection and key recording.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants