/** * Called by lower levels, while still holding the write sync lock, and the * low level has completed its part of the basic destroy */ void txApplyDestroyPart2(RegionEntry re, Object key, boolean inTokenMode, boolean clearConflict) { if (this.testCallable != null) { this.testCallable.call(this, Operation.DESTROY, re); } if (inTokenMode) { getImageState().addDestroyedEntry(key); } else { updateStatsForDestroy(); } if (this.entryUserAttributes != null) { this.entryUserAttributes.remove(key); } }
if (isPersistent) { if (persistentId != null) { state.addLeftMember(persistentId); state.addLeftMember((InternalDistributedMember)memberId);
is.lockGII(); is.getVersionTags(); is.getLeftMembers(); RegionVersionVector rvv = is.getClearRegionVersionVector(); try { Iterator/*<Object>*/ keysIt = getImageState().getDestroyedEntries(); while (keysIt.hasNext()) { this.entries.removeIfDestroyed(keysIt.next()); releaseAfterGetInitialImageLatch(); } finally { // make sure unlockGII is done for bug 40001 is.unlockGII();
private int getRegionSizeNoLock(boolean includeHDFSResults) { int result = getRegionMap().size(); // if this is a client with no tombstones then we subtract the number // of entries being affected by register-interest refresh if (this.imageState.isClient() && !this.concurrencyChecksEnabled) { result -= this.imageState.getDestroyedEntriesCount(); } if (includeHDFSResults) { return result; } else { return result - this.tombstoneCount.get(); } }
if (this.region.concurrencyChecksEnabled && rvv != null) { ImageState state = this.region.getImageState(); if (state.hasLeftMembers()) { Set<VersionSource> needsSync = null; Set<VersionSource> leftMembers = state.getLeftMembers(); Iterator<ImageState.VersionTagEntry> tags = state.getVersionTags(); while (tags.hasNext()) { ImageState.VersionTagEntry tag = tags.next();
is.lockGII(); if (giiStatus.didGII() && is.lockPendingTXRegionStates(true, false)) { Collection<TXRegionState> pendingTXStates = null; try { pendingTXStates = is.getPendingTXRegionStates(); getLogWriterI18n().info(LocalizedStrings.DEBUG, "Locking txState = " + txState); txState.lockTXState(); if (txState.isInProgress() && (txOrder = is.getFinishedTXOrder( txState.getTransactionId())) == 0) { inProgressTXStates.add(txrs); is.clearPendingTXRegionStates(false); } catch (Error err) { if (SystemFailure.isJVMFailureError(err)) { throw re; } finally { is.unlockPendingTXRegionStates(true); is.getVersionTags(); is.getLeftMembers(); RegionVersionVector rvv = is.getClearRegionVersionVector(); try { Iterator/*<Object>*/ keysIt = getImageState().getDestroyedEntries(); while (keysIt.hasNext()) {
if (rgn.getImageState().getInRecovery()) { return;
if (imageState.getRegionInvalidated()) { if (newValueToWrite != Token.TOMBSTONE) { newValueToWrite = Token.INVALID; else if (imageState.getClearRegionFlag()) { boolean entryOK = false; RegionVersionVector rvv = imageState.getClearRegionVersionVector(); if (rvv != null) { // a filtered clear VersionSource id = getVersionStamp().getMemberID(); imageState.addDestroyedEntry(this.getKey()); throw new RegionClearedException(LocalizedStrings.AbstractRegionEntry_DURING_THE_GII_PUT_OF_ENTRY_THE_REGION_GOT_CLEARED_SO_ABORTING_THE_OPERATION.toLocalizedString());
ImageState imgState = region.getImageState(); if (imgState.getClearRegionFlag()) { imgState.setClearRegionFlag(false, null);
ImageState imgState = region.getImageState(); while (requestUnappliedDeltas(dm, recipient)) { imgState.setRequestedUnappliedDelta(true); LogWriterI18n logger = this.region.getLogWriterI18n(); if (TRACE_GII || logger.fineEnabled()) { ImageState imgState = region.getImageState(); if (imgState.getClearRegionFlag()) { imgState.setClearRegionFlag(false, null);
getImageState().getLeftMembers(); getImageState().getVersionTags();
if (this.region.isDestroyed() || imgState.getClearRegionFlag()) { return false; imgState.addFailedEvents(failedEvents);
public static boolean checkImageStateFlag() throws Exception { Region rgn = new MapClearGIITest("dumb object to get cache").getCache().getRegion("/map"); if (rgn == null) { fail("Map region not yet created"); } if (((LocalRegion) rgn).getImageState().getClearRegionFlag()) { fail( "The image state clear region flag should have been cleared" + " (region size=" + rgn.size() + ")." + " Hence failing"); } if (!wasGIIInProgressDuringClear) { fail( "The clear operation invoked from VM1 reached VM0 after the " + "GII completed, or it reached VM0 even before the region in " + " VM0 got inserted in the subregion Map" + " (region size=" + rgn.size() + ")." + " Hence failing"); } if (rgn.size() != 0) { fail( "The clear operation invoked from VM1 should have made the " + "size of region zero. Hence failing. Size = " + rgn.size()); } return true; }
/** removes any destroyed entries from the region and clear the destroyedKeys * assert: Caller must be holding writeLock on is */ private void destroyEntriesAndClearDestroyedKeysSet() { ImageState is = getImageState(); Iterator iter = is.getDestroyedEntries(); while (iter.hasNext()) { Object key = iter.next(); // destroy the entry which has value Token.DESTROYED // If it is Token.DESTROYED then only destroy it. this.entries.removeIfDestroyed(key); // fixes bug 41957 } }
/** * Process an incoming version tag for concurrent operation detection. * This must be done before modifying the region entry. * @param re the entry that is to be modified * @param event the modification to the entry * @throws InvalidDeltaException if the event contains a delta that cannot be applied * @throws ConcurrentCacheModificationException if the event is in conflict * with a previously applied change */ private void processVersionTag(RegionEntry re, EntryEventImpl event) { if (re.getVersionStamp() != null) { re.getVersionStamp().processVersionTag(event); // during initialization we record version tag info to detect ops the // image provider hasn't seen VersionTag<?> tag = event.getVersionTag(); if (tag != null && !event.getRegion().isInitialized()) { ImageState is = event.getRegion().getImageState(); if (is != null && !event.getRegion().isUsedForPartitionedRegionBucket()) { if (logger.isTraceEnabled()) { logger.trace("recording version tag in image state: {}", tag); } is.addVersionTag(event.getKey(), tag); } } } }
Assert.assertTrue(this.scope.isDistributed()); profile.scope = this.scope; profile.inRecovery = getImageState().getInRecovery(); profile.isPersistent = getDataPolicy().withPersistence(); profile.setSubscriptionAttributes(getSubscriptionAttributes());
if (imageState.getRegionInvalidated()) { if (newValueToWrite != Token.TOMBSTONE) { newValueToWrite = Token.INVALID; else if (imageState.getClearRegionFlag()) { boolean entryOK = false; RegionVersionVector rvv = imageState.getClearRegionVersionVector(); if (rvv != null) { // a filtered clear VersionSource id = getVersionStamp().getMemberID(); imageState.addDestroyedEntry(this.getKeyCopy()); throw new RegionClearedException(LocalizedStrings.AbstractRegionEntry_DURING_THE_GII_PUT_OF_ENTRY_THE_REGION_GOT_CLEARED_SO_ABORTING_THE_OPERATION.toLocalizedString());
processor.waitForRepliesUninterruptibly(); ImageState imgState = region.getImageState(); if (imgState.getClearRegionFlag()) { imgState.setClearRegionFlag(false, null);
ImageState state = this.region.getImageState(); LogWriterI18n log = this.region.getLogWriterI18n(); if (state.hasLeftMembers()) { Set<VersionSource> needsSync = null; Set<VersionSource> leftMembers = state.getLeftMembers(); Iterator<ImageState.VersionTagEntry> tags = state.getVersionTags(); while (tags.hasNext()) { ImageState.VersionTagEntry tag = tags.next();
/** * @return size after considering imageState */ protected int getRegionSize() { synchronized(getSizeGuard()) { int result = getRegionMap().size(); // if this is a client with no tombstones then we subtract the number // of entries being affected by register-interest refresh if (this.imageState.isClient() && !this.concurrencyChecksEnabled) { return result - this.imageState.getDestroyedEntriesCount(); } if (includeHDFSResults()) { return result; } return result - this.tombstoneCount.get(); } }