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-16065 hbase backup set describe command does not inform if the set does not exist (Vladimir)
Date Fri, 24 Jun 2016 19:35:04 GMT
Repository: hbase
Updated Branches:
  refs/heads/HBASE-7912 eaa3217f1 -> 7b50cbd2b


HBASE-16065 hbase backup set describe command does not inform if the set does not exist (Vladimir)


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

Branch: refs/heads/HBASE-7912
Commit: 7b50cbd2bba3dcdf4145cd696a545b08ffa49369
Parents: eaa3217
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Jun 24 12:33:05 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Jun 24 12:33:05 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/backup/impl/BackupCommands.java    | 6 +++++-
 .../org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java | 2 +-
 .../java/org/apache/hadoop/hbase/client/HBaseBackupAdmin.java  | 5 ++++-
 .../org/apache/hadoop/hbase/backup/TestBackupSystemTable.java  | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7b50cbd2/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java
index 9a8697a..63f7a55 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupCommands.java
@@ -482,7 +482,11 @@ public final class BackupCommands {
       try(final Connection conn = ConnectionFactory.createConnection(conf); 
           final BackupAdmin admin = conn.getAdmin().getBackupAdmin();){
         BackupSet set = admin.getBackupSet(setName);
-        System.out.println(set);
+        if(set == null) {
+          System.out.println("Set '"+setName+"' does not exist.");
+        } else{
+          System.out.println(set);
+        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/7b50cbd2/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
index 777d916..d6be98c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
@@ -630,7 +630,7 @@ public final class BackupSystemTable implements Closeable {
      table = connection.getTable(tableName);
      Get get = BackupSystemTableHelper.createGetForBackupSet(name);
      Result res = table.get(get);
-     if(res.isEmpty()) return new ArrayList<TableName>();
+     if(res.isEmpty()) return null;
      res.advance();
      String[] tables = 
          BackupSystemTableHelper.cellValueToBackupSet(res.current());

http://git-wip-us.apache.org/repos/asf/hbase/blob/7b50cbd2/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseBackupAdmin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseBackupAdmin.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseBackupAdmin.java
index e86fe97..a6532df 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseBackupAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseBackupAdmin.java
@@ -145,7 +145,9 @@ public class HBaseBackupAdmin implements BackupAdmin {
       List<BackupSet> bslist = new ArrayList<BackupSet>();
       for (String s : list) {
         List<TableName> tables = table.describeBackupSet(s);
-        bslist.add( new BackupSet(s, tables));
+        if(tables != null){
+          bslist.add( new BackupSet(s, tables));
+        }
       }
       return bslist;
     }
@@ -155,6 +157,7 @@ public class HBaseBackupAdmin implements BackupAdmin {
   public BackupSet getBackupSet(String name) throws IOException {
     try (final BackupSystemTable table = new BackupSystemTable(conn)) {
       List<TableName> list = table.describeBackupSet(name);
+      if(list == null) return null;
       return new BackupSet(name, list);
     }  
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/7b50cbd2/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
index dfda854..90eac49 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java
@@ -462,7 +462,7 @@ public class TestBackupSystemTable {
       table.deleteBackupSet(setName);
 
       List<TableName> tnames = table.describeBackupSet(setName);
-      assertTrue(tnames.size() == 0);
+      assertTrue(tnames == null);
       cleanBackupTable();
     }
   }


Mime
View raw message