Skip to content

[fix][broker] Fix ownership-generation races in OwnershipCache remove… - #1

Open
SongOf wants to merge 109 commits into
masterfrom
fix/broker-ownership-cache-generation-race
Open

SongOf wants to merge 109 commits into
masterfrom
fix/broker-ownership-cache-generation-race

Conversation

@SongOf

@SongOf SongOf commented Jul 16, 2026

Copy link
Copy Markdown
Owner

…Ownership and lock-expiry cleanup

Fixes #xyz

Main Issue: #xyz

PIP: #xyz

Motivation

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@SongOf
SongOf force-pushed the fix/broker-ownership-cache-generation-race branch from 1f7e054 to 8f4d0b6 Compare July 22, 2026 14:38
@SongOf
SongOf force-pushed the fix/broker-ownership-cache-generation-race branch from 8f4d0b6 to 724a40a Compare July 23, 2026 19:05
maxlisongsong and others added 27 commits July 27, 2026 23:03
# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
#	pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java
david-streamlio and others added 25 commits August 28, 2026 08:54
…t provider is registered (apache#26154)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ar-function-go (apache#26446)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ient (apache#26480)

### Motivation

`pulsar-perf` was migrated to the V5 client API in apache#25887 and `pulsar-client` in apache#25917, so every
subcommand of both tools now drives the V5 SDK. Pulsar 5.0 does not deprecate ordinary
(non-scalable) topics and the v4 client remains fully supported, so it is still useful to drive the
CLI tools with the v4 client: for benchmark results comparable across broker versions (the v4
commands can also target pre-5.0 brokers, which the V5 SDK cannot talk to at all), and for testing
the v4 client and ordinary topics without the V5 SDK in the path.

The migration also left a set of options that are still accepted but no longer do what they say,
with no way to get the behaviour back — round-robin partition routing and the outstanding-message
limits on `produce`, the real subscription types and the receiver-queue knobs on `consume`, the v4
`Reader` and its `<ledgerId>:<entryId>` start position on `read`, the v4 transaction coordinator on
`transaction`, KeyValue schemas and non-durable subscriptions on `pulsar-client`, and `loadConf`
for `client.conf` keys without a dedicated CLI flag.

### Modifications

Each command is split into an abstract base holding everything that is not client-specific, plus two
thin sibling subclasses that bind the client types — the existing V5 command and a new v4 one:

```
PerformanceProducerBase    -> PerformanceProducer    / PerformanceProducerV4    (produce-v4)
PerformanceConsumerBase    -> PerformanceConsumer    / PerformanceConsumerV4    (consume-v4)
PerformanceReaderBase      -> PerformanceReader      / PerformanceReaderV4      (read-v4)
PerformanceTransactionBase -> PerformanceTransaction / PerformanceTransactionV4 (transaction-v4)

AbstractCmdProduce         -> CmdProduce             / CmdProduceV4             (produce-v4)
AbstractCmdConsumeCommand  -> CmdConsume             / CmdConsumeV4             (consume-v4)
AbstractCmdReadCommand     -> CmdRead                / CmdReadV4                (read-v4)
```

`PulsarClientTool` builds a second, lazily-supplied v4 `ClientBuilder` for the `*-v4` commands; it
keeps `loadConf` and accepts `http://` service URLs. `pulsar-shell` picks the new `pulsar-client`
commands up for free, and both tools' `gen-doc` / `generate_documentation` render them.

New subcommands only. The V5 commands keep their behaviour apart from a few deliberate fixes that
the split surfaced (the `ProducerSocket` send/ack ordering and its `close()` null guard, the
transaction receive-failure path), plus some added "use the `-v4` command" pointers on existing
warnings — all listed in the PR description.

### Verifying this change

Covered by `PulsarPerfTestToolTest`, `PerformanceV4CommandsTest`, `PerformanceTransactionV4Test`,
`CmdV4CommandsTest`, `PulsarClientToolTest` (including the three KeyValue cases disabled by apache#25917,
now re-enabled against `produce-v4`), and new `produce-v4` / `consume-v4` / `read-v4` cases in the
`PerfToolTest` integration test.
@github-actions github-actions Bot added the PIP label Sep 8, 2026
@SongOf
SongOf force-pushed the fix/broker-ownership-cache-generation-race branch from b9ae6cc to 0adab8c Compare September 9, 2026 16:50
@SongOf
SongOf force-pushed the fix/broker-ownership-cache-generation-race branch from 0adab8c to 2166893 Compare September 9, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.