Source:
<code>public void preallocateRids(final OTransaction clientTx) { try { checkOpenness(); checkLowDiskSpaceRequestsAndBackgroundDataFlushExceptions(); @SuppressWarnings("unchecked") final Iterable<ORecordOperation> entries = (Iterable<ORecordOperation>) clientTx.getAllRecordEntries(); final TreeMap<Integer, OCluster> clustersToLock = new TreeMap<>(); final Set<ORecordOperation> newRecords = new TreeSet<>(COMMIT_RECORD_OPERATION_COMPARATOR); for (ORecordOperation txEntry : entries) { if (txEntry.type == ORecordOperation.CREATED) { newRecords.add(txEntry); int clusterId = txEntry.getRID().getClusterId(); clustersToLock.put(clusterId, getClusterById(clusterId)); } } stateLock.acquireReadLock(); try { checkOpenness(); makeStorageDirty(); atomicOperationsManager.startAtomicOperation((String) null, true); try { lockClusters(clustersToLock); <START> Map<ORecordOperation, OPhysicalPosition> positions = new IdentityHashMap<ORecordOperation, OPhysicalPosition>(); <END> for (ORecordOperation txEntry : newRecords) { ORecord rec = txEntry.getRecord(); if (rec.isDirty()) { ORecordId rid = (ORecordId) rec.getIdentity().copy(); ORecordId oldRID = rid.copy(); final OCluster cluster = getClusterById(rid.getClusterId()); OPhysicalPosition ppos = cluster.allocatePosition(ORecordInternal.getRecordType(rec)); rid.setClusterId(cluster.getId()); positions.put(txEntry, ppos); rid.setClusterPosition(ppos.clusterPosition); clientTx.updateIdentityAfterCommit(oldRID, rid); } } atomicOperationsManager.endAtomicOperation(false, null); } catch (Exception e) { atomicOperationsManager.endAtomicOperation(true, e); } } catch (IOException | RuntimeException ioe) { throw OException.wrapException(new OStorageException("Could not preallocate RIDs"), ioe); } finally { stateLock.releaseReadLock(); } } catch (RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (Error ee) { throw logAndPrepareForRethrow(ee); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }</code><technical_language>Values put positions fetched back</technical_language>

Target:
public void preallocateRids(final OTransaction clientTx) { try { checkOpenness(); checkLowDiskSpaceRequestsAndBackgroundDataFlushExceptionsAndBrokenPages(); @SuppressWarnings("unchecked") final Iterable<ORecordOperation> entries = (Iterable<ORecordOperation>) clientTx.getAllRecordEntries(); final TreeMap<Integer, OCluster> clustersToLock = new TreeMap<>(); final Set<ORecordOperation> newRecords = new TreeSet<>(COMMIT_RECORD_OPERATION_COMPARATOR); for (ORecordOperation txEntry : entries) { if (txEntry.type == ORecordOperation.CREATED) { newRecords.add(txEntry); int clusterId = txEntry.getRID().getClusterId(); clustersToLock.put(clusterId, getClusterById(clusterId)); } } stateLock.acquireReadLock(); try { checkOpenness(); makeStorageDirty(); atomicOperationsManager.startAtomicOperation((String) null, true); try { lockClusters(clustersToLock); for (ORecordOperation txEntry : newRecords) { ORecord rec = txEntry.getRecord(); if (rec.isDirty()) { ORecordId rid = (ORecordId) rec.getIdentity().copy(); ORecordId oldRID = rid.copy(); final OCluster cluster = getClusterById(rid.getClusterId()); OPhysicalPosition ppos = cluster.allocatePosition(ORecordInternal.getRecordType(rec)); rid.setClusterId(cluster.getId()); rid.setClusterPosition(ppos.clusterPosition); clientTx.updateIdentityAfterCommit(oldRID, rid); } } atomicOperationsManager.endAtomicOperation(false, null); } catch (Exception e) { atomicOperationsManager.endAtomicOperation(true, e); } } catch (IOException | RuntimeException ioe) { throw OException.wrapException(new OStorageException("Could not preallocate RIDs"), ioe); } finally { stateLock.releaseReadLock(); } } catch (RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (Error ee) { throw logAndPrepareForRethrow(ee); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }