Package org.apache.hadoop.hbase.client

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


      Scan s = new Scan().addFamily(HConstants.CATALOG_FAMILY);
      // Make this scan do a row at a time otherwise, data can be stale.
      s.setCaching(1);
      scannerId = regionServer.openScanner(region.getRegionName(), s);
      while (true) {
        Result values = regionServer.next(scannerId);
        if (values == null || values.size() == 0) {
          break;
        }
        HRegionInfo info = master.getHRegionInfo(values.getRow(), values);
        if (info == null) {
          emptyRows.add(values.getRow());
          continue;
        }
        String serverAddress = getServerAddress(values);
        long startCode = getStartCode(values);
View Full Code Here


    // sure we have the right server and servercode. We are trying to avoid
    // double-assignments. See hbase-1784. Will have to wait till 0.21 hbase
    // where we use zk to mediate state transitions to do better.
    Get g = new Get(info.getRegionName());
    g.addFamily(HConstants.CATALOG_FAMILY);
    Result r = regionServer.get(meta.getRegionName(), g);
    if (r != null && !r.isEmpty()) {
      sa = getServerAddress(r);
      if (sa != null && sa.length() > 0 && !sa.equalsIgnoreCase(serverAddress)) {
        LOG.debug("GET on " + info.getRegionNameAsString() + " got different " +
          "address than SCAN: sa=" + sa + ", serverAddress=" + serverAddress);
      }
View Full Code Here

 
  /** Use get to retrieve the HRegionInfo and validate it */
  private void getRegionInfo() throws IOException {
    Get get = new Get(ROW_KEY);
    get.addColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
    Result result = region.get(get, null);
    byte [] bytes = result.value();
    validateRegionInfo(bytes)
  }
View Full Code Here

      }
      // This will get all results for this store.  TODO: Do we need to do this?
      Get get = new Get(key.getRow());
      List<KeyValue> results = new ArrayList<KeyValue>();
      store.get(get, null, results);
      return new Result(results);
    } finally {
      splitsAndClosesLock.readLock().unlock();
    }
  }
View Full Code Here

        get(this.stores.get(entry.getKey()), get, entry.getValue(), result);
      }
    } finally {
      if(lockid == null) releaseRowLock(lid);
    }
    return new Result(result);
  }
View Full Code Here

    delete.deleteColumns(fam, splitA);
    region.delete(delete, null, true);

    // assert some things:
    Get get = new Get(row).addColumn(fam, serverinfo);
    Result result = region.get(get, null);
    assertEquals(1, result.size());

    get = new Get(row).addColumn(fam, splitA);
    result = region.get(get, null);
    assertEquals(0, result.size());

    get = new Get(row).addColumn(fam, splitB);
    result = region.get(get, null);
    assertEquals(1, result.size());
  }
View Full Code Here

    Delete delete = new Delete(row);
    region.delete(delete, null, true);

    // make sure we still see our data
    Get get = new Get(row).addColumn(fam, serverinfo);
    Result result = region.get(get, null);
    assertEquals(1, result.size());
   
    // delete the future row
    delete = new Delete(row,HConstants.LATEST_TIMESTAMP-3,null);
    region.delete(delete, null, true);

    // make sure it is gone
    get = new Get(row).addColumn(fam, serverinfo);
    result = region.get(get, null);
    assertEquals(0, result.size());
  }
View Full Code Here

    // ok get:
    Get get = new Get(row);
    get.addColumn(fam1, qual1);

    Result r = region.get(get, null);
    assertEquals(1, r.size());
    assertByteEquals(value2, r.getValue(fam1, qual1));

    // next:
    Scan scan = new Scan(row);
    scan.addColumn(fam1, qual1);
    InternalScanner s = region.getScanner(scan);
View Full Code Here

    KeyValue kv1 = new KeyValue(row1, fam1, col2);
    KeyValue kv2 = new KeyValue(row1, fam1, col4);
    KeyValue [] expected = {kv1, kv2};

    //Test
    Result res = region.get(get, null);
    assertEquals(expected.length, res.size());
    for(int i=0; i<res.size(); i++){
      assertEquals(0,
          Bytes.compareTo(expected[i].getRow(), res.raw()[i].getRow()));
      assertEquals(0,
          Bytes.compareTo(expected[i].getFamily(), res.raw()[i].getFamily()));
      assertEquals(0,
          Bytes.compareTo(
              expected[i].getQualifier(), res.raw()[i].getQualifier()));
    }

    // Test using a filter on a Get
    Get g = new Get(row1);
    final int count = 2;
    g.setFilter(new ColumnCountGetFilter(count));
    res = region.get(g, null);
    assertEquals(count, res.size());
  }
View Full Code Here

    String method = this.getName();
    initHRegion(tableName, method, fam);
   
    Get get = new Get(row);
    get.addFamily(fam);
    Result r = region.get(get, null);
   
    assertTrue(r.isEmpty());
  }
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.