Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEODE-9190 Cleanup of Stats Code Warnings #6347

Merged
merged 8 commits into from Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -326,7 +326,7 @@ private void performUpdate(VM memberVM) {
memberVM.invoke("perform update", () -> {
DMStats stats = ((InternalDistributedSystem) cache.getDistributedSystem())
.getDistributionManager().getStats();
int reconnectAttempts = stats.getReconnectAttempts();
long reconnectAttempts = stats.getReconnectAttempts();
cache.getRegion(regionName).put("testKey", "updatedTestValue");
assertThat(stats.getReconnectAttempts()).isEqualTo(reconnectAttempts);
});
Expand Down
Expand Up @@ -296,8 +296,8 @@ public Properties getDistributedSystemProperties() {
protected void addDSProps(Properties p) {}

protected void validateMulticastOpsAfterRegionOps() {
int writes = getGemfireCache().getDistributionManager().getStats().getMcastWrites();
int reads = getGemfireCache().getDistributionManager().getStats().getMcastReads();
long writes = getGemfireCache().getDistributionManager().getStats().getMcastWrites();
long reads = getGemfireCache().getDistributionManager().getStats().getMcastReads();
assertTrue("Should have multicast writes or reads. Writes= " + writes + " ,read= " + reads,
writes > 0 || reads > 0);

Expand All @@ -306,17 +306,17 @@ protected void validateMulticastOpsAfterRegionOps() {

protected void validateUDPEncryptionStats() {
long encrptTime =
getGemfireCache().getDistributionManager().getStats().getUDPMsgEncryptionTiime();
getGemfireCache().getDistributionManager().getStats().getUDPMsgEncryptionTime();
long decryptTime =
getGemfireCache().getDistributionManager().getStats().getUDPMsgDecryptionTime();
assertTrue("Should have multicast writes or reads. encrptTime= " + encrptTime
+ " ,decryptTime= " + decryptTime, encrptTime == 0 && decryptTime == 0);
}

private void validateMulticastOpsBeforeRegionOps() {
int writes = getGemfireCache().getDistributionManager().getStats().getMcastWrites();
int reads = getGemfireCache().getDistributionManager().getStats().getMcastReads();
int total = writes + reads;
long writes = getGemfireCache().getDistributionManager().getStats().getMcastWrites();
long reads = getGemfireCache().getDistributionManager().getStats().getMcastReads();
long total = writes + reads;
assertTrue("Should not have any multicast writes or reads before region ops. Writes= " + writes
+ " ,read= " + reads, total == 0);
}
Expand Down
Expand Up @@ -29,7 +29,7 @@ protected void addDSProps(Properties p) {
@Override
protected void validateUDPEncryptionStats() {
long encrptTime =
getGemfireCache().getDistributionManager().getStats().getUDPMsgEncryptionTiime();
getGemfireCache().getDistributionManager().getStats().getUDPMsgEncryptionTime();
long decryptTime =
getGemfireCache().getDistributionManager().getStats().getUDPMsgDecryptionTime();
assertTrue("Should have multicast writes or reads. encrptTime= " + encrptTime
Expand Down
Expand Up @@ -74,7 +74,7 @@ public void testQueueWhenRoleMissing() throws Exception {
factory.setScope(DISTRIBUTED_ACK);
DistributedRegion r = (DistributedRegion) createRootRegion(factory.create());
final CachePerfStats stats = r.getCachePerfStats();
int queuedOps = stats.getReliableQueuedOps();
long queuedOps = stats.getReliableQueuedOps();
r.create("createKey", "createValue", "createCBArg");
r.invalidate("createKey", "invalidateCBArg");
r.put("createKey", "putValue", "putCBArg");
Expand Down
Expand Up @@ -604,7 +604,7 @@ public void run2() throws CacheException {
// updates to a non-conflating are not.
LogWriterUtils.getLogWriter().info("[testConflationSequence] conflate & no-conflate regions");
forceQueuing(r);
final int initialAsyncSocketWrites = stats.getAsyncSocketWrites();
final long initialAsyncSocketWrites = stats.getAsyncSocketWrites();

value = "count=" + count;
lastValue = value;
Expand Down Expand Up @@ -1228,7 +1228,7 @@ private void doTestDisconnectCleanup() throws Exception {
// set others before vm0 connects
final Set others = dm.getOtherDistributionManagerIds();
long initialQueuedMsgs = stats.getAsyncQueuedMsgs();
final int initialQueues = stats.getAsyncQueues();
final long initialQueues = stats.getAsyncQueues();

// create receiver in vm0 with queuing enabled
final Properties p = new Properties();
Expand Down
Expand Up @@ -2376,11 +2376,11 @@ public void run() {
CachePerfStats stats = lr.getRegionPerfStats();

// we saved GII completed count in RegionPerfStats only
int size = stats.getGetInitialImageKeysReceived();
long size = stats.getGetInitialImageKeysReceived();
cache.getLogger().info("Delta contains: " + size + " keys");
assertEquals(expectedKeyNum, size);

int num = stats.getDeltaGetInitialImagesCompleted();
long num = stats.getDeltaGetInitialImagesCompleted();
cache.getLogger().info("Delta GII completed: " + num + " times");
assertEquals(expectedDeltaGIINum, num);
}
Expand Down
Expand Up @@ -249,9 +249,9 @@ public void testSimpleOps() throws CacheException {
cmtre.setUserAttribute("uaValue1");
assertEquals("uaValue1", cmtre.getUserAttribute());

int txRollbackChanges = stats.getTxRollbackChanges();
int txCommitChanges = stats.getTxCommitChanges();
int txFailureChanges = stats.getTxFailureChanges();
long txRollbackChanges = stats.getTxRollbackChanges();
long txCommitChanges = stats.getTxCommitChanges();
long txFailureChanges = stats.getTxFailureChanges();
this.txMgr.begin();
Region.Entry txre = this.region.getEntry("uaKey");
assertEquals(this.region, txre.getRegion());
Expand Down Expand Up @@ -301,9 +301,9 @@ public void testSimpleOps() throws CacheException {
}

{
int txRollbackChanges = stats.getTxRollbackChanges();
int txCommitChanges = stats.getTxCommitChanges();
int txFailureChanges = stats.getTxFailureChanges();
long txRollbackChanges = stats.getTxRollbackChanges();
long txCommitChanges = stats.getTxCommitChanges();
long txFailureChanges = stats.getTxFailureChanges();
this.region.create("key1", "value1");
this.txMgr.begin();
this.region.invalidate("key1");
Expand Down Expand Up @@ -434,7 +434,7 @@ public void testWriteOps() throws CacheException {
@Test
public void testTwoRegionTxs() throws CacheException {
final CachePerfStats stats = this.cache.getCachePerfStats();
int txCommitChanges;
long txCommitChanges;
TransactionId myTxId;

AttributesFactory<String, String> attributesFactory = new AttributesFactory<>();
Expand Down Expand Up @@ -2741,7 +2741,7 @@ public int getBeforeDestroyCalls(boolean fetchLocal) {
}

private void doNonTxInvalidateRegionOp(CachePerfStats stats) throws Exception {
int txRollbackChanges = stats.getTxRollbackChanges();
long txRollbackChanges = stats.getTxRollbackChanges();
this.region.create("key1", "value1");
this.region.create("key2", "value2");
this.txMgr.begin();
Expand Down Expand Up @@ -2773,7 +2773,7 @@ private void doNonTxInvalidateRegionOp(CachePerfStats stats) throws Exception {
}

private void doNonTxDestroyRegionOp(CachePerfStats stats) throws Exception {
int txRollbackChanges = stats.getTxRollbackChanges();
long txRollbackChanges = stats.getTxRollbackChanges();
this.region.put("key1", "value1");
this.region.put("key2", "value2");
this.txMgr.begin();
Expand Down Expand Up @@ -4629,17 +4629,17 @@ class statsValidator {
private long txSuccessLifeTime;
private long txFailedLifeTime;
private long txRollbackLifeTime;
private int txCommits;
private int txFailures;
private int txRollbacks;
private long txCommits;
private long txFailures;
private long txRollbacks;
private long txCommitTime;
private long txFailureTime;
private long txRollbackTime;
private int txCommitChanges;
private int txFailureChanges;
private int txRollbackChanges;
private long txCommitChanges;
private long txFailureChanges;
private long txRollbackChanges;

private CachePerfStats stats;
private final CachePerfStats stats;

private statsValidator(CachePerfStats stats) {
this.stats = stats;
Expand Down Expand Up @@ -4672,15 +4672,15 @@ private void setTxRollbackLifeTime(long txRollbackLifeTime) {
this.txRollbackLifeTime = txRollbackLifeTime;
}

private void setTxCommits(int txCommits) {
private void setTxCommits(long txCommits) {
this.txCommits = txCommits;
}

private void setTxFailures(int txFailures) {
private void setTxFailures(long txFailures) {
this.txFailures = txFailures;
}

private void setTxRollbacks(int txRollbacks) {
private void setTxRollbacks(long txRollbacks) {
this.txRollbacks = txRollbacks;
}

Expand All @@ -4696,15 +4696,15 @@ private void setTxRollbackTime(long txRollbackTime) {
this.txRollbackTime = txRollbackTime;
}

private void setTxCommitChanges(int txCommitChanges) {
private void setTxCommitChanges(long txCommitChanges) {
this.txCommitChanges = txCommitChanges;
}

private void setTxFailureChanges(int txFailureChanges) {
private void setTxFailureChanges(long txFailureChanges) {
this.txFailureChanges = txFailureChanges;
}

private void setTxRollbackChanges(int txRollbackChanges) {
private void setTxRollbackChanges(long txRollbackChanges) {
this.txRollbackChanges = txRollbackChanges;
}

Expand Down Expand Up @@ -5780,7 +5780,7 @@ public void afterRollback(TransactionEvent event) {

{ // distributed invalidate
// first make sure invalidate is counted as a change
int txRollbackChanges = stats.getTxRollbackChanges();
long txRollbackChanges = stats.getTxRollbackChanges();
this.region.create("key1", "value1");
this.txMgr.begin();
this.region.invalidate("key1");
Expand Down Expand Up @@ -5839,7 +5839,7 @@ public void afterRollback(TransactionEvent event) {

{ // local invalidate
// first make sure invalidate is counted as a change
int txRollbackChanges = stats.getTxRollbackChanges();
long txRollbackChanges = stats.getTxRollbackChanges();
this.region.create("key1", "value1");
this.txMgr.begin();
this.region.localInvalidate("key1");
Expand Down
Expand Up @@ -68,7 +68,7 @@ protected AbstractHealthEvaluator(GemFireHealthConfig config, DistributionManage
* @param status A list of {@link AbstractHealthEvaluator.HealthStatus HealthStatus} objects that
* is populated when ill health is detected.
*/
public void evaluate(List status) {
public void evaluate(List<HealthStatus> status) {
this.numEvaluations++;
check(status);
}
Expand All @@ -78,7 +78,7 @@ public void evaluate(List status) {
*
* @see #evaluate
*/
protected abstract void check(List status);
protected abstract void check(List<HealthStatus> status);

/**
* Returns whether or not this is the first evaluation
Expand Down
Expand Up @@ -90,7 +90,7 @@ protected String getDescription() {
* than the {@linkplain MemberHealthConfig#getMaxVMProcessSize threshold}. If not, the status is
* "okay" health.
*/
void checkVMProcessSize(List status) {
void checkVMProcessSize(List<HealthStatus> status) {
// There is no need to check isFirstEvaluation()
if (this.processStats == null) {
return;
Expand All @@ -112,7 +112,7 @@ void checkVMProcessSize(List status) {
* {@linkplain MemberHealthConfig#getMaxMessageQueueSize threshold}. If not, the status is "okay"
* health.
*/
private void checkMessageQueueSize(List status) {
private void checkMessageQueueSize(List<HealthStatus> status) {
long threshold = this.config.getMaxMessageQueueSize();
long overflowSize = this.dmStats.getOverflowQueueSize();
if (overflowSize > threshold) {
Expand All @@ -128,7 +128,7 @@ private void checkMessageQueueSize(List status) {
* does not exceed the {@linkplain MemberHealthConfig#getMaxReplyTimeouts threshold}. If not, the
* status is "okay" health.
*/
private void checkReplyTimeouts(List status) {
private void checkReplyTimeouts(List<HealthStatus> status) {
if (isFirstEvaluation()) {
return;
}
Expand All @@ -147,7 +147,7 @@ private void checkReplyTimeouts(List status) {
* The function keeps updating the health of the cache based on roles required by the regions and
* their reliability policies.
*/
private void checkCacheRequiredRolesMeet(List status) {
private void checkCacheRequiredRolesMeet(List<HealthStatus> status) {
// will have to call here okayHealth() or poorHealth()

try {
Expand All @@ -156,21 +156,21 @@ private void checkCacheRequiredRolesMeet(List status) {

if (cPStats.getReliableRegionsMissingFullAccess() > 0) {
// health is okay.
int numRegions = cPStats.getReliableRegionsMissingFullAccess();
long numRegions = cPStats.getReliableRegionsMissingFullAccess();
status.add(okayHealth(
String.format(
"There are %s regions missing required roles; however, they are configured for full access.",
numRegions)));
} else if (cPStats.getReliableRegionsMissingLimitedAccess() > 0) {
// health is poor
int numRegions = cPStats.getReliableRegionsMissingLimitedAccess();
long numRegions = cPStats.getReliableRegionsMissingLimitedAccess();
status.add(poorHealth(
String.format(
"There are %s regions missing required roles and configured with limited access.",
numRegions)));
} else if (cPStats.getReliableRegionsMissingNoAccess() > 0) {
// health is poor
int numRegions = cPStats.getReliableRegionsMissingNoAccess();
long numRegions = cPStats.getReliableRegionsMissingNoAccess();
status.add(poorHealth(
String.format(
"There are %s regions missing required roles and configured without access.",
Expand All @@ -188,7 +188,7 @@ private void updatePrevious() {
}

@Override
protected void check(List status) {
protected void check(List<HealthStatus> status) {
checkVMProcessSize(status);
checkMessageQueueSize(status);
checkReplyTimeouts(status);
Expand Down