You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/05/04 00:07:55 UTC
[41/54] geode git commit: Fix test failures
Fix test failures
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d29cc7e7
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d29cc7e7
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d29cc7e7
Branch: refs/heads/feature/GEODE-2632-11
Commit: d29cc7e76c9139ea77d7b22fe5f0687585cfd8e4
Parents: 0d0bf25
Author: Kirk Lund <kl...@apache.org>
Authored: Tue May 2 14:23:46 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed May 3 17:06:21 2017 -0700
----------------------------------------------------------------------
.../internal/AsyncEventQueueFactoryImpl.java | 32 -
.../query/internal/index/AbstractIndex.java | 12 +-
.../query/internal/index/IndexProtocol.java | 4 +-
.../geode/internal/cache/AbstractRegion.java | 2 +-
.../geode/internal/cache/PartitionedRegion.java | 32 +-
.../wan/serial/SerialGatewaySenderQueue.java | 55 +-
.../internal/cache/xmlcache/CacheCreation.java | 4 +-
.../geode/cache30/CacheXml66DUnitTest.java | 592 ++++++++-----------
.../geode/cache30/CacheXml70DUnitTest.java | 32 +-
.../geode/cache30/CacheXml80DUnitTest.java | 70 +--
.../geode/cache30/CacheXml81DUnitTest.java | 24 +-
.../geode/cache30/CacheXmlGeode10DUnitTest.java | 224 ++++---
.../apache/geode/cache30/CacheXmlTestCase.java | 60 +-
.../cache/execute/Bug51193DUnitTest.java | 1 -
...tentColocatedPartitionedRegionDUnitTest.java | 3 -
.../cache/internal/JUnit3CacheTestCase.java | 4 +-
.../cache/internal/JUnit4CacheTestCase.java | 8 +-
.../geode/cache/CacheXml70GatewayDUnitTest.java | 25 +-
.../geode/cache/CacheXml80GatewayDUnitTest.java | 46 +-
19 files changed, 480 insertions(+), 750 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
index 042d0f7..7549a26 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
@@ -152,38 +152,6 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
logger.debug("Creating GatewaySender that underlies the AsyncEventQueue");
}
- // TODO: Suranjan .separate asynceventqueue from gatewaysender
- // GatewaySenderFactory senderFactory = this.cache.createGatewaySenderFactory();
- // senderFactory.setMaximumQueueMemory(attrs.getMaximumQueueMemory());
- // senderFactory.setBatchSize(attrs.getBatchSize());
- // senderFactory.setBatchTimeInterval(attrs.getBatchTimeInterval());
- // if (attrs.isPersistenceEnabled()) {
- // senderFactory.setPersistenceEnabled(true);
- // }
- // senderFactory.setDiskStoreName(attrs.getDiskStoreName());
- // senderFactory.setDiskSynchronous(attrs.isDiskSynchronous());
- // senderFactory.setBatchConflationEnabled(attrs.isBatchConflationEnabled());
- // senderFactory.setParallel(attrs.isParallel());
- // senderFactory.setDispatcherThreads(attrs.getDispatcherThreads());
- // if OrderPolicy is not null, set it, otherwise, let the default OrderPolicy take the charge
- // if (attrs.getOrderPolicy() != null) {
- // senderFactory.setOrderPolicy(attrs.getOrderPolicy());
- // }
- // for (GatewayEventFilter filter : attrs.eventFilters) {
- // senderFactory.addGatewayEventFilter(filter);
- // }
- // senderFactory.setGatewayEventSubstitutionFilter(attrs.getGatewayEventSubstitutionFilter());
- // Type cast to GatewaySenderFactory implementation impl to add the async event listener
- // and set the isForInternalUse to true. These methods are not exposed on GatewaySenderFactory
- // GatewaySenderFactory factoryImpl = (GatewaySenderFactoryImpl) senderFactory;
- // senderFactory.setForInternalUse(true);
- // senderFactory.addAsyncEventListener(listener);
- // senderFactory.setBucketSorted(attrs.isBucketSorted());
- // add member id to differentiate between this region and the redundant bucket
- // region created for this queue.
- // GatewaySender sender =
- // senderFactory.create(
- // AsyncEventQueueImpl.getSenderIdFromAsyncEventQueueId(asyncQueueId));
addAsyncEventListener(listener);
GatewaySender sender =
create(AsyncEventQueueImpl.getSenderIdFromAsyncEventQueueId(asyncQueueId));
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
index d0a7299..3837838 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
@@ -488,9 +488,9 @@ public abstract class AbstractIndex implements IndexProtocol {
}
@Override
- public boolean addAllIndexMappings(Collection c) throws IMQException {
- for (Object regionEntry : c) {
- this.addMapping((RegionEntry) regionEntry);
+ public boolean addAllIndexMappings(Collection<RegionEntry> c) throws IMQException {
+ for (RegionEntry regionEntry : c) {
+ addMapping(regionEntry);
}
// if no exception, then success
return true;
@@ -507,9 +507,9 @@ public abstract class AbstractIndex implements IndexProtocol {
}
@Override
- public boolean removeAllIndexMappings(Collection c) throws IMQException {
- for (Object regionEntry : c) {
- removeMapping((RegionEntry) regionEntry, OTHER_OP);
+ public boolean removeAllIndexMappings(Collection<RegionEntry> c) throws IMQException {
+ for (RegionEntry regionEntry : c) {
+ removeMapping(regionEntry, OTHER_OP);
}
// if no exception, then success
return true;
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexProtocol.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexProtocol.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexProtocol.java
index 91faeb1..ab07f15 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexProtocol.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexProtocol.java
@@ -42,14 +42,14 @@ public interface IndexProtocol extends Index {
boolean addIndexMapping(RegionEntry entry) throws IMQException;
- boolean addAllIndexMappings(Collection c) throws IMQException;
+ boolean addAllIndexMappings(Collection<RegionEntry> c) throws IMQException;
/**
* @param opCode one of OTHER_OP, BEFORE_UPDATE_OP, AFTER_UPDATE_OP.
*/
boolean removeIndexMapping(RegionEntry entry, int opCode) throws IMQException;
- boolean removeAllIndexMappings(Collection c) throws IMQException;
+ boolean removeAllIndexMappings(Collection<RegionEntry> c) throws IMQException;
boolean clear() throws QueryException;
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index 31e7a25..9309374 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -1118,7 +1118,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
void checkEntryTimeoutAction(String mode, ExpirationAction ea) {
if ((this.dataPolicy.withReplication() || this.dataPolicy.withPartitioning())
- && ea == ExpirationAction.LOCAL_DESTROY || ea == ExpirationAction.LOCAL_INVALIDATE) {
+ && (ea == ExpirationAction.LOCAL_DESTROY || ea == ExpirationAction.LOCAL_INVALIDATE)) {
throw new IllegalArgumentException(
LocalizedStrings.AbstractRegion_0_ACTION_IS_INCOMPATIBLE_WITH_THIS_REGIONS_DATA_POLICY
.toLocalizedString(mode));
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 8be5646..2470f8f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -2034,9 +2034,7 @@ public class PartitionedRegion extends LocalRegion
}
} catch (RegionDestroyedException rde) {
if (!rde.getRegionFullPath().equals(getFullPath())) {
- RegionDestroyedException rde2 = new RegionDestroyedException(toString(), getFullPath());
- rde2.initCause(rde);
- throw rde2;
+ throw new RegionDestroyedException(toString(), getFullPath(), rde);
}
} finally {
if (putAllOp_save == null) {
@@ -3960,12 +3958,10 @@ public class PartitionedRegion extends LocalRegion
} else {
// with transaction
if (prce instanceof BucketNotFoundException) {
- TransactionException ex = new TransactionDataRebalancedException(
+ throw new TransactionDataRebalancedException(
LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING
.toLocalizedString(key),
prce);
- ex.initCause(prce);
- throw ex;
}
Throwable cause = prce.getCause();
if (cause instanceof PrimaryBucketException) {
@@ -3973,11 +3969,9 @@ public class PartitionedRegion extends LocalRegion
} else if (cause instanceof TransactionDataRebalancedException) {
throw (TransactionDataRebalancedException) cause;
} else if (cause instanceof RegionDestroyedException) {
- TransactionException ex = new TransactionDataRebalancedException(
+ throw new TransactionDataRebalancedException(
LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING
- .toLocalizedString(key));
- ex.initCause(cause);
- throw ex;
+ .toLocalizedString(key), cause);
} else {
// Make transaction fail so client could retry
// instead of returning null if ForceReattemptException is thrown.
@@ -5140,9 +5134,7 @@ public class PartitionedRegion extends LocalRegion
} catch (RegionDestroyedException rde) {
if (!rde.getRegionFullPath().equals(getFullPath())) {
// Handle when a bucket is destroyed
- RegionDestroyedException rde2 = new RegionDestroyedException(toString(), getFullPath());
- rde2.initCause(rde);
- throw rde2;
+ throw new RegionDestroyedException(toString(), getFullPath(), rde);
}
} finally {
this.prStats.endDestroy(startTime);
@@ -5637,9 +5629,7 @@ public class PartitionedRegion extends LocalRegion
} catch (RegionDestroyedException rde) {
if (!rde.getRegionFullPath().equals(getFullPath())) {
// Handle when a bucket is destroyed
- RegionDestroyedException rde2 = new RegionDestroyedException(toString(), getFullPath());
- rde2.initCause(rde);
- throw rde2;
+ throw new RegionDestroyedException(toString(), getFullPath(), rde);
}
} finally {
this.prStats.endInvalidate(startTime);
@@ -6364,9 +6354,7 @@ public class PartitionedRegion extends LocalRegion
retryNode = getOrCreateNodeForBucketRead(bucketIdInt);
} catch (RegionDestroyedException rde) {
if (!rde.getRegionFullPath().equals(getFullPath())) {
- RegionDestroyedException rde2 = new RegionDestroyedException(toString(), getFullPath());
- rde2.initCause(rde);
- throw rde2;
+ throw new RegionDestroyedException(toString(), getFullPath(), rde);
}
}
@@ -9451,11 +9439,9 @@ public class PartitionedRegion extends LocalRegion
try {
br.checkForPrimary();
} catch (PrimaryBucketException pbe) {
- RuntimeException re = new TransactionDataRebalancedException(
+ throw new TransactionDataRebalancedException(
LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING
- .toLocalizedString());
- re.initCause(pbe);
- throw re;
+ .toLocalizedString(), pbe);
}
}
} catch (RegionDestroyedException ignore) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
index 02baf81..60775a4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
@@ -55,6 +55,7 @@ import org.apache.geode.internal.cache.Conflatable;
import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.RegionQueue;
@@ -233,18 +234,8 @@ public class SerialGatewaySenderQueue implements RegionQueue {
(r instanceof DistributedRegion && r.getName().equals(PeerTypeRegistration.REGION_NAME));
final boolean isWbcl = this.regionName.startsWith(AsyncEventQueueImpl.ASYNC_EVENT_QUEUE_PREFIX);
if (!(isPDXRegion && isWbcl)) {
- // TODO: Kishor : after merging this change. AsyncEventQueue test failed
- // with data inconsistency. As of now going ahead with sync putandGetKey.
- // Need to work on this during cedar
- // if (this.keyPutNoSync) {
- // putAndGetKeyNoSync(event);
- // }
- // else {
- // synchronized (this) {
putAndGetKey(event);
return true;
- // }
- // }
}
return false;
}
@@ -366,26 +357,6 @@ public class SerialGatewaySenderQueue implements RegionQueue {
// If we do want to support it then each caller needs
// to call freeOffHeapResources and the returned GatewaySenderEventImpl
throw new UnsupportedOperationException();
- // resetLastPeeked();
- // AsyncEvent object = peekAhead();
- // // If it is not null, destroy it and increment the head key
- // if (object != null) {
- // Long key = this.peekedIds.remove();
- // if (logger.isTraceEnabled()) {
- // logger.trace("{}: Retrieved {} -> {}",this, key, object);
- // }
- // // Remove the entry at that key with a callback arg signifying it is
- // // a WAN queue so that AbstractRegionEntry.destroy can get the value
- // // even if it has been evicted to disk. In the normal case, the
- // // AbstractRegionEntry.destroy only gets the value in the VM.
- // this.region.destroy(key, RegionQueue.WAN_QUEUE_TOKEN);
- // updateHeadKey(key.longValue());
-
- // if (logger.isTraceEnabled()) {
- // logger.trace("{}: Destroyed {} -> {}", this, key, object);
- // }
- // }
- // return object;
}
public List<AsyncEvent> take(int batchSize) throws CacheException {
@@ -393,20 +364,6 @@ public class SerialGatewaySenderQueue implements RegionQueue {
// If we do want to support it then the callers
// need to call freeOffHeapResources on each returned GatewaySenderEventImpl
throw new UnsupportedOperationException();
- // List<AsyncEvent> batch = new ArrayList<AsyncEvent>(
- // batchSize * 2);
- // for (int i = 0; i < batchSize; i++) {
- // AsyncEvent obj = take();
- // if (obj != null) {
- // batch.add(obj);
- // } else {
- // break;
- // }
- // }
- // if (logger.isTraceEnabled()) {
- // logger.trace("{}: Took a batch of {} entries", this, batch.size());
- // }
- // return batch;
}
/**
@@ -969,7 +926,7 @@ public class SerialGatewaySenderQueue implements RegionQueue {
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private void initializeRegion(AbstractGatewaySender sender, CacheListener listener) {
- final GemFireCacheImpl gemCache = (GemFireCacheImpl) sender.getCache();
+ final InternalCache gemCache = sender.getCache();
this.region = gemCache.getRegion(this.regionName);
if (this.region == null) {
AttributesFactory<Long, AsyncEvent> factory = new AttributesFactory<Long, AsyncEvent>();
@@ -992,11 +949,9 @@ public class SerialGatewaySenderQueue implements RegionQueue {
factory.setEvictionAttributes(ea);
factory.setConcurrencyChecksEnabled(false);
-
factory.setDiskStoreName(this.diskStoreName);
- // TODO: Suranjan, can we do the following
- // In case of persistence write to disk sync and in case of eviction
- // write in async
+
+ // In case of persistence write to disk sync and in case of eviction write in async
factory.setDiskSynchronous(this.isDiskSynchronous);
// Create the region
@@ -1213,7 +1168,7 @@ public class SerialGatewaySenderQueue implements RegionQueue {
AbstractGatewaySender sender = null;
protected SerialGatewaySenderQueueMetaRegion(String regionName, RegionAttributes attrs,
- LocalRegion parentRegion, GemFireCacheImpl cache, AbstractGatewaySender sender) {
+ LocalRegion parentRegion, InternalCache cache, AbstractGatewaySender sender) {
super(regionName, attrs, parentRegion, cache,
new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
.setSnapshotInputStream(null).setImageTarget(null)
http://git-wip-us.apache.org/repos/asf/geode/blob/d29cc7e7/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
index 52030af..12a71a6 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
@@ -1005,8 +1005,8 @@ public class CacheCreation implements InternalCache {
@Override
public Region getRegion(String path) {
- if (!path.contains("/")) {
- throw new UnsupportedOperationException("Region path must contain '/'");
+ if (path.contains("/")) {
+ throw new UnsupportedOperationException("Region path '" + path + "' contains '/'");
}
return this.roots.get(path);
}