You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2014/12/10 02:29:08 UTC
[1/3] hbase git commit: HBASE-12454 Setting didPerformCompaction
early in HRegion#compact
Repository: hbase
Updated Branches:
refs/heads/0.98 b9e6595ad -> 06c4d8a8e
refs/heads/branch-1 4a1d56a4a -> 7ebeb89c3
refs/heads/master cc8bdcb49 -> 011442edd
HBASE-12454 Setting didPerformCompaction early in HRegion#compact
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/011442ed
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/011442ed
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/011442ed
Branch: refs/heads/master
Commit: 011442edda6218d9efc024e004b4f62880e8b932
Parents: cc8bdcb
Author: Andrew Purtell <ap...@apache.org>
Authored: Tue Dec 9 17:06:04 2014 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Dec 9 17:06:04 2014 -0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HRegion.java | 8 ++--
.../hadoop/hbase/regionserver/HStore.java | 43 +++++++++++---------
2 files changed, 29 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/011442ed/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index ee9634c..3df09df 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -1550,7 +1550,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
return false;
}
MonitoredTask status = null;
- boolean didPerformCompaction = false;
+ boolean requestNeedsCancellation = true;
// block waiting for the lock for compaction
lock.readLock().lock();
try {
@@ -1587,7 +1587,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
doRegionCompactionPrep();
try {
status.setStatus("Compacting store " + store);
- didPerformCompaction = true;
+ // We no longer need to cancel the request on the way out of this
+ // method because Store#compact will clean up unconditionally
+ requestNeedsCancellation = false;
store.compact(compaction);
} catch (InterruptedIOException iioe) {
String msg = "compaction interrupted";
@@ -1609,7 +1611,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
return true;
} finally {
try {
- if (!didPerformCompaction) store.cancelRequestedCompaction(compaction);
+ if (requestNeedsCancellation) store.cancelRequestedCompaction(compaction);
if (status != null) status.cleanup();
} finally {
lock.readLock().unlock();
http://git-wip-us.apache.org/repos/asf/hbase/blob/011442ed/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index 98b79fa..b674fea 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -1134,25 +1134,29 @@ public class HStore implements Store {
*/
@Override
public List<StoreFile> compact(CompactionContext compaction) throws IOException {
- assert compaction != null && compaction.hasSelection();
- CompactionRequest cr = compaction.getRequest();
- Collection<StoreFile> filesToCompact = cr.getFiles();
- assert !filesToCompact.isEmpty();
- synchronized (filesCompacting) {
- // sanity check: we're compacting files that this store knows about
- // TODO: change this to LOG.error() after more debugging
- Preconditions.checkArgument(filesCompacting.containsAll(filesToCompact));
- }
-
- // Ready to go. Have list of files to compact.
- LOG.info("Starting compaction of " + filesToCompact.size() + " file(s) in "
- + this + " of " + this.getRegionInfo().getRegionNameAsString()
- + " into tmpdir=" + fs.getTempDir() + ", totalSize="
- + StringUtils.humanReadableInt(cr.getSize()));
-
- long compactionStartTime = EnvironmentEdgeManager.currentTime();
+ assert compaction != null;
List<StoreFile> sfs = null;
+ CompactionRequest cr = compaction.getRequest();;
try {
+ // Do all sanity checking in here if we have a valid CompactionRequest
+ // because we need to clean up after it on the way out in a finally
+ // block below
+ long compactionStartTime = EnvironmentEdgeManager.currentTime();
+ assert compaction.hasSelection();
+ Collection<StoreFile> filesToCompact = cr.getFiles();
+ assert !filesToCompact.isEmpty();
+ synchronized (filesCompacting) {
+ // sanity check: we're compacting files that this store knows about
+ // TODO: change this to LOG.error() after more debugging
+ Preconditions.checkArgument(filesCompacting.containsAll(filesToCompact));
+ }
+
+ // Ready to go. Have list of files to compact.
+ LOG.info("Starting compaction of " + filesToCompact.size() + " file(s) in "
+ + this + " of " + this.getRegionInfo().getRegionNameAsString()
+ + " into tmpdir=" + fs.getTempDir() + ", totalSize="
+ + StringUtils.humanReadableInt(cr.getSize()));
+
// Commence the compaction.
List<Path> newFiles = compaction.compact();
@@ -1181,11 +1185,12 @@ public class HStore implements Store {
}
// At this point the store will use new files for all new scanners.
completeCompaction(filesToCompact, true); // Archive old files & update store size.
+
+ logCompactionEndMessage(cr, sfs, compactionStartTime);
+ return sfs;
} finally {
finishCompactionRequest(cr);
}
- logCompactionEndMessage(cr, sfs, compactionStartTime);
- return sfs;
}
private List<StoreFile> moveCompatedFilesIntoPlace(
[2/3] hbase git commit: HBASE-12454 Setting didPerformCompaction
early in HRegion#compact
Posted by ap...@apache.org.
HBASE-12454 Setting didPerformCompaction early in HRegion#compact
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7ebeb89c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7ebeb89c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7ebeb89c
Branch: refs/heads/branch-1
Commit: 7ebeb89c392214ca8527587d40783ab51dbb7331
Parents: 4a1d56a
Author: Andrew Purtell <ap...@apache.org>
Authored: Tue Dec 9 17:06:04 2014 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Dec 9 17:07:28 2014 -0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HRegion.java | 8 ++--
.../hadoop/hbase/regionserver/HStore.java | 43 +++++++++++---------
2 files changed, 29 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/7ebeb89c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 4989bd5..54cea5a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -1545,7 +1545,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
return false;
}
MonitoredTask status = null;
- boolean didPerformCompaction = false;
+ boolean requestNeedsCancellation = true;
// block waiting for the lock for compaction
lock.readLock().lock();
try {
@@ -1582,7 +1582,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
doRegionCompactionPrep();
try {
status.setStatus("Compacting store " + store);
- didPerformCompaction = true;
+ // We no longer need to cancel the request on the way out of this
+ // method because Store#compact will clean up unconditionally
+ requestNeedsCancellation = false;
store.compact(compaction);
} catch (InterruptedIOException iioe) {
String msg = "compaction interrupted";
@@ -1604,7 +1606,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
return true;
} finally {
try {
- if (!didPerformCompaction) store.cancelRequestedCompaction(compaction);
+ if (requestNeedsCancellation) store.cancelRequestedCompaction(compaction);
if (status != null) status.cleanup();
} finally {
lock.readLock().unlock();
http://git-wip-us.apache.org/repos/asf/hbase/blob/7ebeb89c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index b3385d2..ad701b7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -1134,25 +1134,29 @@ public class HStore implements Store {
*/
@Override
public List<StoreFile> compact(CompactionContext compaction) throws IOException {
- assert compaction != null && compaction.hasSelection();
- CompactionRequest cr = compaction.getRequest();
- Collection<StoreFile> filesToCompact = cr.getFiles();
- assert !filesToCompact.isEmpty();
- synchronized (filesCompacting) {
- // sanity check: we're compacting files that this store knows about
- // TODO: change this to LOG.error() after more debugging
- Preconditions.checkArgument(filesCompacting.containsAll(filesToCompact));
- }
-
- // Ready to go. Have list of files to compact.
- LOG.info("Starting compaction of " + filesToCompact.size() + " file(s) in "
- + this + " of " + this.getRegionInfo().getRegionNameAsString()
- + " into tmpdir=" + fs.getTempDir() + ", totalSize="
- + StringUtils.humanReadableInt(cr.getSize()));
-
- long compactionStartTime = EnvironmentEdgeManager.currentTime();
+ assert compaction != null;
List<StoreFile> sfs = null;
+ CompactionRequest cr = compaction.getRequest();;
try {
+ // Do all sanity checking in here if we have a valid CompactionRequest
+ // because we need to clean up after it on the way out in a finally
+ // block below
+ long compactionStartTime = EnvironmentEdgeManager.currentTime();
+ assert compaction.hasSelection();
+ Collection<StoreFile> filesToCompact = cr.getFiles();
+ assert !filesToCompact.isEmpty();
+ synchronized (filesCompacting) {
+ // sanity check: we're compacting files that this store knows about
+ // TODO: change this to LOG.error() after more debugging
+ Preconditions.checkArgument(filesCompacting.containsAll(filesToCompact));
+ }
+
+ // Ready to go. Have list of files to compact.
+ LOG.info("Starting compaction of " + filesToCompact.size() + " file(s) in "
+ + this + " of " + this.getRegionInfo().getRegionNameAsString()
+ + " into tmpdir=" + fs.getTempDir() + ", totalSize="
+ + StringUtils.humanReadableInt(cr.getSize()));
+
// Commence the compaction.
List<Path> newFiles = compaction.compact();
@@ -1181,11 +1185,12 @@ public class HStore implements Store {
}
// At this point the store will use new files for all new scanners.
completeCompaction(filesToCompact, true); // Archive old files & update store size.
+
+ logCompactionEndMessage(cr, sfs, compactionStartTime);
+ return sfs;
} finally {
finishCompactionRequest(cr);
}
- logCompactionEndMessage(cr, sfs, compactionStartTime);
- return sfs;
}
private List<StoreFile> moveCompatedFilesIntoPlace(
[3/3] hbase git commit: HBASE-12454 Setting didPerformCompaction
early in HRegion#compact
Posted by ap...@apache.org.
HBASE-12454 Setting didPerformCompaction early in HRegion#compact
Conflicts:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/06c4d8a8
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/06c4d8a8
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/06c4d8a8
Branch: refs/heads/0.98
Commit: 06c4d8a8e14db8f01cce7d6e1f027df3e8f30a92
Parents: b9e6595
Author: Andrew Purtell <ap...@apache.org>
Authored: Tue Dec 9 17:06:04 2014 -0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Dec 9 17:10:30 2014 -0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HRegion.java | 8 ++--
.../hadoop/hbase/regionserver/HStore.java | 43 +++++++++++---------
2 files changed, 29 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/06c4d8a8/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 76198bc..75e26e1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -1463,7 +1463,7 @@ public class HRegion implements HeapSize { // , Writable{
return false;
}
MonitoredTask status = null;
- boolean didPerformCompaction = false;
+ boolean requestNeedsCancellation = true;
// block waiting for the lock for compaction
lock.readLock().lock();
try {
@@ -1500,7 +1500,9 @@ public class HRegion implements HeapSize { // , Writable{
doRegionCompactionPrep();
try {
status.setStatus("Compacting store " + store);
- didPerformCompaction = true;
+ // We no longer need to cancel the request on the way out of this
+ // method because Store#compact will clean up unconditionally
+ requestNeedsCancellation = false;
store.compact(compaction);
} catch (InterruptedIOException iioe) {
String msg = "compaction interrupted";
@@ -1522,7 +1524,7 @@ public class HRegion implements HeapSize { // , Writable{
return true;
} finally {
try {
- if (!didPerformCompaction) store.cancelRequestedCompaction(compaction);
+ if (requestNeedsCancellation) store.cancelRequestedCompaction(compaction);
if (status != null) status.cleanup();
} finally {
lock.readLock().unlock();
http://git-wip-us.apache.org/repos/asf/hbase/blob/06c4d8a8/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index 5ea1a9c..79942d4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -1079,25 +1079,29 @@ public class HStore implements Store {
*/
@Override
public List<StoreFile> compact(CompactionContext compaction) throws IOException {
- assert compaction != null && compaction.hasSelection();
- CompactionRequest cr = compaction.getRequest();
- Collection<StoreFile> filesToCompact = cr.getFiles();
- assert !filesToCompact.isEmpty();
- synchronized (filesCompacting) {
- // sanity check: we're compacting files that this store knows about
- // TODO: change this to LOG.error() after more debugging
- Preconditions.checkArgument(filesCompacting.containsAll(filesToCompact));
- }
-
- // Ready to go. Have list of files to compact.
- LOG.info("Starting compaction of " + filesToCompact.size() + " file(s) in "
- + this + " of " + this.getRegionInfo().getRegionNameAsString()
- + " into tmpdir=" + fs.getTempDir() + ", totalSize="
- + StringUtils.humanReadableInt(cr.getSize()));
-
- long compactionStartTime = EnvironmentEdgeManager.currentTimeMillis();
+ assert compaction != null;
List<StoreFile> sfs = null;
+ CompactionRequest cr = compaction.getRequest();;
try {
+ // Do all sanity checking in here if we have a valid CompactionRequest
+ // because we need to clean up after it on the way out in a finally
+ // block below
+ long compactionStartTime = EnvironmentEdgeManager.currentTimeMillis();
+ assert compaction.hasSelection();
+ Collection<StoreFile> filesToCompact = cr.getFiles();
+ assert !filesToCompact.isEmpty();
+ synchronized (filesCompacting) {
+ // sanity check: we're compacting files that this store knows about
+ // TODO: change this to LOG.error() after more debugging
+ Preconditions.checkArgument(filesCompacting.containsAll(filesToCompact));
+ }
+
+ // Ready to go. Have list of files to compact.
+ LOG.info("Starting compaction of " + filesToCompact.size() + " file(s) in "
+ + this + " of " + this.getRegionInfo().getRegionNameAsString()
+ + " into tmpdir=" + fs.getTempDir() + ", totalSize="
+ + StringUtils.humanReadableInt(cr.getSize()));
+
// Commence the compaction.
List<Path> newFiles = compaction.compact();
@@ -1126,11 +1130,12 @@ public class HStore implements Store {
}
// At this point the store will use new files for all new scanners.
completeCompaction(filesToCompact); // Archive old files & update store size.
+
+ logCompactionEndMessage(cr, sfs, compactionStartTime);
+ return sfs;
} finally {
finishCompactionRequest(cr);
}
- logCompactionEndMessage(cr, sfs, compactionStartTime);
- return sfs;
}
private List<StoreFile> moveCompatedFilesIntoPlace(