You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by la...@apache.org on 2017/04/12 18:21:50 UTC
geode git commit: GEODE-2745: waitUntilFlushed method waits longer
than it should
Repository: geode
Updated Branches:
refs/heads/develop bd40bcac7 -> f13da788c
GEODE-2745: waitUntilFlushed method waits longer than it should
- Added getter in BucketRegionQueue for latestQueuedKey
- WaitUntilBucketRegionQueueFlushedCallable constructor now gets/maintains the BucketRegionQueue.latestQueuedKey
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/f13da788
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f13da788
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f13da788
Branch: refs/heads/develop
Commit: f13da788c8b2d2315581c451154f8e5410b764bc
Parents: bd40bca
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
Authored: Fri Apr 7 11:57:16 2017 -0700
Committer: Lynn Hughes-Godfrey <lh...@pivotal.io>
Committed: Wed Apr 12 11:20:24 2017 -0700
----------------------------------------------------------------------
.../geode/internal/cache/BucketRegionQueue.java | 14 +++++++++-----
...tUntilParallelGatewaySenderFlushedCoordinator.java | 5 ++++-
2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/f13da788/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
index 3259752..7a21d12 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
@@ -464,21 +464,25 @@ public class BucketRegionQueue extends AbstractBucketRegionQueue {
this.latestAcknowledgedKey.set(key);
}
- public boolean waitUntilFlushed(long timeout, TimeUnit unit) throws InterruptedException {
+ public long getLatestQueuedKey() {
+ return this.latestQueuedKey.get();
+ }
+
+ public boolean waitUntilFlushed(long latestQueuedKey, long timeout, TimeUnit unit)
+ throws InterruptedException {
long then = System.currentTimeMillis();
if (logger.isDebugEnabled()) {
- logger.debug("BucketRegionQueue: waitUntilFlushed bucket=" + getId() + "; timeout=" + timeout
- + "; unit=" + unit);
+ logger.debug("BucketRegionQueue: waitUntilFlushed bucket=" + getId() + "; latestQueuedKey="
+ + latestQueuedKey + "; timeout=" + timeout + "; unit=" + unit);
}
boolean result = false;
// Wait until latestAcknowledgedKey > latestQueuedKey or the queue is empty
if (this.initialized) {
- long latestQueuedKeyToCheck = this.latestQueuedKey.get();
long nanosRemaining = unit.toNanos(timeout);
long endTime = System.nanoTime() + nanosRemaining;
while (nanosRemaining > 0) {
try {
- if (latestAcknowledgedKey.get() > latestQueuedKeyToCheck || isEmpty()) {
+ if (latestAcknowledgedKey.get() > latestQueuedKey || isEmpty()) {
result = true;
break;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/f13da788/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
index c5945a6..1388dd0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java
@@ -100,6 +100,8 @@ public class WaitUntilParallelGatewaySenderFlushedCoordinator
private BucketRegionQueue brq;
+ private long latestQueuedKey;
+
private long timeout;
private TimeUnit unit;
@@ -107,13 +109,14 @@ public class WaitUntilParallelGatewaySenderFlushedCoordinator
public WaitUntilBucketRegionQueueFlushedCallable(BucketRegionQueue brq, long timeout,
TimeUnit unit) {
this.brq = brq;
+ this.latestQueuedKey = brq.getLatestQueuedKey();
this.timeout = timeout;
this.unit = unit;
}
@Override
public Boolean call() throws Exception {
- return this.brq.waitUntilFlushed(this.timeout, this.unit);
+ return this.brq.waitUntilFlushed(this.latestQueuedKey, this.timeout, this.unit);
}
@Override