wolfstudy opened a new pull request, #25580:
URL: https://github.com/apache/pulsar/pull/25580

   
   Fixes #xyz
   
   ### Motivation
   
   Apache BookKeeper [PR #4683](https://github.com/apache/bookkeeper/pull/4683) 
introduced TCP
   keep-alive configuration options for the BookKeeper client, namely 
`tcpKeepIdle`,
   `tcpKeepIntvl` and `tcpKeepCnt`. This change has been released in BookKeeper 
`4.17.3`.
   
   Now that the BookKeeper client exposes these TCP keep-alive tuning knobs, 
the Pulsar Broker should also expose matching
   configuration entries, so that operators can tune the TCP keep-alive 
behavior of the broker's
   BookKeeper client without having to patch code or rely on OS-wide defaults.
   
   This is particularly useful in the following scenarios:
   - Detecting and recovering from half-open connections (e.g. Bookie host 
crash, NAT/LB silently
     dropping idle connections) faster than the OS default (which is typically 
2 hours on Linux).
   - Environments where network devices aggressively close idle TCP 
connections, causing the
     broker's BookKeeper client to unexpectedly hit broken connections under 
low traffic.
   - Fine-grained tuning of keep-alive probes to balance between fast failure 
detection and
     extra network overhead.
   
   ### Modifications
   
   Added three new broker configuration entries under `ServiceConfiguration`, 
and wired them
   through `BookKeeperClientFactoryImpl` into the underlying BookKeeper 
`ClientConfiguration`:
   
   | Broker config                 | BookKeeper client setter | Default | 
Semantics                                                                 |
   
|-------------------------------|--------------------------|---------|---------------------------------------------------------------------------|
   | `tcpKeepAliveTimeSeconds`     | `setTcpKeepIdle`         | `0`     | Idle 
time before the first keep-alive probe is sent (seconds).            |
   | `tcpKeepAliveIntervalSeconds` | `setTcpKeepIntvl`        | `0`     | 
Interval between subsequent keep-alive probes (seconds).                  |
   | `tcpKeepAliveProbeCount`      | `setTcpKeepCnt`          | `0`     | 
Number of unacknowledged probes before the connection is considered dead. |
   
   Behavior details:
   - The default value `0` means "do not override" — the broker will fall back 
to the BookKeeper
     client default (`-1`), which in turn falls back to the OS-level TCP 
keep-alive settings.
   - A value is only applied to the BookKeeper `ClientConfiguration` when it is 
strictly greater
     than `0`, so existing deployments are fully backward compatible.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   - Added `BookKeeperClientFactoryImplTest#testSetTcpKeepAliveConfiguration`, 
which asserts:
     - When none of the new configs are set, the resulting BookKeeper 
`ClientConfiguration`
       returns the BookKeeper defaults (`getTcpKeepIdle() == -1`, 
`getTcpKeepIntvl() == -1`,
       `getTcpKeepCnt() == -1`).
     - When the new configs are set (e.g. `60 / 10 / 5`), the corresponding 
values are correctly
       forwarded to `ClientConfiguration` (`getTcpKeepIdle() == 60`, 
`getTcpKeepIntvl() == 10`,
       `getTcpKeepCnt() == 5`).
   
   ### Does this pull request potentially affect one of the following parts:
   
   - [x] The public API — added three new broker configuration entries
     (`tcpKeepAliveTimeSeconds`, `tcpKeepAliveIntervalSeconds`, 
`tcpKeepAliveProbeCount`).
     These are additive and default to `0` (no behavior change unless 
explicitly configured),
     so existing deployments are not affected.
   
   ### Documentation
   
   - [x] `doc-not-needed`
     The new fields carry inline `@FieldContext` documentation that is 
automatically surfaced
     in the generated broker reference documentation.
   


-- 
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]

Reply via email to