this.localTXState.pendingReadLocksCleanup(this.lockPolicy, this.lockContext, this.lcc); this.localTXState.pendingReadLocksToTXState(this.lockPolicy, this.lockContext, this.lcc); this.localTXState.getProxy().remoteBatching(false); this.restoreBatching = true;
/** * Acquire lock on an entry for reading. For updates the read lock will be * upgraded to write once the row is qualified. */ public static boolean lockForRead(final TXState tx, final LockingPolicy lockPolicy, final LockMode mode, final int lockFlags, final RegionEntry entry, final GemFireContainer container, final LocalRegion dataRegion, final GemFireXDQueryObserver observer) { assert dataRegion != null: "unexpected null data region for " + entry + " in container " + container; final TXId txId = tx.getTransactionId(); if (observer != null) { observer.lockingRowForTX(tx.getProxy(), container, entry, false); } lockPolicy.acquireLock(entry, mode, lockFlags, txId, dataRegion, null); if (!entry.isDestroyedOrRemoved()) { return true; } unlockEntryAfterRead(txId, lockPolicy, mode, entry, container, dataRegion); return false; }
protected final void releaseRowLocationLock(final RowLocation rl, final GemFireContainer container) { if (rl != null) { // assumes that local TXState is non-null assert this.localTXStateSet && this.localTXState != null : "unexpected localTXState=" + this.localTXState; final TXState tx = this.localTXState; final LockingPolicy lockPolicy = tx.getLockingPolicy(); GemFireXDUtils.releaseLockForReadOnPreviousEntry( rl.getUnderlyingRegionEntry(), tx, tx.getTransactionId(), lockPolicy, lockPolicy.getReadLockMode(), container, null, this.lockContext); } }
@Override public final Object lockEntryForRead(final RegionEntry entry, final Object key, final LocalRegion dataRegion, final int iContext, final boolean allowTombstones, final ReadEntryUnderLock reader) { final LockingPolicy lockPolicy = getLockingPolicy(); return lockEntryForRead(lockPolicy, entry, key, dataRegion, null, this.txId, this, iContext, false, allowTombstones, Boolean.TRUE, reader); }
public TXEvent getEvent() { return new TXEvent(this, getTransactionId(), getCache()); }
public Entry getEntry(final KeyInfo keyInfo, final LocalRegion region, boolean allowTombstones) { TXEntryState tx = txReadEntry(keyInfo, region, true, true/*create txEntry is absent*/); if (tx != null && tx.existsLocally()) { return new TXEntry(region, keyInfo, getProxy()); } else { return null; } }
final TXState tx = this.localTXState; final RegionEntry entry = rl.getUnderlyingRegionEntry(); final LocalRegion dataRegion = tx.removeReadLockForScan(entry, this.lockContext); final TXStateProxy txProxy = tx.getProxy(); if (this.observer != null) { this.observer.lockingRowForTX(txProxy, container, entry, true); final LockingPolicy lockPolicy = tx.getLockingPolicy(); GemFireXDUtils.unlockEntryAfterRead(tx.getTransactionId(), lockPolicy, lockPolicy.getReadLockMode(), entry, container, dataRegion);
if (localTXState != null && !localTXState.isEmpty() && rl.getTXId() == null) { rl = (RowLocation)localTXState.getLocalEntry(this.baseRegion, dataRegion, bucketId, (AbstractRegionEntry)rl); if (rl == null) { if (localTXState.getProxy().lockEntry(entry, entry.getKey(), GemFireXDUtils.getRoutingObject(bucketId), this.baseRegion, dataRegion, false, TXEntryState.getReadOnlyOp(), dataRegion, this.observer)) { this.currentDataRegion = dataRegion; localTXState.addReadLockForScan(entry, this.readLockMode, dataRegion, this.lockContext);
logger.debug("committing transaction {}", getTransactionId()); cleanupNonDirtyRegions(); try { lockBucketRegions(); } catch(PrimaryBucketException pbe) { reserveAndCheck(); try { firedWriter = true; writer.beforeCommit(getEvent()); } catch(TransactionWriterException twe) { cleanup(); throw new CommitConflictException(twe); } catch (VirtualMachineError err) { cleanup(); // rollback the transaction! List/*<TXEntryStateWithRegionAndKey>*/ entries = generateEventOffsets(); TXCommitMessage msg = null; try { attachFilterProfileInformation(entries); applyChanges(entries); msg = buildMessage();
this.localTXState = this.txState.getTXStateForWrite(); this.lockContext = this.localTXState .getReadLocksForScanContext(this.lcc); restoreBatching = this.localTXState.getProxy().remoteBatching(true); this.localTXState = this.txState.getTXStateForWrite(); this.lockContext = null; restoreBatching = this.localTXState.getProxy().remoteBatching(true); .getReadLocksForScanContext(this.lcc); restoreBatching = this.localTXState.getProxy().remoteBatching(true);
if (localTXState != null && !localTXState.isEmpty()) { rl = (RowLocation)localTXState.getLocalEntry(this.baseRegion, dataRegion, -1 /* not used */, (AbstractRegionEntry)entry); this.readLockMode, this.forUpdate, entry, this.baseContainer, dataRegion, this.observer)) { this.localTXState.addReadLockForScan(entry, this.readLockMode, dataRegion, this.lockContext); this.currentDataRegion = dataRegion;
final TransactionObserver observer = getObserver(); THashMap toBePublishedEvents = this.proxy.eventsToBePublished; getProxy().addToBePublishedEvents(toBePublishedEvents); lockTXRSAndTXState(); final LockingPolicy lockPolicy = getLockingPolicy(); pendingReadLocksCleanup(lockPolicy, null, null); initBaseEventOffsetsForCommit(); commitEntryPhase1(currentEntry, lockPolicy, toBePublishedEvents, observer); currentEntry = currentEntry.next;
if (isCoordinator()) { dataRegion.waitForData(); final TXRegionState txr = writeRegion(dataRegion); final LockingPolicy lockPolicy = getLockingPolicy(); TXEntryState entry = null; txr.lock(); try { if ((entry = txWriteExistingEntry(event, region, dataRegion, txr, markPending, null)) != null) { if (entry.checkAndClearGIIEntry()) { if (markPending) { markPending(entry, entry.op, event.getCallbackArgument()); this.txId, false, dataRegion); if (markPending) { removePendingOpWithLock(entry); try { final RegionEntry re = entry.getUnderlyingRegionEntry(); cleanupOnUnsuccessfulWrite(entry, re, event.getKey(), txr, dataRegion, lockPolicy, entry != null && (txEntryCreated || isReadOnly), txEntryCreated,
tx.initBaseEventOffsetsForCommit(); final LockingPolicy lockPolicy = tx.getLockingPolicy(); final TransactionObserver observer = tx.getObserver(); final LogWriterI18n logger = tx.getTxMgr().getLogger(); final Collection<?> txess = this.entryMods.values(); applyChangesStart(this.region); TXEntryState txes = (TXEntryState)entry; try { tx.commitEntryPhase1(txes, lockPolicy, null, observer); } catch (Throwable t) { handleGIICommitException(t, logger); final boolean logFine = TXStateProxy.LOG_FINE; boolean firstTime = true; EntryEventImpl cbEvent = tx.getProxy().newEntryEventImpl(); GemFireCacheImpl cache = GemFireCacheImpl.getExisting(); final boolean reuseEV = !(cache.getOffHeapStore() != null && cache TXEntryState txes = (TXEntryState)entry; try { cbEvent = tx.commitEntryPhase2(txes, cbEvent, eventsToFree, firstTime, reuseEV, logger, logFine); if (cbEvent == null) { tx.cleanupTXRS(new TXRegionState[] { this }, lockPolicy, LockMode.EX, true, false, observer); } catch (Throwable t) {
@Override public void checkSupportsRegionInvalidate() throws UnsupportedOperationInTransactionException { getProxy().checkSupportsRegionInvalidate(); }
if (txState != null && txState.isInProgress()) { boolean added = false; txState.lockTXState(); if (txState.isInProgress()) { final TXRegionState[] regions = txState.getTXRegionStatesSnap(); for (TXRegionState txrs : regions) { if (txrs.region == rgn) { if (txState.isInProgress()) { txrss.add(txrs); txIdMap.put(txState.getTransactionId(), txState.getLockingPolicy()); added = true; txState.unlockTXState(); txrs.getTXState().unlockTXState();
public void rmRegion(final LocalRegion r) { final TXRegionState txr = this.regions.removeKey(r); if (txr != null) { final LockingPolicy lockPolicy = getLockingPolicy(); txr.lock(); try { txr.cleanup(lockPolicy, lockPolicy.getWriteLockMode(), false, true, null); txr.processPendingExpires(); txr.cleanupSnapshotRegionEntries(); } finally { txr.unlock(); } } if (isEmpty()) { getProxy().removeSelfFromHostedIfEmpty(null); } }
protected void cleanup(final boolean commit, final TransactionObserver observer) { this.state = commit ? State.CLOSED_COMMIT : State.CLOSED_ROLLBACK; final LockingPolicy lockPolicy = getLockingPolicy(); final LockMode writeMode = commit ? LockMode.EX : lockPolicy .getWriteLockMode(); try { if (observer != null) { observer.afterApplyChanges(this.proxy); } clearPendingOps(); if (!commit) { // release all pending read locks, if any pendingReadLocksCleanup(lockPolicy, null, null); } writeRegions.keySet().stream().filter(region -> region instanceof BucketRegion ).forEach(region -> ((BucketRegion)region).releaseSnapshotGIIReadLock() ); } finally { if (this.txLocked.compareAndSet(true, false)) { unlockTXState(); } cleanupTXRS(this.finalizeRegions, lockPolicy, writeMode, commit, true, observer); } }
/** * @see TXEntryId#getTXId() */ public TXId getTXId() { return this.myTX.getTransactionId(); } }
if (isSnapshot()) { event.setTXState(this); if (TXStateProxy.LOG_FINE) { final LogWriterI18n logger = getTxMgr().getLogger(); logger.info(LocalizedStrings.DEBUG, "putEntry Region " + region.getFullPath() + ", event: " + (TXStateProxy.LOG_FINE ? event.toString() final boolean isCoordinator = isCoordinator(); event.setOriginRemote(!isCoordinator); final TXRegionState txr = writeRegion(dataRegion); final LockingPolicy lockPolicy = getLockingPolicy(); if (TXStateProxy.LOG_FINE) { final LogWriterI18n logger = region.getLogWriterI18n(); checkExpectedOldValue(val, expectedOldValue, txr, region); val = tx.getValueInTXOrRegion(); if (expectedOldValue != null) { checkExpectedOldValue(val, expectedOldValue, txr, region); false, dataRegion); if (markPending) { removePendingOpWithLock(entry); if (!success) { try { cleanupOnUnsuccessfulWrite(tx, entry, key, txr, dataRegion, lockPolicy, lockAcquired, txEntryCreated, lockedForRead,