Skip to content

OXY-146: Pulsar createIfDNE idempotency (Topic already exists) - #292

Open
Kalin-Rudnicki wants to merge 2 commits into
mainfrom
OXY-146
Open

OXY-146: Pulsar createIfDNE idempotency (Topic already exists)#292
Kalin-Rudnicki wants to merge 2 commits into
mainfrom
OXY-146

Conversation

@Kalin-Rudnicki

Copy link
Copy Markdown
Owner

Summary

Fixes OXY-146: PulsarAdminClient.{tenant,namespace,topic}.createIfDNE used a non-atomic check-then-act (list then create). Under concurrent calls both fibers could see the resource missing and both create it; the loser got a 409 PulsarAdminException ("... already exists"). Now treated as success.

Changes

  • Shared private succeedIfAlreadyExists combinator wraps the create call in all three createIfDNE methods (catchSome -> log Info, return unit).
  • Private isAlreadyExists predicate: PulsarAdminException status 409 first, unwrap CompletionException/ExecutionException, then case-insensitive "already exists" message fallback.
  • Preserved behavior: partition-mismatch still warns + succeeds; list-based fast-path unchanged; non-already-exists errors still propagate.
  • Added first test dir for oxygen-events-pulsar (+ oxygen-test % Test): mock-based idempotency + propagation tests via JDK dynamic proxy. 6 tests pass.

Notes

  • Decisions + build caveats documented in report/OXY-146.md.
  • Confidence: 8.5/10.

🤖 Generated with Claude Code

Kalin-Rudnicki and others added 2 commits August 13, 2026 18:30
createIfDNE (tenant/namespace/topic) used a non-atomic check-then-act
(list then create). Under concurrent calls both fibers could see the
resource missing and both create it; the loser got a 409
PulsarAdminException ("... already exists").

- Add shared private `succeedIfAlreadyExists` combinator wrapping the
  `create` call in all three createIfDNE methods (catchSome -> log Info).
- Add private `isAlreadyExists` predicate: PulsarAdminException status 409
  first, unwrap CompletionException/ExecutionException, then fall back to
  case-insensitive "already exists" message check.
- Preserve existing behavior (partition-mismatch warning, list fast-path);
  non-already-exists errors still propagate.
- Add first test dir for oxygen-events-pulsar (+ oxygen-test % Test dep):
  mock-based idempotency + propagation tests via JDK dynamic proxy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant