Skip to content

Commit

Permalink
Correct id swap revert in distributed tx during retry
Browse files Browse the repository at this point in the history
Backport of a667b24

This fixes transaction failure when a transaction is retried because of a ODistributedRecordLockedException.
Fixes orientechnologies#10289
  • Loading branch information
timw committed Aug 29, 2024
1 parent 796166b commit 31d7d3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -789,10 +789,11 @@ public Iterator<byte[]> getSerializedOperations() {
public void resetAllocatedIds() {
for (Map.Entry<ORID, ORecordOperation> op : recordOperations.entrySet()) {
if (op.getValue().type == ORecordOperation.CREATED) {
ORID lastCreateId = op.getValue().getRID().copy();
ORecordId oldNew =
new ORecordId(op.getKey().getClusterId(), op.getKey().getClusterPosition());
updateIdentityAfterRecordCommit(op.getValue().getRID(), oldNew);
updatedRids.remove(op.getValue().getRID());
new ORecordId(lastCreateId.getClusterId(), op.getKey().getClusterPosition());
updateIdentityAfterCommit(lastCreateId, oldNew);
updatedRids.put(oldNew, op.getKey());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,11 @@ public Iterator<byte[]> getSerializedOperations() {
public void resetAllocatedIds() {
for (Map.Entry<ORID, ORecordOperation> op : allEntries.entrySet()) {
if (op.getValue().type == ORecordOperation.CREATED) {
ORID lastCreateId = op.getValue().getRID().copy();
ORecordId oldNew =
new ORecordId(op.getKey().getClusterId(), op.getKey().getClusterPosition());
updateIdentityAfterCommit(op.getValue().getRID(), oldNew);
updatedRids.remove(op.getValue().getRID());
new ORecordId(lastCreateId.getClusterId(), op.getKey().getClusterPosition());
updateIdentityAfterCommit(lastCreateId, oldNew);
updatedRids.put(oldNew, op.getKey());
}
}
}
Expand Down

0 comments on commit 31d7d3d

Please sign in to comment.