Exemple #1
0
 /**
  * Disable a table's replication switch.
  *
  * @param tableName name of the table
  * @throws IOException if a remote or network exception occurs
  */
 public void disableTableRep(final TableName tableName) throws IOException {
   if (tableName == null) {
     throw new IllegalArgumentException("Table name is null");
   }
   try (Admin admin = this.connection.getAdmin()) {
     if (!admin.tableExists(tableName)) {
       throw new TableNotFoundException(
           "Table '" + tableName.getNamespaceAsString() + "' does not exists.");
     }
   }
   setTableRep(tableName, false);
 }
Exemple #2
0
 /**
  * Enable a table's replication switch.
  *
  * @param tableName name of the table
  * @throws IOException if a remote or network exception occurs
  */
 public void enableTableRep(final TableName tableName) throws IOException {
   if (tableName == null) {
     throw new IllegalArgumentException("Table name cannot be null");
   }
   try (Admin admin = this.connection.getAdmin()) {
     if (!admin.tableExists(tableName)) {
       throw new TableNotFoundException(
           "Table '" + tableName.getNameAsString() + "' does not exists.");
     }
   }
   byte[][] splits = getTableSplitRowKeys(tableName);
   checkAndSyncTableDescToPeers(tableName, splits);
   setTableRep(tableName, true);
 }