Package org.apache.hadoop.hbase.client

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


  private void verifyData(HRegion newReg, int startRow, int numRows, byte [] qf,
      byte [] ... families)
  throws IOException {
    for(int i=startRow; i<startRow + numRows; i++) {
      byte [] row = Bytes.toBytes("" + i);
      Get get = new Get(row);
      for(byte [] family : families) {
        get.addColumn(family, qf);
      }
      Result result = newReg.get(get, null);
      KeyValue [] raw = result.sorted();
      assertEquals(families.length, result.size());
      for(int j=0; j<families.length; j++) {
View Full Code Here


  }

  private void assertGet(final HRegion r, final byte [] family, final byte [] k)
  throws IOException {
    // Now I have k, get values out and assert they are as expected.
    Get get = new Get(k).addFamily(family).setMaxVersions();
    KeyValue [] results = r.get(get, null).raw();
    for (int j = 0; j < results.length; j++) {
      byte [] tmp = results[j].getValue();
      // Row should be equal to value every time.
      assertTrue(Bytes.equals(k, tmp));
View Full Code Here

   * HBASE-1784).
   * @param hri Region to assign.
   */
  private void assignSplitDaughter(final HRegionInfo hri) {
    MetaRegion mr = this.master.regionManager.getFirstMetaRegionForRegion(hri);
    Get g = new Get(hri.getRegionName());
    g.addFamily(HConstants.CATALOG_FAMILY);
    try {
      HRegionInterface server =
        master.connection.getHRegionConnection(mr.getServer());
      Result r = server.get(mr.getRegionName(), g);
      // If size > 3 -- presume regioninfo, startcode and server -- then presume
View Full Code Here

    // Scans are sloppy. They don't respect row locks and they get and
    // cache a row internally so may have data that is stale. Make sure that for
    // 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 " +
View Full Code Here

    assertEquals(1, this.store.getStorefiles().size());
    // from the one we inserted up there, and a new one
    assertEquals(2, this.store.memstore.kvset.size());

    // how many key/values for this row are there?
    Get get = new Get(row);
    get.addColumn(family, qf1);
    get.setMaxVersions(); // all versions.
    List<KeyValue> results = new ArrayList<KeyValue>();

    NavigableSet<byte[]> cols = new TreeSet<byte[]>();
    cols.add(qf1);
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

      key = store.getRowKeyAtOrBefore(kv);
      if (key == null) {
        return null;
      }
      // 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

      for (KeyValue kv: kvs) {
        // Check if time is LATEST, change to time of most recent addition if so
        // This is expensive.
        if (kv.isLatestTimestamp() && kv.isDeleteType()) {
          List<KeyValue> result = new ArrayList<KeyValue>(1);
          Get g = new Get(kv.getRow());
          NavigableSet<byte []> qualifiers =
            new TreeSet<byte []>(Bytes.BYTES_COMPARATOR);
          byte [] q = kv.getQualifier();
          if(q == null) q = HConstants.EMPTY_BYTE_ARRAY;
          qualifiers.add(q);
View Full Code Here

    //TODO, add check for value length or maybe even better move this to the
    //client if this becomes a global setting
    checkResources();
    splitsAndClosesLock.readLock().lock();
    try {
      Get get = new Get(row, put.getRowLock());
      checkFamily(family);
      get.addColumn(family, qualifier);

      byte [] now = Bytes.toBytes(System.currentTimeMillis());

      // Lock row
      Integer lid = getLock(lockId, get.getRow());
      List<KeyValue> result = new ArrayList<KeyValue>();
      try {
        //Getting data
        for(Map.Entry<byte[],NavigableSet<byte[]>> entry:
          get.getFamilyMap().entrySet()) {
          get(this.stores.get(entry.getKey()), get, entry.getValue(), result);
        }
        boolean matches = false;
        if (result.size() == 0 && expectedValue.length == 0) {
          matches = true;
View Full Code Here

    long result = amount;
    try {
      Store store = stores.get(family);

      // Get the old value:
      Get get = new Get(row);
      get.addColumn(family, qualifier);
      List<KeyValue> results = new ArrayList<KeyValue>();
      NavigableSet<byte[]> qualifiers = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
      qualifiers.add(qualifier);
      store.get(get, qualifiers, results);
View Full Code Here

TOP

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

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.