Skip to content

Commit

Permalink
GEODE-6845: Consistent logging when incrementing putInProgress (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmellawatt authored Jun 7, 2019
1 parent 5e9f8cc commit 13b235e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void verifyEndGiiQueueingEmptiesQueueAndHAContainer() throws Exception {
new ClientProxyMembershipID(), new EventID(cache.getDistributedSystem()));
HAEventWrapper wrapper = new HAEventWrapper(message);
wrapper.setHAContainer(haContainerWrapper);
wrapper.incrementPutInProgressCounter();
wrapper.incrementPutInProgressCounter("test");

// Create and update HARegionQueues forcing one queue to startGiiQueueing
int numQueues = 10;
Expand Down Expand Up @@ -379,7 +379,7 @@ public void queueRemovalAndDispatchingConcurrently() throws Exception {

HAEventWrapper wrapper = new HAEventWrapper(message);
wrapper.setHAContainer(haContainerWrapper);
wrapper.incrementPutInProgressCounter();
wrapper.incrementPutInProgressCounter("test");

for (HARegionQueue queue : regionQueues) {
queue.put(wrapper);
Expand Down Expand Up @@ -432,7 +432,7 @@ public void verifyPutEntryConditionallyInHAContainerNoOverwrite() throws Excepti
(LocalRegion) dataRegion, "key", "value".getBytes(), (byte) 0x01, null,
new ClientProxyMembershipID(), eventID);
HAEventWrapper originalWrapperInstance = new HAEventWrapper(oldMessage);
originalWrapperInstance.incrementPutInProgressCounter();
originalWrapperInstance.incrementPutInProgressCounter("test");
originalWrapperInstance.setHAContainer(haContainerWrapper);

HARegionQueue haRegionQueue = createHARegionQueue(haContainerWrapper, 0);
Expand All @@ -447,7 +447,7 @@ public void verifyPutEntryConditionallyInHAContainerNoOverwrite() throws Excepti
(LocalRegion) dataRegion, "key", "value".getBytes(), (byte) 0x01, null,
new ClientProxyMembershipID(), eventID);
HAEventWrapper newWrapperInstance = new HAEventWrapper(newMessage);
newWrapperInstance.incrementPutInProgressCounter();
newWrapperInstance.incrementPutInProgressCounter("test");
newWrapperInstance.setHAContainer(haContainerWrapper);

haRegionQueue.putEventInHARegion(newWrapperInstance, 1L);
Expand Down Expand Up @@ -478,7 +478,7 @@ public void removeDispatchedEventsViaQRMAndDestroyQueueSimultaneouslySingleDecre
(LocalRegion) dataRegion, "key", "value".getBytes(), (byte) 0x01, null,
new ClientProxyMembershipID(), eventID);
HAEventWrapper haEventWrapper = new HAEventWrapper(clientUpdateMessage);
haEventWrapper.incrementPutInProgressCounter();
haEventWrapper.incrementPutInProgressCounter("test");
haEventWrapper.setHAContainer(haContainerWrapper);

haRegionQueue.put(haEventWrapper);
Expand Down Expand Up @@ -542,7 +542,7 @@ public void removeDispatchedEventsViaMessageDispatcherAndDestroyQueueSimultaneou
(LocalRegion) dataRegion, "key", "value".getBytes(), (byte) 0x01, null,
new ClientProxyMembershipID(), eventID);
HAEventWrapper haEventWrapper = new HAEventWrapper(clientUpdateMessage);
haEventWrapper.incrementPutInProgressCounter();
haEventWrapper.incrementPutInProgressCounter("test");
haEventWrapper.setHAContainer(haContainerWrapper);

haRegionQueue.put(haEventWrapper);
Expand Down Expand Up @@ -782,7 +782,7 @@ private void createAndPutHARegionQueuesSequentially(HAContainerWrapper haContain
queues.add(createHARegionQueue(haContainerWrapper, i));
}

haEventWrapper.incrementPutInProgressCounter();
haEventWrapper.incrementPutInProgressCounter("test");

for (HARegionQueue queue : queues) {
queue.put(haEventWrapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ public void testPutEntryConditionallyIntoHAContainer_AddCQAndInterestList() thro

// Mock that a put is in progress so we don't null out the
// ClientUpdateMessage member on the HAEventWrapper
mockHAEventWrapper.incrementPutInProgressCounter();
mockHAEventWrapper.incrementPutInProgressCounter("test");

// TODO: Why don't we add CQs and Interest when we initially add the
// wrapper to the container?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,7 @@ public boolean put(Object object) throws CacheException, InterruptedException {

if (object instanceof HAEventWrapper) {
HAEventWrapper wrapper = (HAEventWrapper) object;
wrapper.incrementPutInProgressCounter();
if (logger.isDebugEnabled()) {
logger
.debug("Incremented PutInProgressCounter during GII queueing. Event ID hash code: "
+ wrapper.hashCode() + "; System ID hash code: "
+ System.identityHashCode(wrapper)
+ "; Wrapper details: " + wrapper);
}
wrapper.incrementPutInProgressCounter("GII queue");
}

this.giiQueue.add(object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,7 @@ private void singletonNotifyClients(InternalCacheEvent event, ClientUpdateMessag
}
} else {
HAEventWrapper wrapper = new HAEventWrapper(clientMessage);
wrapper.incrementPutInProgressCounter();

if (logger.isDebugEnabled()) {
logger.debug(
"Initial increment PutInProgressCounter on HAEventWrapper with Event ID hash code: {}; System ID hash code: {}; Wrapper details: {}",
+wrapper.hashCode(), System.identityHashCode(wrapper), wrapper);
}

wrapper.incrementPutInProgressCounter("notify clients");
conflatable = wrapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void add(final InternalCacheEvent event,
// event is drained and processed. See incrementPutInProgressCounter() and
// decrementPutInProgressCounter() for more details.
if (conflatable instanceof HAEventWrapper) {
((HAEventWrapper) conflatable).incrementPutInProgressCounter();
((HAEventWrapper) conflatable).incrementPutInProgressCounter("client registration");
}

// After taking out the lock, we need to determine if the client is still actually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,16 @@ public long decAndGetReferenceCount() {
return rcUpdater.decrementAndGet(this);
}

public long incrementPutInProgressCounter() {
return putInProgressCountUpdater.incrementAndGet(this);
public long incrementPutInProgressCounter(String location) {
long putInProgressCounter = putInProgressCountUpdater.incrementAndGet(this);

if (logger.isDebugEnabled()) {
logger.debug("Incremented PutInProgressCounter from " + location
+ " on HAEventWrapper with Event ID hash code: " + hashCode() + "; System ID hash code: "
+ System.identityHashCode(this) + "; Wrapper details: " + toString());
}

return putInProgressCounter;
}

public long decrementPutInProgressCounter() {
Expand Down

0 comments on commit 13b235e

Please sign in to comment.