hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-12478 HBASE-10141 and MIN_VERSIONS are not compatible
Date Sat, 15 Nov 2014 00:39:32 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 4b9a472c3 -> 835490e3b


HBASE-12478 HBASE-10141 and MIN_VERSIONS are not compatible


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/835490e3
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/835490e3
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/835490e3

Branch: refs/heads/0.98
Commit: 835490e3b25c0d9923867461c173a123d06edd0c
Parents: 4b9a472
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Nov 14 16:39:21 2014 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Nov 14 16:39:21 2014 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HStore.java       |  5 ++++
 .../hadoop/hbase/regionserver/TestStore.java    | 25 ++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/835490e3/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 c6b62d4..39a0677 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
@@ -1463,6 +1463,11 @@ public class HStore implements Store {
 
   private void removeUnneededFiles() throws IOException {
     if (!conf.getBoolean("hbase.store.delete.expired.storefile", true)) return;
+    if (getFamily().getMinVersions() > 0) {
+      LOG.debug("Skipping expired store file removal due to min version being " +
+          getFamily().getMinVersions());
+      return;
+    }
     this.lock.readLock().lock();
     Collection<StoreFile> delSfs = null;
     try {

http://git-wip-us.apache.org/repos/asf/hbase/blob/835490e3/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
index 9efd887..b796f70 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStore.java
@@ -268,6 +268,14 @@ public class TestStore {
 
   @Test
   public void testDeleteExpiredStoreFiles() throws Exception {
+    testDeleteExpiredStoreFiles(0);
+    testDeleteExpiredStoreFiles(1);
+  }
+
+  /*
+   * @param minVersions the MIN_VERSIONS for the column family
+   */
+  public void testDeleteExpiredStoreFiles(int minVersions) throws Exception {
     int storeFileNum = 4;
     int ttl = 4;
     IncrementingEnvironmentEdge edge = new IncrementingEnvironmentEdge();
@@ -280,6 +288,7 @@ public class TestStore {
     conf.setInt(CompactionConfiguration.MIN_KEY, 5);
 
     HColumnDescriptor hcd = new HColumnDescriptor(family);
+    hcd.setMinVersions(minVersions);
     hcd.setTimeToLive(ttl);
     init(name.getMethodName(), conf, hcd);
 
@@ -308,10 +317,14 @@ public class TestStore {
       Assert.assertNull(this.store.requestCompaction());
       Collection<StoreFile> sfs = this.store.getStorefiles();
       // Ensure i files are gone.
-      Assert.assertEquals(storeFileNum - i, sfs.size());
-      // Ensure only non-expired files remain.
-      for (StoreFile sf : sfs) {
-        Assert.assertTrue(sf.getReader().getMaxTimestamp() >= (edge.currentTimeMillis()
- storeTtl));
+      if (minVersions == 0) {
+        Assert.assertEquals(storeFileNum - i, sfs.size());
+        // Ensure only non-expired files remain.
+        for (StoreFile sf : sfs) {
+          Assert.assertTrue(sf.getReader().getMaxTimestamp() >= (edge.currentTimeMillis()
- storeTtl));
+        }
+      } else {
+        Assert.assertEquals(storeFileNum, sfs.size());
       }
       // Let the next store file expired.
       edge.incrementTime(sleepTime);
@@ -319,7 +332,9 @@ public class TestStore {
     Assert.assertNull(this.store.requestCompaction());
     Collection<StoreFile> sfs = this.store.getStorefiles();
     // Assert the last expired file is not removed.
-    Assert.assertEquals(1, sfs.size());
+    if (minVersions == 0) {
+      Assert.assertEquals(1, sfs.size());
+    }
     long ts = sfs.iterator().next().getReader().getMaxTimestamp();
     Assert.assertTrue(ts < (edge.currentTimeMillis() - storeTtl));
   }


Mime
View raw message