shenshengli commented on a change in pull request #3100: URL: https://github.com/apache/hbase/pull/3100#discussion_r603183370
########## File path: hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java ########## @@ -487,12 +489,21 @@ private void checkAndCreateTable(Connection conn, Path tableBackupPath, TableNam if (createNew) { LOG.info("Creating target table '" + targetTableName + "'"); byte[][] keys; - if (regionDirList == null || regionDirList.size() == 0) { - admin.createTable(htd); - } else { - keys = generateBoundaryKeys(regionDirList); - // create table using table descriptor and region boundaries - admin.createTable(htd, keys); + try{ + if (regionDirList == null || regionDirList.size() == 0) { + admin.createTable(htd); + } else { + keys = generateBoundaryKeys(regionDirList); + // create table using table descriptor and region boundaries + admin.createTable(htd, keys); + } + } catch (NamespaceNotFoundException e){ + LOG.warn(e.getMessage()); + String namespaceAsString = targetTableName.getNamespaceAsString(); + LOG.info("Creating target namespace '" + namespaceAsString + "'"); + admin.createNamespace(NamespaceDescriptor.create(namespaceAsString).build()); + checkAndCreateTable(conn, tableBackupPath, tableName, targetTableName, regionDirList, htd, Review comment: Thank you for your advice. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org