Package org.apache.hadoop.hbase.client

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


        getInt("hbase.meta.scanner.caching", 100);
      scan.setCaching(rows);
      List<byte []> emptyRows = new ArrayList<byte []>();
      try {
        while (true) {
          Result values = this.server.next(scannerId);
          if (values == null || values.isEmpty()) {
            break;
          }
          HRegionInfo info = this.master.getHRegionInfo(values.getRow(), values);
          if (info == null) {
            emptyRows.add(values.getRow());
            LOG.error(Bytes.toString(CATALOG_FAMILY) + ":" +
                Bytes.toString(REGIONINFO_QUALIFIER) + " not found on " +
                      Bytes.toStringBinary(values.getRow()));
            continue;
          }
          String serverAddress =
            Bytes.toString(values.getValue(CATALOG_FAMILY, SERVER_QUALIFIER));
          long startCode =
            Bytes.toLong(values.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER));
          String serverName = null;
          if (serverAddress != null && serverAddress.length() > 0) {
            serverName = HServerInfo.getServerName(serverAddress, startCode);
          }
          if (Bytes.compareTo(info.getTableDesc().getName(), tableName) > 0) {
View Full Code Here


        scan.setStopRow(Bytes.add(TEST_ROW, new byte[]{ 0 } ));
        scan.addFamily(TEST_FAMILY);
        HTable t = new HTable(conf, TEST_TABLE.getTableName());
        try {
          ResultScanner scanner = t.getScanner(scan);
          Result result = null;
          do {
            result = scanner.next();
            if (result != null) {
              scanResults.addAll(result.listCells());
            }
          } while (result != null);
        } finally {
          t.close();
        }
View Full Code Here

    Scan scan = new Scan();
    scan.setStartRow(Bytes.toBytes(table+",,"));
    ResultScanner scanner = meta.getScanner(scan);
    HRegionInfo hri = null;

    Result res = scanner.next();
    ServerName currServer =
      ServerName.parseFrom(res.getValue(HConstants.CATALOG_FAMILY,
          HConstants.SERVER_QUALIFIER));
    long startCode = Bytes.toLong(res.getValue(HConstants.CATALOG_FAMILY,
        HConstants.STARTCODE_QUALIFIER));

    for (JVMClusterUtil.RegionServerThread rs :
        TEST_UTIL.getHBaseCluster().getRegionServerThreads()) {

      ServerName sn = rs.getRegionServer().getServerName();

      // When we find a diff RS, change the assignment and break
      if (!currServer.getHostAndPort().equals(sn.getHostAndPort()) ||
          startCode != sn.getStartcode()) {
        Put put = new Put(res.getRow());
        put.setDurability(Durability.SKIP_WAL);
        put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
          Bytes.toBytes(sn.getHostAndPort()));
        put.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
          Bytes.toBytes(sn.getStartcode()));
View Full Code Here

    // Make an RS Interface implementation.  Make it so a scanner can go against it.
    ClientProtos.ClientService.BlockingInterface implementation =
      Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);
    // Get a meta row result that has region up on SERVERNAME_A

    Result r;
    if (splitRegion) {
      r = MetaMockingUtil.getMetaTableRowResultAsSplitRegion(REGIONINFO, SERVERNAME_A);
    } else {
      r = MetaMockingUtil.getMetaTableRowResult(REGIONINFO, SERVERNAME_A);
    }

    final ScanResponse.Builder builder = ScanResponse.newBuilder();
    builder.setMoreResults(true);
    builder.addCellsPerResult(r.size());
    final List<CellScannable> cellScannables = new ArrayList<CellScannable>(1);
    cellScannables.add(r);
    Mockito.when(implementation.scan(
      (RpcController)Mockito.any(), (ScanRequest)Mockito.any())).
      thenAnswer(new Answer<ScanResponse>() {
View Full Code Here

    // rebuild its list of user regions and it will also get the HRI that goes
    // with an encoded name by doing a Get on hbase:meta
    ClientProtos.ClientService.BlockingInterface ri =
      Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);
    // Get a meta row result that has region up on SERVERNAME_A for REGIONINFO
    Result r = MetaMockingUtil.getMetaTableRowResult(REGIONINFO, SERVERNAME_A);
    final ScanResponse.Builder builder = ScanResponse.newBuilder();
    builder.setMoreResults(true);
    builder.addCellsPerResult(r.size());
    final List<CellScannable> rows = new ArrayList<CellScannable>(1);
    rows.add(r);
    Answer<ScanResponse> ans = new Answer<ClientProtos.ScanResponse>() {
      public ScanResponse answer(InvocationOnMock invocation) throws Throwable {
        PayloadCarryingRpcController controller = (PayloadCarryingRpcController) invocation
View Full Code Here

      hbck.setFixSplitParents(true);
      hbck.onlineHbck();
      assertTrue(hbck.shouldRerun());

      Get get = new Get(hri.getRegionName());
      Result result = meta.get(get);
      assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,
        HConstants.SPLITA_QUALIFIER).isEmpty());
      assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,
        HConstants.SPLITB_QUALIFIER).isEmpty());
      TEST_UTIL.getHBaseAdmin().flush(TableName.META_TABLE_NAME.getName());

      // fix other issues
      doFsck(conf, true);
View Full Code Here

      HBaseFsck hbck = doFsck(conf, true, true, false, false, false, true, true, true, false, false, null);
      assertErrors(hbck, new ERROR_CODE[] {}); //no LINGERING_SPLIT_PARENT reported

      // assert that the split hbase:meta entry is still there.
      Get get = new Get(hri.getRegionName());
      Result result = meta.get(get);
      assertNotNull(result);
      assertNotNull(HRegionInfo.getHRegionInfo(result));

      assertEquals(ROWKEYS.length, countRows());
View Full Code Here

      assertErrors(hbck, new ERROR_CODE[] {ERROR_CODE.NOT_IN_META_OR_DEPLOYED,
          ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.HOLE_IN_REGION_CHAIN});

      // assert that the split hbase:meta entry is still there.
      Get get = new Get(hri.getRegionName());
      Result result = meta.get(get);
      assertNotNull(result);
      assertNotNull(HRegionInfo.getHRegionInfo(result));

      assertEquals(ROWKEYS.length, countRows());
View Full Code Here

    a.add(fam1, qual2, Bytes.toBytes(v2));
    assertNull(region.append(a));
    a = new Append(row);
    a.add(fam1, qual1, Bytes.toBytes(v2));
    a.add(fam1, qual2, Bytes.toBytes(v1));
    Result result = region.append(a);
    assertEquals(0, Bytes.compareTo(Bytes.toBytes(v1+v2), result.getValue(fam1, qual1)));
    assertEquals(0, Bytes.compareTo(Bytes.toBytes(v2+v1), result.getValue(fam1, qual2)));
  }
View Full Code Here

                         byte[] qualifier,
                         long amount) throws IOException {
    // run a get and see?
    Get get = new Get(row);
    get.addColumn(familiy, qualifier);
    Result result = region.get(get);
    assertEquals(1, result.size());

    Cell kv = result.rawCells()[0];
    long r = Bytes.toLong(CellUtil.cloneValue(kv));
    assertEquals(amount, r);
  }
View Full Code Here

TOP

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

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.