@Override public final boolean execute(final Object txes) { if (txes instanceof TXEntryState && ((TXEntryState)txes).isDirty()) { tmpEntryCount++; } return true; } });
/** * If the entry is not dirty (read only) then clean it up. * @return true if this entry is not dirty. */ boolean cleanupNonDirty(LocalRegion r) { if (isDirty()) { return false; } else { cleanup(r); return true; } }
int getChanges() { int changes = 0; Iterator it = this.entryMods.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry)it.next(); TXEntryState txes = (TXEntryState)me.getValue(); if (txes.isDirty()) { changes++; } } if (this.uaMods != null) { changes += this.uaMods.size(); } return changes; }
/** * Returns true if the transaction state has this entry existing "locally". * Returns false if the transaction is going to remove this entry. */ public final boolean existsLocally() { if (this.op > OP_D_DESTROY) { return true; } if (isDirty()) { return false; } return !Token.isRemoved(this.originalVersionId); }
void getEvents(LocalRegion r, ArrayList events, TXState txs) { { Iterator it = this.entryMods.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry)it.next(); Object eKey = me.getKey(); TXEntryState txes = (TXEntryState)me.getValue(); if (txes.isDirty() && txes.isOpAnyEvent(r)) { events.add(txes.getEvent(r, eKey, txs)); } } } }
/** * Returns true if the transaction state has this entry existing "locally". * Returns false if the transaction is going to remove this entry. * * @param checkAndClearGIIEntry * if true then also check if this entry is received from GII and * clear the GII flag */ public final boolean existsLocally(boolean checkAndClearGIIEntry) { if (this.op > OP_D_DESTROY) { return true; } if (isDirty()) { if (!checkAndClearGIIEntry || !this.fromGII) { return false; } } return !Token.isRemoved(this.originalVersionId); }
/** * Returns a set of entry keys that this tx needs to request * a lock for at commit time. * @return <code>null</code> if no entries need to be locked. */ private Set getLockRequestEntryKeys() { HashSet result = null; Iterator it = this.entryMods.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry)it.next(); TXEntryState txes = (TXEntryState)me.getValue(); if (txes.isDirty() && !txes.isOpSearch()) { if (result == null) { result = new HashSet(); } result.add(me.getKey()); } } return result; }
void buildCompleteMessage(LocalRegion r, Object key, TXCommitMessage msg,Set otherRecipients) if (!isDirty()) {
/** * Get the value in TX if dirty else get the value in region. Returns null for * destroyed entry and relevant Token object for invalidated entry. */ @Unretained protected final Object getValueInTXOrRegion() { if (isDirty()) { return getNearSidePendingValue(); } else { @Unretained final Object oldVal = this.originalVersionId; if (!Token.isRemoved(oldVal)) { return oldVal; } return null; } }
@Override public Object call() throws Exception { Region rgn = getCache().getRegion(name); assertNull(rgn.get("txkey")); TXManagerImpl txMgr = getGemfireCache().getTxManager(); TXStateProxy tx = txMgr.getHostedTXState(txid); assertEquals(1, tx.getRegions().size()); for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertEquals("txkey", key); assertNotNull(es.getValue(r)); if (key.equals("txkey")) assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); // 2 buckets for the two puts we did in the accessor one dist. region, // and one more bucket if Cust1 and Cust10 resolve to different buckets assertEquals("unexpected regions: " + tx.getRegions(), 2, tx.getRegions().size()); for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNotNull(es.getValue(r)); assertTrue("key:"+key+" r:"+r.getFullPath(), es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 2 : 3; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 2 buckets for the two puts we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNotNull(es.getValue(r)); assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 2 : 3; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 2 buckets for the two puts we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNull(es.getValue(r)); assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 1 : 2; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 1 bucket for the put we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNull(es.getValue(r)); assertTrue("key:" + key + " r:" + r.getFullPath(), es.isDirty()); } } return null; } });
protected void applyBatchOperationOnNewEntry(final TXState txState, final LockingPolicy lockPolicy, final TXRegionState txrs, final LocalRegion region, final LocalRegion dataRegion, final Object regionValue, final RegionEntry entry, final boolean lockedForRead, final boolean checkValid, final EntryEventImpl eventTemplate) { // this EntryState should go into the TXState list and TXRegionState mods if (lockedForRead) { // release the read lock since write lock has been acquired lockPolicy.releaseLock(entry, lockPolicy.getReadLockMode(), txState.txId, false, dataRegion); } final THashMapWithCreate entryMap = checkValid ? txrs.getEntryMap() : txrs .getInternalEntryMap(); entryMap.put(this.regionKey, this); if (isDirty()) { updateForCommit(txState); } }
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 2 : 3; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 2 buckets for the two puts we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); Log.getLogWriter().warning( "SUP IS IT NULL(" + key + "):" + es.getValue(r)); assertNotNull(es.getValue(r)); assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { Region cust = getCache().getRegion(CUSTOMER); int hash1 = PartitionedRegionHelper.getHashKey((PartitionedRegion)cust, new CustId(1)); int hash10 = PartitionedRegionHelper.getHashKey((PartitionedRegion)cust, new CustId(10)); TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); // 2 buckets for the two puts we did in the accessor one dist. region, // and one more bucket if Cust1 and Cust10 resolve to different buckets assertEquals("unexpected regions: " + tx.getRegions(), 3 + (hash1 == hash10 ? 0 : 1), tx.getRegions().size()); for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNotNull(es.getValue(r)); assertTrue("key:"+key+" r:"+r.getFullPath(), es.isDirty()); } } return null; } });
RegionEntry re; entry.generateEventOffsets(this); if (entry.isDirty() && (re = entry.regionEntry) != null) {
rgn.entries.removeEntry(entry.getKey(), entry, false); if (txes.isDirty()) { numChanges++;
final TXEntryState txes = (TXEntryState)txEntry; if (txes.existsLocally()) { if (txes.isDirty()) { return new TXEntry(localRegion, dataRegion, key, txes, this);