Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HConnection


   * @throws TableNotFoundException if table does not yet exist
   */
  public void doBulkLoad(Path hfofDir, final HTable table)
    throws TableNotFoundException, IOException
  {
    final HConnection conn = table.getConnection();

    if (!conn.isTableAvailable(table.getTableName())) {
      throw new TableNotFoundException("Table " +
          Bytes.toStringBinary(table.getTableName()) +
          "is not currently available.");
    }

View Full Code Here


   * @throws TableNotFoundException if table does not yet exist
   */
  public void doBulkLoad(Path hfofDir, final HTable table)
    throws TableNotFoundException, IOException
  {
    final HConnection conn = table.getConnection();

    if (!conn.isTableAvailable(table.getTableName())) {
      throw new TableNotFoundException("Table " +
          Bytes.toStringBinary(table.getTableName()) +
          "is not currently available.");
    }

View Full Code Here

      Configuration conf = context.getConfiguration();
      cfRenameMap = createCfRenameMap(conf);
      filter = instantiateFilter(conf);

      try {
        HConnection connection = HConnectionManager.getConnection(conf);
        ZooKeeperWatcher zkw = connection.getZooKeeperWatcher();
        ReplicationZookeeper zkHelper = new ReplicationZookeeper(connection, conf, zkw);
        clusterId = zkHelper.getUUIDForCluster(zkw);
      } catch (ZooKeeperConnectionException e) {
        LOG.error("Problem connecting to ZooKeper during task setup", e);
      } catch (KeeperException e) {
View Full Code Here

    throws IOException {
    ClusterStatus status = admin.getMaster().getClusterStatus();
    Collection<ServerName> regionServers = status.getServers();
    Map<ServerName, List<String>> mm =
        new HashMap<ServerName, List<String>>();
    HConnection connection = admin.getConnection();
    for (ServerName hsi : regionServers) {
      HRegionInterface server =
        connection.getHRegionConnection(hsi.getHostname(), hsi.getPort());

      // list all online regions from this region server
      List<HRegionInfo> regions = server.getOnlineRegions();
      List<String> regionNames = new ArrayList<String>();
      for (HRegionInfo hri : regions) {
View Full Code Here

    // Return a good result first and then return null to indicate end of scan
    Mockito.when(implementation.next(Mockito.anyLong(), Mockito.anyInt())).
      thenReturn(new Result [] {r}, (Result [])null);

    // Get a connection w/ mocked up common methods.
    HConnection connection =
      HConnectionTestingUtility.getMockedConnectionAndDecorate(HTU.getConfiguration(),
        implementation, SERVERNAME_B, REGIONINFO);

    // Make it so we can get a catalogtracker from servermanager.. .needed
    // down in guts of server shutdown handler.
View Full Code Here

      Mockito.when(ri.next(Mockito.anyLong(), Mockito.anyInt())).thenReturn(new Result[] { r });
      // If a get, return the above result too for REGIONINFO
      Mockito.when(ri.get((byte[]) Mockito.any(), (Get) Mockito.any())).thenReturn(r);
    }
    // Get a connection w/ mocked up common methods.
    HConnection connection = HConnectionTestingUtility.
      getMockedConnectionAndDecorate(HTU.getConfiguration(), ri, SERVERNAME_B,
        REGIONINFO);
    // Make it so we can get the connection from our mocked catalogtracker
    Mockito.when(ct.getConnection()).thenReturn(connection);
    // Create and startup an executor. Used by AM handling zk callbacks.
View Full Code Here

   * @throws TableNotFoundException if table does not yet exist
   */
  public void doBulkLoad(Path hfofDir, final HTable table)
    throws TableNotFoundException, IOException
  {
    final HConnection conn = table.getConnection();

    if (!conn.isTableAvailable(table.getTableName())) {
      throw new TableNotFoundException("Table " +
          Bytes.toStringBinary(table.getTableName()) +
          "is not currently available.");
    }

View Full Code Here

          + System.getProperty("file.separator") + htd.getNameAsString()
          + System.getProperty("file.separator") + regionToDeleteInFS);
      getDFSCluster().getFileSystem().delete(tableDir);
    }
    // flush cache of regions
    HConnection conn = table.getConnection();
    conn.clearRegionCache();
    // assign all the new regions IF table is enabled.
    HBaseAdmin admin = getHBaseAdmin();
    if (admin.isTableEnabled(table.getTableName())) {
      for(HRegionInfo hri : newRegions) {
        admin.assign(hri.getRegionName());
View Full Code Here

      protected List<LoadQueueItem> tryAtomicRegionLoad(final HConnection conn,
          byte[] tableName, final byte[] first, Collection<LoadQueueItem> lqis)
      throws IOException {
        int i = attmptedCalls.incrementAndGet();
        if (i == 1) {
          HConnection errConn = null;
          try {
            errConn = getMockedConnection(util.getConfiguration());
          } catch (Exception e) {
            LOG.fatal("mocking cruft, should never happen", e);
            throw new RuntimeException("mocking cruft, should never happen");
View Full Code Here

    fail("doBulkLoad should have thrown an exception");
  }

  private HConnection getMockedConnection(final Configuration conf)
  throws IOException {
    HConnection c = Mockito.mock(HConnection.class);
    Mockito.when(c.getConfiguration()).thenReturn(conf);
    Mockito.doNothing().when(c).close();
    // Make it so we return a particular location when asked.
    final HRegionLocation loc = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
        "example.org", 1234);
    Mockito.when(c.getRegionLocation((byte[]) Mockito.any(),
        (byte[]) Mockito.any(), Mockito.anyBoolean())).
      thenReturn(loc);
    Mockito.when(c.locateRegion((byte[]) Mockito.any(), (byte[]) Mockito.any())).
      thenReturn(loc);
    HRegionInterface hri = Mockito.mock(HRegionInterface.class);
    Mockito.when(hri.bulkLoadHFiles(Mockito.anyList(), (byte [])Mockito.any())).
      thenThrow(new IOException("injecting bulk load error"));
    Mockito.when(c.getHRegionConnection(Mockito.anyString(), Mockito.anyInt())).
      thenReturn(hri);
    return c;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.HConnection

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.