Skip to content

feat(#95): add Transaction::getConflictingKeyRanges() and getConflictingKeys() - #99

Merged
s2x merged 1 commit into
masterfrom
feat/95-conflicting-key-ranges
Sep 8, 2026
Merged

feat(#95): add Transaction::getConflictingKeyRanges() and getConflictingKeys()#99
s2x merged 1 commit into
masterfrom
feat/95-conflicting-key-ranges

Conversation

@s2x

@s2x s2x commented Sep 8, 2026

Copy link
Copy Markdown
Member

Closes #95

Summary

Adds a typed helper to read the conflicting key ranges reported by the server after a not_committed (1020) error, when TransactionOptions::setReportConflictingKeys() is enabled — without having to know the \xff\xff/transaction/conflicting_keys/ special key-space layout by hand.

Changes

  • Transaction::getConflictingKeys() — raw special-key rows (list<KeyValue>) with the special-key-space prefix stripped; values are "1" (range start) / "0" (range end) markers.
  • Transaction::getConflictingKeyRanges() — pairs the markers into list<array{begin: string, end: string}>.
  • Both throw a clear LogicException when the option was not enabled on the transaction; malformed marker streams throw RuntimeException.
  • The reportConflictingKeys option is tracked in Transaction::setOption() (also covers TransactionOptions::setReportConflictingKeys(), which routes through it).
  • Integration test tests/Integration/ConflictingKeysTest.php: forces a write conflict between two transactions, asserts a 1020 commit failure and that a reported range covers the conflicting key.
  • docs/error-handling.md updated with a usage section; CHANGELOG.md entry added.

Verification

  • composer lint clean (PHPCS + Rector dry-run + PHPStan level 9)
  • composer test:unit — 480 tests OK (1 pre-existing unrelated deprecation in NativeClientPartialInitTest)
  • Integration suite against a live 5-node FDB cluster — 217 tests OK, incl. the new conflict test

…ingKeys()

Add a typed helper to read the conflicting key ranges reported by the
server after a not_committed (1020) error when
TransactionOptions::setReportConflictingKeys() is enabled, without
having to know the \xff\xff/transaction/conflicting_keys/ special
key-space layout by hand.
@s2x
s2x force-pushed the feat/95-conflicting-key-ranges branch from 65290dd to 307e891 Compare September 8, 2026 19:53
@s2x
s2x merged commit b7516f1 into master Sep 8, 2026
1 check passed
@s2x
s2x deleted the feat/95-conflicting-key-ranges branch September 8, 2026 19:53
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.

Add Transaction::getConflictingKeyRanges() helper for reportConflictingKeys

1 participant