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:37:05 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 97b38fbdb -> 9583d1474


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/9583d147
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9583d147
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9583d147

Branch: refs/heads/master
Commit: 9583d14747683838ba1dc3b0c39edc80b0ca2b54
Parents: 97b38fb
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Nov 14 16:36:56 2014 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Nov 14 16:36:56 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/9583d147/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 8b41401..85b7676 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
@@ -1517,6 +1517,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/9583d147/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 39b41dd..be99f37 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
@@ -280,6 +280,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();
@@ -292,6 +300,7 @@ public class TestStore {
     conf.setInt(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MIN_KEY, 5);
 
     HColumnDescriptor hcd = new HColumnDescriptor(family);
+    hcd.setMinVersions(minVersions);
     hcd.setTimeToLive(ttl);
     init(name.getMethodName(), conf, hcd);
 
@@ -320,10 +329,14 @@ public class TestStore {
       assertNull(this.store.requestCompaction());
       Collection<StoreFile> sfs = this.store.getStorefiles();
       // Ensure i files are gone.
-      assertEquals(storeFileNum - i, sfs.size());
-      // Ensure only non-expired files remain.
-      for (StoreFile sf : sfs) {
-        assertTrue(sf.getReader().getMaxTimestamp() >= (edge.currentTime() - storeTtl));
+      if (minVersions == 0) {
+        assertEquals(storeFileNum - i, sfs.size());
+        // Ensure only non-expired files remain.
+        for (StoreFile sf : sfs) {
+          assertTrue(sf.getReader().getMaxTimestamp() >= (edge.currentTime() - storeTtl));
+        }
+      } else {
+        assertEquals(storeFileNum, sfs.size());
       }
       // Let the next store file expired.
       edge.incrementTime(sleepTime);
@@ -331,7 +344,9 @@ public class TestStore {
     assertNull(this.store.requestCompaction());
     Collection<StoreFile> sfs = this.store.getStorefiles();
     // Assert the last expired file is not removed.
-    assertEquals(1, sfs.size());
+    if (minVersions == 0) {
+      assertEquals(1, sfs.size());
+    }
     long ts = sfs.iterator().next().getReader().getMaxTimestamp();
     assertTrue(ts < (edge.currentTime() - storeTtl));
   }


Mime
View raw message