protected void checkVersionTag(DistributedRegion rgn, VersionTag tag) { RegionAttributes attr = rgn.getAttributes(); if (attr.getConcurrencyChecksEnabled() && attr.getDataPolicy().withPersistence() && attr.getScope() != Scope.GLOBAL && (tag.getMemberID() == null || test_InvalidVersion)) { if (logger.isDebugEnabled()) { logger.debug("Version tag is missing the memberID: {}", tag); } String msg = String.format("memberID cannot be null for persistent regions: %s", tag); RuntimeException ex = (sender.getVersionObject().compareTo(Version.GFE_80) < 0) ? new InternalGemFireException(msg) : new InvalidVersionException(msg); throw ex; } }
@Before public void setup() { event = mock(EntryEventImpl.class); region = mock(DistributedRegion.class); RegionAttributes attr = mock(RegionAttributes.class); CachePerfStats stats = mock(CachePerfStats.class); when(event.isOriginRemote()).thenReturn(false); when(stats.endPut(anyLong(), eq(false))).thenReturn(0L); message = new UpdateOperation.UpdateMessage(); message.event = event; when(region.isAllEvents()).thenReturn(true); when(region.getAttributes()).thenReturn(attr); when(region.isUsedForPartitionedRegionBucket()).thenReturn(false); when(region.getDataPolicy()).thenReturn(DataPolicy.REPLICATE); when(region.getConcurrencyChecksEnabled()).thenReturn(true); when(region.getCachePerfStats()).thenReturn(stats); when(attr.getDataPolicy()).thenReturn(DataPolicy.REPLICATE); when(event.getOperation()).thenReturn(Operation.CREATE); }
/** * Used to bootstrap txState. * * @return member with primary bucket for partitionedRegions */ @Override public DistributedMember getOwnerForKey(KeyInfo key) { assert !this.isInternalRegion() || this.isMetaRegionWithTransactions(); if (!this.getAttributes().getDataPolicy().withStorage() || (this.getConcurrencyChecksEnabled() && this.getAttributes().getDataPolicy() == DataPolicy.NORMAL)) { // execute on random replicate return getRandomReplicate(); } // if we are non-persistent, forward transactions to // a persistent member if (this.getConcurrencyChecksEnabled() && !generateVersionTag) { return getRandomPersistentReplicate(); } return super.getOwnerForKey(key); }
} else if (this.getAttributes().getDataPolicy().withReplication() || this.getAttributes().getDataPolicy().withPreloaded()) {
replicates.add(m2); when(lr.getAttributes()).thenReturn(attrs); when(lr.getSystem()).thenReturn(ds); when(lr.getCache()).thenReturn(cache);
/** * pause local operations so that a clear() can be performed and flush comm channels to the given * member */ void lockLocallyForClear(DistributionManager dm, InternalDistributedMember locker, CacheEvent event) { RegionVersionVector rvv = getVersionVector(); ARMLockTestHook armLockTestHook = getRegionMap().getARMLockTestHook(); if (armLockTestHook != null) { armLockTestHook.beforeLock(this, event); } if (rvv != null) { // block new operations from being applied to the region map rvv.lockForClear(getFullPath(), dm, locker); // Check for region destroyed after we have locked, to make sure // we don't continue a clear if the region has been destroyed. checkReadiness(); // Only need to flush if NOACK at this point if (this.getAttributes().getScope().isDistributedNoAck()) { Set<InternalDistributedMember> members = getDistributionAdvisor().adviseCacheOp(); StateFlushOperation.flushTo(members, this); } } if (armLockTestHook != null) { armLockTestHook.afterLock(this, null); } }