Review Board 1.7.22


HBASE-4271 Clean up coprocessor's handlings of table operations

Review Request #1691 - Created Sept. 1, 2011 and updated

Ming Ma
trunk
HBASE-4271
Reviewers
hbase
ghelmling, tedyu
hbase
Along with coprocessor work, also fix HBaseAdmin.deleteTable so that it waits until the table is removed from HMaster's HTableDescriptor list.

1. Fix preCreateTable, postCreateTable, preAssign, postAssign, preUnassign APIs.
2. Make coprocessor honor bypass request from preMove, preAddColumn, preModifyColumn, preDeleteColumn.
Unit tests
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
Revision 1163917 New Change
[20] 103 lines
[+20] [+] public class HBaseAdmin implements Abortable, Closeable {
104
      try {
104
      try {
105
        this.connection.getMaster();
105
        this.connection.getMaster();
106
        break;
106
        break;
107
      } catch (MasterNotRunningException mnre) {
107
      } catch (MasterNotRunningException mnre) {
108
        HConnectionManager.deleteStaleConnection(this.connection);
108
        HConnectionManager.deleteStaleConnection(this.connection);
109
        this.connection = HConnectionManager.getConnection(this.conf);        
109
        this.connection = HConnectionManager.getConnection(this.conf);
110
      } catch (UndeclaredThrowableException ute) {
110
      } catch (UndeclaredThrowableException ute) {
111
        HConnectionManager.deleteStaleConnection(this.connection);
111
        HConnectionManager.deleteStaleConnection(this.connection);
112
        this.connection = HConnectionManager.getConnection(this.conf);        
112
        this.connection = HConnectionManager.getConnection(this.conf);
113
      }
113
      }
114
      try { // Sleep
114
      try { // Sleep
115
        Thread.sleep(getPauseTime(tries));
115
        Thread.sleep(getPauseTime(tries));
116
      } catch (InterruptedException e) {
116
      } catch (InterruptedException e) {
117
        Thread.currentThread().interrupt();
117
        Thread.currentThread().interrupt();
[+20] [20] 365 lines
[+20] [+] public void deleteTable(final byte [] tableName) throws IOException {
483
            HConstants.REGIONINFO_QUALIFIER);
483
            HConstants.REGIONINFO_QUALIFIER);
484
        scannerId = server.openScanner(
484
        scannerId = server.openScanner(
485
          firstMetaServer.getRegionInfo().getRegionName(), scan);
485
          firstMetaServer.getRegionInfo().getRegionName(), scan);
486
        // Get a batch at a time.
486
        // Get a batch at a time.
487
        Result values = server.next(scannerId);
487
        Result values = server.next(scannerId);

    
   
488

   

    
   
489
        // let us wait until .META. table is updated and

    
   
490
        // HMaster removes the table from its HTableDescriptors
488
        if (values == null) {
491
        if (values == null) {

    
   
492
          boolean tableExists = false;

    
   
493
          HTableDescriptor[] htds = getMaster().getHTableDescriptors();

    
   
494
          if (htds != null && htds.length > 0) {

    
   
495
            for (HTableDescriptor htd: htds) {

    
   
496
              if (Bytes.equals(tableName, htd.getName())) {

    
   
497
                tableExists = true;

    
   
498
                break;

    
   
499
              }

    
   
500
            }

    
   
501
          }

    
   
502
          if (!tableExists) {
489
          break;
503
            break;
490
        }
504
          }

    
   
505
        }
491
      } catch (IOException ex) {
506
      } catch (IOException ex) {
492
        if(tries == numRetries - 1) {           // no more tries left
507
        if(tries == numRetries - 1) {           // no more tries left
493
          if (ex instanceof RemoteException) {
508
          if (ex instanceof RemoteException) {
494
            ex = RemoteExceptionHandler.decodeRemoteException((RemoteException) ex);
509
            ex = RemoteExceptionHandler.decodeRemoteException((RemoteException) ex);
495
          }
510
          }
[+20] [20] 1059 lines
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
Revision 1163917 New Change
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
Revision 1163917 New Change
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Revision 1163917 New Change
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
Revision 1163917 New Change
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
Revision 1163917 New Change
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Revision 1163917 New Change
 
  1. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java: Loading...
  2. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java: Loading...
  3. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java: Loading...
  4. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java: Loading...
  5. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java: Loading...
  6. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java: Loading...
  7. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java: Loading...