Package org.apache.hadoop.hbase.zookeeper

Examples of org.apache.hadoop.hbase.zookeeper.ZKTable


    } else {
      this.serversInUpdatingTimer =  null;
      this.timeoutMonitor = null;
      this.timerUpdater = null;
    }
    this.zkTable = new ZKTable(this.watcher);
    // This is the max attempts, not retries, so it should be at least 1.
    this.maximumAttempts = Math.max(1,
      this.server.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10));
    this.sleepTimeBeforeRetryingMetaAssignment = this.server.getConfiguration().getLong(
        "hbase.meta.assignment.retry.sleeptime", 1000l);
View Full Code Here


    } else {
      this.serversInUpdatingTimer =  null;
      this.timeoutMonitor = null;
      this.timerUpdater = null;
    }
    this.zkTable = new ZKTable(this.watcher);
    this.maximumAttempts =
      this.server.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
    this.balancer = balancer;
    int maxThreads = conf.getInt("hbase.assignment.threads.max", 30);
    this.threadPoolExecutorService = Threads.getBoundedCachedThreadPool(
View Full Code Here

      conf.getInt("hbase.master.assignment.timeoutmonitor.period", 10000),
      master,
      conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 30000));
    Threads.setDaemonThreadRunning(timeoutMonitor,
      master.getServerName() + ".timeoutMonitor");
    this.zkTable = new ZKTable(this.master.getZooKeeper());
    this.maximumAssignmentAttempts =
      this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
  }
View Full Code Here

      conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 1800000));
    this.timerUpdater = new TimerUpdater(conf.getInt(
        "hbase.master.assignment.timerupdater.period", 10000), master);
    Threads.setDaemonThreadRunning(timerUpdater.getThread(),
        master.getServerName() + ".timerUpdater");
    this.zkTable = new ZKTable(this.master.getZooKeeper());
    this.maximumAssignmentAttempts =
      this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
    this.balancer = balancer;
    this.threadPoolExecutorService = Executors.newCachedThreadPool();
  }
View Full Code Here

    } else {
      this.serversInUpdatingTimer =  null;
      this.timeoutMonitor = null;
      this.timerUpdater = null;
    }
    this.zkTable = new ZKTable(this.watcher);
    // This is the max attempts, not retries, so it should be at least 1.
    this.maximumAttempts = Math.max(1,
      this.server.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10));
    this.sleepTimeBeforeRetryingMetaAssignment = this.server.getConfiguration().getLong(
        "hbase.meta.assignment.retry.sleeptime", 1000l);
View Full Code Here

      conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 1800000));
    this.timerUpdater = new TimerUpdater(conf.getInt(
        "hbase.master.assignment.timerupdater.period", 10000), master);
    Threads.setDaemonThreadRunning(timerUpdater.getThread(),
        master.getServerName() + ".timerUpdater");
    this.zkTable = new ZKTable(this.master.getZooKeeper());
    this.maximumAssignmentAttempts =
      this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
    this.balancer = balancer;
    this.threadPoolExecutorService = Executors.newCachedThreadPool();
  }
