Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.NamespaceExistException;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableExistsException;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.BackupInfo;
import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
Expand Down Expand Up @@ -202,17 +204,25 @@ private void checkSystemTable() throws IOException {
Configuration conf = connection.getConfiguration();
if (!admin.tableExists(tableName)) {
TableDescriptor backupHTD = BackupSystemTable.getSystemTableDescriptor(conf);
admin.createTable(backupHTD);
createSystemTable(admin, backupHTD);
}
if (!admin.tableExists(bulkLoadTableName)) {
TableDescriptor blHTD = BackupSystemTable.getSystemTableForBulkLoadedDataDescriptor(conf);
admin.createTable(blHTD);
createSystemTable(admin, blHTD);
}
waitForSystemTable(admin, tableName);
waitForSystemTable(admin, bulkLoadTableName);
}
}

private void createSystemTable(Admin admin, TableDescriptor descriptor) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more comments to say why here we could hit table exists exception?

try {
admin.createTable(descriptor);
} catch (TableExistsException e) {
LOG.debug("Table {} already exists, ignoring", descriptor.getTableName(), e);
}
}

private void verifyNamespaceExists(Admin admin) throws IOException {
String namespaceName = tableName.getNamespaceAsString();
NamespaceDescriptor ns = NamespaceDescriptor.create(namespaceName).build();
Expand All @@ -225,7 +235,11 @@ private void verifyNamespaceExists(Admin admin) throws IOException {
}
}
if (!exists) {
admin.createNamespace(ns);
try {
admin.createNamespace(ns);
} catch (NamespaceExistException e) {
LOG.debug("Namespace {} already exists, ignoring", ns.getName(), e);
}
}
}

Expand Down