Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-4973

On failure, HBaseAdmin sleeps one time too many

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.94.0
    • Fix Version/s: 0.94.0
    • Component/s: Client
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      In this code last sleep is useless as we're not retrying. This can slow down failure scenarios by a few seconds (up to 32 second).

        public HBaseAdmin(Configuration c)
        throws MasterNotRunningException, ZooKeeperConnectionException {
          this.conf = HBaseConfiguration.create(c);
            this.connection = HConnectionManager.getConnection(this.conf);
          this.pause = this.conf.getLong("hbase.client.pause", 1000);
          this.numRetries = this.conf.getInt("hbase.client.retries.number", 10);
          this.retryLongerMultiplier = this.conf.getInt(
              "hbase.client.retries.longer.multiplier", 10);
          int tries = 0;
          for (; tries < numRetries; ++tries) {
            try {
              this.connection.getMaster();
              break;
            } catch (MasterNotRunningException mnre) {
              HConnectionManager.deleteStaleConnection(this.connection);
              this.connection = HConnectionManager.getConnection(this.conf);
            } catch (UndeclaredThrowableException ute) {
              HConnectionManager.deleteStaleConnection(this.connection);
              this.connection = HConnectionManager.getConnection(this.conf);
            }
            try { // Sleep
              Thread.sleep(getPauseTime(tries));
            } catch (InterruptedException e) {
              Thread.currentThread().interrupt();
              // we should delete connection between client and zookeeper
              HConnectionManager.deleteStaleConnection(this.connection);
              throw new MasterNotRunningException("Interrupted");
            }
          }
          if (tries >= numRetries) {
            // we should delete connection between client and zookeeper
            HConnectionManager.deleteStaleConnection(this.connection);
            throw new MasterNotRunningException("Retried " + numRetries + " times");
          }
        }
      

        Attachments

        1. 4973_HBaseAdmin.patch
          2 kB
          Nicolas Liochon

        Issue Links

          Activity

            People

            • Assignee:
              nkeywal Nicolas Liochon
              Reporter:
              nkeywal Nicolas Liochon

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment