You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2017/04/20 09:57:32 UTC
hbase git commit: HBASE-17542 Move backup system table into separate
namespace
Repository: hbase
Updated Branches:
refs/heads/master 0953c1447 -> b1ef8dd43
HBASE-17542 Move backup system table into separate namespace
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b1ef8dd4
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b1ef8dd4
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b1ef8dd4
Branch: refs/heads/master
Commit: b1ef8dd43aa0f0102f296ea9b3eb76b5623052f5
Parents: 0953c14
Author: tedyu <yu...@gmail.com>
Authored: Thu Apr 20 02:57:24 2017 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Thu Apr 20 02:57:24 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/backup/BackupHFileCleaner.java | 8 ++++----
.../hbase/backup/BackupRestoreConstants.java | 2 +-
.../hbase/backup/impl/BackupSystemTable.java | 19 +++++++++++++++++++
3 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/b1ef8dd4/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupHFileCleaner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupHFileCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupHFileCleaner.java
index b6b4c0a..8e6e843 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupHFileCleaner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupHFileCleaner.java
@@ -54,9 +54,9 @@ public class BackupHFileCleaner extends BaseHFileCleanerDelegate implements Abor
private boolean aborted;
private Configuration conf;
private Connection connection;
- private long prevReadFromBackupTbl = 0, // timestamp of most recent read from hbase:backup table
- secondPrevReadFromBackupTbl = 0; // timestamp of 2nd most recent read from hbase:backup table
- //used by unit test to skip reading hbase:backup
+ private long prevReadFromBackupTbl = 0, // timestamp of most recent read from backup:system table
+ secondPrevReadFromBackupTbl = 0; // timestamp of 2nd most recent read from backup:system table
+ //used by unit test to skip reading backup:system
private boolean checkForFullyBackedUpTables = true;
private List<TableName> fullyBackedUpTables = null;
@@ -117,7 +117,7 @@ public class BackupHFileCleaner extends BaseHFileCleanerDelegate implements Abor
Iterable<FileStatus> deletables = Iterables.filter(files, new Predicate<FileStatus>() {
@Override
public boolean apply(FileStatus file) {
- // If the file is recent, be conservative and wait for one more scan of hbase:backup table
+ // If the file is recent, be conservative and wait for one more scan of backup:system table
if (file.getModificationTime() > secondPrevReadFromBackupTbl) {
return false;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b1ef8dd4/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupRestoreConstants.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupRestoreConstants.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupRestoreConstants.java
index 770ccce..e46904b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupRestoreConstants.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupRestoreConstants.java
@@ -30,7 +30,7 @@ public interface BackupRestoreConstants {
* Backup/Restore constants
*/
public final static String BACKUP_SYSTEM_TABLE_NAME_KEY = "hbase.backup.system.table.name";
- public final static String BACKUP_SYSTEM_TABLE_NAME_DEFAULT = "hbase:backup";
+ public final static String BACKUP_SYSTEM_TABLE_NAME_DEFAULT = "backup:system";
public final static String BACKUP_SYSTEM_TTL_KEY = "hbase.backup.system.ttl";
http://git-wip-us.apache.org/repos/asf/hbase/blob/b1ef8dd4/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
index 1ba8087..217e750 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java
@@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.BackupInfo;
@@ -165,6 +166,8 @@ public final class BackupSystemTable implements Closeable {
private void checkSystemTable() throws IOException {
try (Admin admin = connection.getAdmin();) {
+ verifyNamespaceExists(admin);
+
if (!admin.tableExists(tableName)) {
HTableDescriptor backupHTD =
BackupSystemTable.getSystemTableDescriptor(connection.getConfiguration());
@@ -174,6 +177,22 @@ public final class BackupSystemTable implements Closeable {
}
}
+ private void verifyNamespaceExists(Admin admin) throws IOException {
+ String namespaceName = tableName.getNamespaceAsString();
+ NamespaceDescriptor ns = NamespaceDescriptor.create(namespaceName).build();
+ NamespaceDescriptor[] list = admin.listNamespaceDescriptors();
+ boolean exists = false;
+ for( NamespaceDescriptor nsd: list) {
+ if (nsd.getName().equals(ns.getName())) {
+ exists = true;
+ break;
+ }
+ }
+ if (!exists) {
+ admin.createNamespace(ns);
+ }
+ }
+
private void waitForSystemTable(Admin admin) throws IOException {
long TIMEOUT = 60000;
long startTime = EnvironmentEdgeManager.currentTime();