This is an automated email from the ASF dual-hosted git repository.
udo pushed a commit to branch feature/GEODE-4685
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-4685 by this
push:
new 7581023 GEODE-4685: Address pre-checkin test failures
7581023 is described below
commit 7581023d19c51ea1227eb684902325e84f73d947
Author: Udo <[email protected]>
AuthorDate: Tue Feb 27 14:34:37 2018 -0800
GEODE-4685: Address pre-checkin test failures
---
.../geode/cache/query/internal/DefaultQuery.java | 32 ++++++++-------
.../internal/streaming/StreamingOperation.java | 6 ++-
.../geode/internal/cache/GemFireCacheImpl.java | 3 +-
.../AnalyzeSerializablesJUnitTest.java | 45 +++++++++-------------
.../apache/geode/codeAnalysis/excludedClasses.txt | 1 +
.../codeAnalysis/sanctionedDataSerializables.txt | 4 +-
6 files changed, 42 insertions(+), 49 deletions(-)
diff --git
a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
index 03c723a..e02aacb 100644
---
a/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
+++
b/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQuery.java
@@ -23,7 +23,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.LongAdder;
import org.apache.geode.cache.CacheRuntimeException;
import org.apache.geode.cache.Region;
@@ -71,9 +71,9 @@ public class DefaultQuery implements Query {
private ServerProxy serverProxy;
- protected AtomicLong numExecutions = new AtomicLong(0);
+ private final LongAdder numExecutions = new LongAdder();
- private final AtomicLong totalExecutionTime = new AtomicLong(0);
+ private final LongAdder totalExecutionTime = new LongAdder();
private final QueryStatistics stats;
@@ -108,7 +108,7 @@ public class DefaultQuery implements Query {
* This is declared as array so that it can be synchronized between two
threads to validate the
* state.
*/
- private final boolean[] queryCompletedForMonitoring = new boolean[] {false};
+ private final boolean[] queryCompletedForMonitoring = new boolean[]{false};
private ProxyCache proxyCache;
@@ -249,7 +249,6 @@ public class DefaultQuery implements Query {
/**
* Should be constructed from DefaultQueryService
- *
* @see QueryService#newQuery
*/
public DefaultQuery(String queryString, InternalCache cache, boolean
isForRemote) {
@@ -371,7 +370,7 @@ public class DefaultQuery implements Query {
boolean needsCopyOnReadWrapper =
this.cache.getCopyOnRead() &&
!DefaultQueryService.COPY_ON_READ_AT_ENTRY_LEVEL
|| (((QueryExecutionContext) context).isIndexUsed()
- && DefaultQueryService.COPY_ON_READ_AT_ENTRY_LEVEL);
+ && DefaultQueryService.COPY_ON_READ_AT_ENTRY_LEVEL);
// For local queries returning pdx objects wrap the resultset with
// ResultsCollectionPdxDeserializerWrapper
// which deserializes these pdx objects.
@@ -694,8 +693,8 @@ public class DefaultQuery implements Query {
}
private void updateStatistics(long executionTime) {
- this.numExecutions.incrementAndGet();
- this.totalExecutionTime.addAndGet(executionTime);
+ this.numExecutions.increment();
+ this.totalExecutionTime.add(executionTime);
this.cache.getCachePerfStats().endQueryExecution(executionTime);
}
@@ -722,7 +721,7 @@ public class DefaultQuery implements Query {
*/
@Override
public long getTotalExecutionTime() {
- return DefaultQuery.this.totalExecutionTime.get();
+ return DefaultQuery.this.totalExecutionTime.longValue();
}
/**
@@ -730,7 +729,7 @@ public class DefaultQuery implements Query {
*/
@Override
public long getNumExecutions() {
- return DefaultQuery.this.numExecutions.get();
+ return DefaultQuery.this.numExecutions.longValue();
}
}
@@ -739,7 +738,6 @@ public class DefaultQuery implements Query {
* region which is associated with the query as a bind parameter will not be
included in the list.
* The Region names returned by the query do not indicate anything about the
state of the region
* or whether the region actually exists in the GemfireCache etc.
- *
* @param parameters the parameters to be passed in to the query when
executed
* @return Unmodifiable List containing the region names.
*/
@@ -766,7 +764,7 @@ public class DefaultQuery implements Query {
/**
* @return int identifying the limit. A value of -1 indicates that no limit
is imposed or the
- * query is not a select query
+ * query is not a select query
*/
public int getLimit(Object[] bindArguments) throws FunctionDomainException,
TypeMismatchException,
NameResolutionException, QueryInvocationTargetException {
@@ -859,7 +857,7 @@ public class DefaultQuery implements Query {
}
private static String getLogMessage(QueryObserver observer, long startTime,
int resultSize,
- String query) {
+ String query) {
float time = (NanoTimer.getTime() - startTime) / 1.0e6f;
String usedIndexesString = null;
@@ -873,7 +871,7 @@ public class DefaultQuery implements Query {
sb.append(')');
if (usedIndexes.size() > 0) {
sb.append(':');
- for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();)
{
+ for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();
) {
Map.Entry entry = (Map.Entry) itr.next();
sb.append(entry.getKey()).append(entry.getValue());
if (itr.hasNext()) {
@@ -896,7 +894,8 @@ public class DefaultQuery implements Query {
}
private static String getLogMessage(IndexTrackingQueryObserver
indexObserver, long startTime,
- String otherObserver, int resultSize, String query, BucketRegion bucket)
{
+ String otherObserver, int resultSize,
String query,
+ BucketRegion bucket) {
float time = 0.0f;
if (startTime > 0L) {
@@ -912,7 +911,7 @@ public class DefaultQuery implements Query {
sb.append(')');
if (!usedIndexes.isEmpty()) {
sb.append(':');
- for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();)
{
+ for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();
) {
Map.Entry entry = (Map.Entry) itr.next();
sb.append(entry.getKey()).append("(Results:
").append(entry.getValue())
.append(", Bucket: ").append(bucket.getId()).append(")");
@@ -985,7 +984,6 @@ public class DefaultQuery implements Query {
/**
* For queries which are executed from a Function "with a Filter".
- *
* @return returns if this query is coming from a {@link Function}.
*/
public boolean isQueryWithFunctionContext() {
diff --git
a/geode-core/src/main/java/org/apache/geode/distributed/internal/streaming/StreamingOperation.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/streaming/StreamingOperation.java
index c7ef43e..817fd37 100644
---
a/geode-core/src/main/java/org/apache/geode/distributed/internal/streaming/StreamingOperation.java
+++
b/geode-core/src/main/java/org/apache/geode/distributed/internal/streaming/StreamingOperation.java
@@ -25,6 +25,9 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.pdx.internal.TypeRegistry;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
@@ -433,8 +436,6 @@ public abstract class StreamingOperation {
private transient boolean isCanceled = false; // used only on receiving
side and if
// messageProcessor is of
type
//
PartitionedRegionQueryEvaluator.StreamingQueryPartitionResponse
- private transient InternalCache cache;
-
/**
* @param chunkStream the data to send back, if null then all the
following parameters are
@@ -503,6 +504,7 @@ public abstract class StreamingOperation {
this.pdxReadSerialized = in.readBoolean();
Version senderVersion =
InternalDataSerializer.getVersionForDataStream(in);
boolean isSenderAbove_8_1 = senderVersion.compareTo(Version.GFE_81) > 0;
+ InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
if (n == -1) {
this.objectList = null;
} else {
diff --git
a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index f0aa07e..382fce3 100755
---
a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++
b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -5057,8 +5057,7 @@ public class GemFireCacheImpl implements InternalCache,
InternalClientCache, Has
*/
public boolean getPdxReadSerializedByAnyGemFireServices() {
Boolean pdxReadSerializedOverriden =
this.getPdxRegistry().getPdxReadSerializedOverride();
- return (getPdxReadSerialized() || pdxReadSerializedOverriden)
- && PdxInstanceImpl.getPdxReadSerialized();
+ return (getPdxReadSerialized() || pdxReadSerializedOverriden) &&
PdxInstanceImpl.getPdxReadSerialized();
}
@Override
diff --git
a/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
index c72a1bf..d328d09 100644
---
a/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
@@ -82,12 +82,14 @@ public class AnalyzeSerializablesJUnitTest {
+ "If the class is not persisted or sent over the wire add it to the
file " + NEW_LINE + "%s"
+ NEW_LINE + "Otherwise if this doesn't break backward compatibility,
copy the file "
+ NEW_LINE + "%s to " + NEW_LINE + "%s.";
- public static final String EXCLUDED_CLASSES_TXT = "excludedClasses.txt";
- public static final String ACTUAL_DATA_SERIALIZABLES_DAT =
"actualDataSerializables.dat";
- public static final String ACTUAL_SERIALIZABLES_DAT =
"actualSerializables.dat";
- public static final String OPEN_BUGS_TXT = "openBugs.txt";
+ private static final String EXCLUDED_CLASSES_TXT = "excludedClasses.txt";
+ private static final String ACTUAL_DATA_SERIALIZABLES_DAT =
"actualDataSerializables.dat";
+ private static final String ACTUAL_SERIALIZABLES_DAT =
"actualSerializables.dat";
+ private static final String OPEN_BUGS_TXT = "openBugs.txt";
- /** all loaded classes */
+ /**
+ * all loaded classes
+ */
private Map<String, CompiledClass> classes;
private File expectedDataSerializablesFile;
@@ -98,13 +100,10 @@ public class AnalyzeSerializablesJUnitTest {
private List<ClassAndMethodDetails> expectedDataSerializables;
private List<ClassAndVariableDetails> expectedSerializables;
- private File actualDataSerializablesFile;
- private File actualSerializablesFile;
-
@Rule
public TestName testName = new TestName();
- public void loadExpectedDataSerializables() throws Exception {
+ private void loadExpectedDataSerializables() throws Exception {
this.expectedDataSerializablesFile =
getResourceAsFile("sanctionedDataSerializables.txt");
assertThat(this.expectedDataSerializablesFile).exists().canRead();
@@ -159,12 +158,12 @@ public class AnalyzeSerializablesJUnitTest {
findClasses();
loadExpectedDataSerializables();
- this.actualDataSerializablesFile =
createEmptyFile(ACTUAL_DATA_SERIALIZABLES_DAT);
+ File actualDataSerializablesFile =
createEmptyFile(ACTUAL_DATA_SERIALIZABLES_DAT);
System.out.println(this.testName.getMethodName() + "
actualDataSerializablesFile="
- + this.actualDataSerializablesFile.getAbsolutePath());
+ + actualDataSerializablesFile.getAbsolutePath());
List<ClassAndMethods> actualDataSerializables = findToDatasAndFromDatas();
- storeClassesAndMethods(actualDataSerializables,
this.actualDataSerializablesFile);
+ storeClassesAndMethods(actualDataSerializables,
actualDataSerializablesFile);
String diff =
diffSortedClassesAndMethods(this.expectedDataSerializables,
actualDataSerializables);
@@ -173,7 +172,7 @@ public class AnalyzeSerializablesJUnitTest {
"++++++++++++++++++++++++++++++testDataSerializables found
discrepancies++++++++++++++++++++++++++++++++++++");
System.out.println(diff);
fail(diff + FAIL_MESSAGE,
getSrcPathFor(getResourceAsFile(EXCLUDED_CLASSES_TXT)),
- this.actualDataSerializablesFile.getAbsolutePath(),
+ actualDataSerializablesFile.getAbsolutePath(),
getSrcPathFor(this.expectedDataSerializablesFile));
}
}
@@ -184,12 +183,12 @@ public class AnalyzeSerializablesJUnitTest {
findClasses();
loadExpectedSerializables();
- this.actualSerializablesFile = createEmptyFile(ACTUAL_SERIALIZABLES_DAT);
+ File actualSerializablesFile = createEmptyFile(ACTUAL_SERIALIZABLES_DAT);
System.out.println(this.testName.getMethodName() + "
actualSerializablesFile="
- + this.actualSerializablesFile.getAbsolutePath());
+ + actualSerializablesFile.getAbsolutePath());
List<ClassAndVariables> actualSerializables = findSerializables();
- storeClassesAndVariables(actualSerializables,
this.actualSerializablesFile);
+ storeClassesAndVariables(actualSerializables, actualSerializablesFile);
String diff = diffSortedClassesAndVariables(this.expectedSerializables,
actualSerializables);
if (!diff.isEmpty()) {
@@ -197,7 +196,7 @@ public class AnalyzeSerializablesJUnitTest {
"++++++++++++++++++++++++++++++testSerializables found
discrepancies++++++++++++++++++++++++++++++++++++");
System.out.println(diff);
fail(diff + FAIL_MESSAGE,
getSrcPathFor(getResourceAsFile(EXCLUDED_CLASSES_TXT)),
- this.actualSerializablesFile.getAbsolutePath(),
+ actualSerializablesFile.getAbsolutePath(),
getSrcPathFor(this.expectedSerializablesFile, "main"));
}
}
@@ -221,12 +220,7 @@ public class AnalyzeSerializablesJUnitTest {
+ " is not Serializable and should be removed from
excludedClasses.txt",
Serializable.class.isAssignableFrom(excludedClass));
- if (excludedClass.isEnum()) {
- // geode enums are special cased by DataSerializer and are never
java-serialized
- // for (Object instance: excludedClass.getEnumConstants()) {
- // serializeAndDeserializeObject(instance);
- // }
- } else {
+ if (!excludedClass.isEnum()) {
final Object excludedInstance;
try {
excludedInstance = excludedClass.newInstance();
@@ -251,7 +245,7 @@ public class AnalyzeSerializablesJUnitTest {
System.out.println("Not Serializable: " + object.getClass().getName());
}
try {
- Object instance = DataSerializer
+ DataSerializer
.readObject(new DataInputStream(new
ByteArrayInputStream(outputStream.toByteArray())));
fail("I was able to deserialize " + object.getClass().getName());
} catch (InvalidClassException e) {
@@ -264,7 +258,6 @@ public class AnalyzeSerializablesJUnitTest {
loadExpectedSerializables();
Set<String> openBugs = new
HashSet<>(loadOpenBugs(getResourceAsFile(OPEN_BUGS_TXT)));
-
DistributionConfig distributionConfig = new DistributionConfigImpl(new
Properties());
distributionConfig.setValidateSerializableObjects(true);
distributionConfig.setSerializableObjectFilter("!*");
@@ -303,7 +296,7 @@ public class AnalyzeSerializablesJUnitTest {
continue;
}
- Object sanctionedInstance = null;
+ Object sanctionedInstance;
if (!Serializable.class.isAssignableFrom(sanctionedClass)) {
throw new AssertionError(
className + " is not serializable. Remove it from " +
expectedSerializablesFileName);
diff --git
a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
index 895758c..87d04eb 100644
---
a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
+++
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
@@ -90,3 +90,4 @@
org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$4
org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$5
org/apache/geode/cache/client/internal/pooling/ConnectionManagerImpl$ClosedPoolConnectionList
org/apache/geode/cache/query/internal/parse/ASTArithmeticOp
+org/apache/geode/cache/query/internal/DefaultQuery$1
\ No newline at end of file
diff --git
a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index c17eecb..b45c38b 100644
---
a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -353,8 +353,8 @@ fromData,16,2a2bb700202a2bb900210100b50003b1
toData,16,2a2bb700222b2ab40003b900230200b1
org/apache/geode/distributed/internal/streaming/StreamingOperation$StreamingReplyMessage,2
-fromData,339,2a2bb700142bb9001501003d2a2bb900150100b500102a2bb900160100b500112a2bb900160100b500032bb800174e2db20018b600199e000704a700040336041c02a0000b2a01b50002a701082a1cb5000e2abb001a591cb7001bb500022ab4000399000704b8001c2ab40008b8001d3a051905c1001e3606013a07150699000d1905c0001eb6001f3a0703360803360915091ca20087b20020c6000cb2002006b900210200150699000fb80022990009043608a700672bb800233a0a150699004a1907c600451907b90024010099003b1504360b150b99001715099a0012190ac100259a000704a7000403360b150
[...]
-toData,85,2a2bb7002b2ab4000dc7000d2b02b9002c0200a7000d2b2ab4000eb9002c02002b2ab40010b9002c02002b2ab40011b9002d02002b2ab40003b9002d02002ab4000dc600122ab4000e9e000b2ab4000d2bb6002eb1
+fromData,368,2a2bb700142bb9001501003d2a2bb900150100b500102a2bb900160100b500112a2bb900160100b500032bb800174e2db20018b600199e000704a70004033604b8001ac0001b3a051c02a0000b2a01b50002a7011d2a1cb5000e2abb001c591cb7001db500022ab4000399000e1905b9001e010004b6001f2ab40008b800203a061906c100213607013a08150799000d1906c00021b600223a0803360903360a150a1ca20087b20023c6000cb2002306b900240200150799000fb80025990009043609a700672bb800263a0b150799004a1908c600451908b90027010099003b1504360c150c990017150a9a0012190
[...]
+toData,85,2a2bb7002e2ab4000dc7000d2b02b9002f0200a7000d2b2ab4000eb9002f02002b2ab40010b9002f02002b2ab40011b9003002002b2ab40003b9003002002ab4000dc600122ab4000e9e000b2ab4000d2bb60031b1
org/apache/geode/distributed/internal/tcpserver/InfoRequest,2
fromData,1,b1
--
To stop receiving notification emails like this one, please contact
[email protected].