@Override public void basicPutPart3(EntryEventImpl event, RegionEntry entry, boolean isInitialized, long lastModified, boolean invokeCallbacks, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue) { // We used to dispatch listener events here which is moved to part2 to be in RE lock #45520. if (invokeCallbacks) { if (event.isBulkOpInProgress()) { event.getPutAllOperation().addEntry(event); } } }
@Override public Object destroy(Object key, Object expectedOldValue, Operation operation, EntryEventImpl event, Object callbackArg) { if (event.isBulkOpInProgress()) { // this is a removeAll, ignore this! return null; } recordTXOperation(ServerRegionOperation.DESTROY, key, expectedOldValue, operation, event.getEventId(), callbackArg); return DestroyOp.execute(this.pool, this.region, key, expectedOldValue, operation, event, callbackArg, this.pool.getPRSingleHopEnabled()); }
/** * distribution and callback notification are done in part2 inside entry lock for maintaining the * order of events. */ @Override public void basicDestroyPart3(RegionEntry re, EntryEventImpl event, boolean inTokenMode, boolean duringRI, boolean invokeCallbacks, Object expectedOldValue) { if (invokeCallbacks) { if (event.isBulkOpInProgress()) { event.getRemoveAllOperation().addEntry(event); } } if (!inTokenMode || duringRI) { updateStatsForDestroy(); } if (this.entryUserAttributes != null) { this.entryUserAttributes.remove(event.getKey()); } }
void distributeDestroy(EntryEventImpl event, Object expectedOldValue) { if (event.isDistributed() && !event.isOriginRemote() && !event.isBulkOpInProgress()) { boolean distribute = !event.getInhibitDistribution(); if (distribute) { // before distribute: DR.destroy, it has notifiedGatewaySender ealier DestroyOperation op = new DestroyOperation(event); op.distribute(); } } }
/** distribute an update operation */ protected void distributeUpdate(EntryEventImpl event, long lastModified, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue) { // an update from a netSearch is not distributed if (!event.isOriginRemote() && !event.isNetSearch() && !event.isBulkOpInProgress()) { boolean distribute = true; if (event.getInhibitDistribution()) { // this has already been distributed by a one-hop operation distribute = false; } if (distribute) { // before distribute: DR's put, it has notified gateway sender earlier UpdateOperation op = new UpdateOperation(event, lastModified); if (logger.isTraceEnabled()) { logger.trace("distributing operation for event : {} : for region : {}", event, this.getName()); } op.distribute(); } } }
@Override public void basicPutPart3(EntryEventImpl event, RegionEntry entry, boolean isInitialized, long lastModified, boolean invokeCallbacks, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue) { super.basicPutPart3(event, entry, isInitialized, lastModified, invokeCallbacks, ifNew, ifOld, expectedOldValue, requireOldValue); // this code is copied from LocalRegion.basicPutPart2 invokeCallbacks &= !entry.isTombstone(); // put() is creating a tombstone if (invokeCallbacks) { boolean doCallback = false; if (isInitialized) { if (event.isGenerateCallbacks()) { doCallback = true; } } if (doCallback) { notifyGatewaySender(event.getOperation().isUpdate() ? EnumListenerEvent.AFTER_UPDATE : EnumListenerEvent.AFTER_CREATE, event); // Notify listeners if (!event.isBulkOpInProgress()) { try { entry.dispatchListenerEvents(event); } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); this.stopper.checkCancelInProgress(null); } } } } }
if (event.isBulkOpInProgress() && this.isUsedForPartitionedRegionBucket) { if (logger.isDebugEnabled()) { logger.debug("For bulk operation on bucket region, not to notify gateway sender earlier."); if (invokeCallbacks && !event.isBulkOpInProgress()) { if (isInitialized() && (!inTokenMode || duringRI) || this.isUsedForPartitionedRegionBucket) { try {
: EnumListenerEvent.AFTER_CREATE, event); if (!event.isBulkOpInProgress()) { try { entry.dispatchListenerEvents(event);
/** release version-generation permission from the region's version vector */ @Override public void releaseCacheModificationLock(InternalRegion owner, EntryEventImpl event) { boolean lockedByBulkOp = event.isBulkOpInProgress() && owner.getDataPolicy().withReplication(); if (armLockTestHook != null) armLockTestHook.beforeRelease(owner, event); if (!event.isOriginRemote() && !lockedByBulkOp && !owner.hasServerProxy()) { RegionVersionVector vector = owner.getVersionVector(); if (vector != null) { vector.releaseCacheModificationLock(); } } if (armLockTestHook != null) armLockTestHook.afterRelease(owner, event); }
/** get version-generation permission from the region's version vector */ @Override public void lockForCacheModification(InternalRegion owner, EntryEventImpl event) { boolean lockedByBulkOp = event.isBulkOpInProgress() && owner.getDataPolicy().withReplication(); if (armLockTestHook != null) { armLockTestHook.beforeLock(owner, event); } if (!event.isOriginRemote() && !lockedByBulkOp && !owner.hasServerProxy()) { RegionVersionVector vector = owner.getVersionVector(); if (vector != null) { vector.lockForCacheModification(); } } if (armLockTestHook != null) { armLockTestHook.afterLock(owner, event); } }
@Override public void basicDestroyBeforeRemoval(RegionEntry entry, EntryEventImpl event) { long token = -1; DestroyOperation op = null; try { // Assumed this is called with entry synchrony if (!event.isOriginRemote() && !event.isBulkOpInProgress() && !event.getOperation().isLocal() && !Operation.EVICT_DESTROY.equals(event.getOperation()) && !(event.isExpiration() && isEntryEvictDestroyEnabled())) { if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) { VersionTag v = entry.generateVersionTag(null, false, this, event); if (logger.isDebugEnabled() && v != null) { logger.debug("generated version tag {} in region {}", v, this.getName()); } } // This code assumes it is safe ignore token mode (GII in progress) // because it assume when the origin of the event is local, // then GII has completed (the region has been completely initialized) // This code assumes that this bucket is primary // before distribute: BR.destroy for retain op = new DestroyOperation(event); token = op.startOperation(); } super.basicDestroyBeforeRemoval(entry, event); } finally { if (op != null) { op.endOperation(token); } } }
if (event.isBulkOpInProgress() && this.isUsedForPartitionedRegionBucket) { if (logger.isDebugEnabled()) { logger.debug( if (!event.isBulkOpInProgress()) { try { entry.dispatchListenerEvents(event);
private void markEventAsDuplicate(EntryEventImpl event) { event.setPossibleDuplicate(true); if (getConcurrencyChecksEnabled() && event.getVersionTag() == null) { if (event.isBulkOpInProgress()) { event.setVersionTag(getEventTracker().findVersionTagForBulkOp(event.getEventId())); } else { event.setVersionTag(getEventTracker().findVersionTagForSequence(event.getEventId())); } } }
protected void distributeUpdateOperation(EntryEventImpl event, long lastModified) { long token = -1; UpdateOperation op = null; try { if (!event.isOriginRemote() && !event.isNetSearch() && getBucketAdvisor().isPrimary()) { if (event.isBulkOpInProgress()) { // consolidate the UpdateOperation for each entry into a PutAllMessage // since we did not call basicPutPart3(), so we have to explicitly addEntry here event.getPutAllOperation().addEntry(event, this.getId()); } else { // before distribute: BR's put op = new UpdateOperation(event, lastModified); token = op.startOperation(); if (logger.isDebugEnabled()) { logger.debug("sent update operation : for region : {}: with event: {}", this.getName(), event); } } } if (!event.getOperation().isPutAll()) { // putAll will invoke listeners later event.invokeCallbacks(this, true, true); } } finally { if (op != null) { op.endOperation(token); } } }
if (!event.isBulkOpInProgress() || this.getDataPolicy().withStorage()) { if (event.isBulkOpInProgress() && !event.isOriginRemote()) { event.getPutAllOperation().addEntry(event, true);
protected void distributeDestroyOperation(EntryEventImpl event) { long token = -1; DestroyOperation op = null; try { if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "BR.basicDestroy: this cache has already seen this event {}", event); } if (!event.isOriginRemote() && getBucketAdvisor().isPrimary()) { if (event.isBulkOpInProgress()) { // consolidate the DestroyOperation for each entry into a RemoveAllMessage event.getRemoveAllOperation().addEntry(event, this.getId()); } else { // This cache has processed the event, forward operation // and event messages to backup buckets // before distribute: BR's destroy, not to trigger callback here event.setOldValueFromRegion(); op = new DestroyOperation(event); token = op.startOperation(); } } if (!event.getOperation().isRemoveAll()) { // removeAll will invoke listeners later event.invokeCallbacks(this, true, false); } } finally { if (op != null) { op.endOperation(token); } } }
Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) { if (event.isBulkOpInProgress()) {
if (!event.isBulkOpInProgress()) { long start = this.partitionedRegion.getPrStats().startSendReplication(); try {
if (!event.isBulkOpInProgress() || this.getDataPolicy().withStorage()) { if (event.isBulkOpInProgress() && !event.isOriginRemote()) { event.getRemoveAllOperation().addEntry(event, true);
ServerRegionProxy mySRP = getServerProxy(); if (mySRP != null) { if (event.isBulkOpInProgress()) {