Description
TransactionOptions::setReportConflictingKeys() is implemented, but there is no way to actually read the reported keys other than knowing the special-key-space layout by hand. After a not_committed (1020) error, the conflicting ranges are published under:
\xff\xff/transaction/conflicting_keys/
where each key is <prefix><user key> and the value is 1 for the start of a conflicting range and 0 for its end. Java exposes this through Transaction.getRange(SpecialKeySpace...); Python and Go document the prefix.
What needs to be done
Add to Transaction.php:
/** @return list<array{begin: string, end: string}> */
public function getConflictingKeyRanges(): array
- Requires
setReportConflictingKeys() to have been set on the transaction, and must be called after the failing commit() and before reset()/onError().
- Reads the special range, strips the prefix, and pairs
1/0 markers into begin/end ranges.
- Throw a clear exception (not a raw range-read error) if the option was not enabled.
Consider also a lower-level getConflictingKeys(): array<KeyValue> returning the raw special-key rows.
Acceptance Criteria
Description
TransactionOptions::setReportConflictingKeys()is implemented, but there is no way to actually read the reported keys other than knowing the special-key-space layout by hand. After anot_committed(1020) error, the conflicting ranges are published under:where each key is
<prefix><user key>and the value is1for the start of a conflicting range and0for its end. Java exposes this throughTransaction.getRange(SpecialKeySpace...); Python and Go document the prefix.What needs to be done
Add to
Transaction.php:setReportConflictingKeys()to have been set on the transaction, and must be called after the failingcommit()and beforereset()/onError().1/0markers into begin/end ranges.Consider also a lower-level
getConflictingKeys(): array<KeyValue>returning the raw special-key rows.Acceptance Criteria
getConflictingKeyRanges()returns the ranges that caused a 1020 conflictsetReportConflictingKeys()was not enableddocs/error-handling.mdupdatedcomposer lintandcomposer testclean