merlimat opened a new pull request, #4892:
URL: https://github.com/apache/bookkeeper/pull/4892
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}}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]