View Full Code Here

  public void preMasterInitialization(ObserverContext<MasterCoprocessorEnvironment> ctx)
      throws IOException {
    LOG.info("Entering into preMasterInitialization.");
    MasterServices master = ctx.getEnvironment().getMasterServices();
    AssignmentManager am = master.getAssignmentManager();
    ZKTable zkTable = am.getZKTable();
    long timeout =
        master.getConfiguration().getLong("hbase.bulk.assignment.waiton.empty.rit", 5 * 60 * 1000);
    try {
      am.waitUntilNoRegionsInTransition(timeout);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while waiting for the regions in transition to complete.", e);
      }
    }

    TableDescriptors tableDescriptors = master.getTableDescriptors();
    Map<String, HTableDescriptor> descMap = tableDescriptors.getAll();
    Collection<HTableDescriptor> htds = descMap.values();
    IndexedHTableDescriptor iHtd = null;
    Configuration conf = master.getConfiguration();
    FileSystem fs = FSUtils.getCurrentFileSystem(conf);
    Path rootPath = FSUtils.getRootDir(conf);
    for (HTableDescriptor htd : htds) {
      if (false == htd.getNameAsString().endsWith(Constants.INDEX_TABLE_SUFFIX)) {
        FSDataInputStream fsDataInputStream = null;
        try {
          Path path = FSUtils.getTablePath(rootPath, htd.getName());
          FileStatus status = getTableInfoPath(fs, path);
          if (null == status) {
            return;
          }
          fsDataInputStream = fs.open(status.getPath());
          iHtd = new IndexedHTableDescriptor();
          iHtd.readFields(fsDataInputStream);
        } catch (EOFException e) {
          if (LOG.isDebugEnabled()) {
            LOG.debug(iHtd.getNameAsString() + " is normal table and not an indexed table.", e);
          }
        } catch (IOException i) {
          throw i;
        } finally {
          if (null != fsDataInputStream) {
            fsDataInputStream.close();
          }
        }
        if (false == iHtd.getIndices().isEmpty()) {
          String tableName = iHtd.getNameAsString();
          String indexTableName = IndexUtils.getIndexTableName(tableName);
          boolean tableExists = MetaReader.tableExists(master.getCatalogTracker(), tableName);
          boolean indexTableExists =
              MetaReader.tableExists(master.getCatalogTracker(), indexTableName);
          if ((true == tableExists) && (false == indexTableExists)) {
            LOG.info("Table has index specification details but " + "no corresponding index table.");
            List<HRegionInfo> regions =
                MetaReader.getTableRegions(master.getCatalogTracker(), iHtd.getName());
            HRegionInfo[] regionsArray = new HRegionInfo[regions.size()];
            byte[][] splitKeys = IndexUtils.getSplitKeys(regions.toArray(regionsArray));
            createSecondaryIndexTable(iHtd, splitKeys, master, false);
          } else if (true == tableExists && true == indexTableExists) {
            // If both tables are present both should be in same state in zookeeper. If tables are
            // partially enabled or disabled they will be processed as part of recovery
            // enabling/disabling tables.
            // if user table is in ENABLED state and index table is in DISABLED state means master
            // restarted as soon as user table enabled. So here we need to enable index table.
            if (zkTable.isEnabledTable(tableName) && zkTable.isDisabledTable(indexTableName)) {
              new EnableTableHandler(master, Bytes.toBytes(indexTableName),
                  master.getCatalogTracker(), am, false).process();
            } else if (zkTable.isDisabledTable(tableName) && zkTable.isEnabledTable(indexTableName)) {
              // If user table is in DISABLED state and index table is in ENABLED state means master
              // restarted as soon as user table disabled. So here we need to disable index table.
              new DisableTableHandler(master, Bytes.toBytes(indexTableName),
                  master.getCatalogTracker(), am, false).process();
              // clear index table region plans in secondary index load balancer.
View Full Code Here

      conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 1800000));
    this.timerUpdater = new TimerUpdater(conf.getInt(
        "hbase.master.assignment.timerupdater.period", 10000), master);
    Threads.setDaemonThreadRunning(timerUpdater.getThread(),
        master.getServerName() + ".timerUpdater");
    this.zkTable = new ZKTable(this.master.getZooKeeper());
    this.maximumAssignmentAttempts =
      this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10);
    this.balancer = balancer;
    this.threadPoolExecutorService = Executors.newCachedThreadPool();
  }
View Full Code Here

    List<HRegionInfo> regionsThatShouldBeOffline = new ArrayList<HRegionInfo>();

    log("Beginning to mock scenarios");

    // Disable the disabledTable in ZK
    ZKTable zktable = new ZKTable(zkw);
    zktable.setDisabledTable(disabledTable);

    /*
     *  ZK = OFFLINE
     */

 
View Full Code Here

    List<HRegionInfo> regionsThatShouldBeOffline = new ArrayList<HRegionInfo>();

    log("Beginning to mock scenarios");

    // Disable the disabledTable in ZK
    ZKTable zktable = new ZKTable(zkw);
    zktable.setDisabledTable(disabledTable);

    assertTrue(" The enabled table should be identified on master fail over.",
        zktable.isEnabledTable(TableName.valueOf("enabledTable")));

    /*
     * ZK = CLOSING
     */

 
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.zookeeper.ZKTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.