Package org.apache.hadoop.hbase.io

Examples of org.apache.hadoop.hbase.io.Cell$CellIterator


   * @return Null or found HRegionInfo.
   * @throws IOException
   */
  HRegionInfo getHRegionInfo(final byte [] row, final Map<byte [], Cell> map)
  throws IOException {
    Cell regioninfo = map.get(COL_REGIONINFO);
    if (regioninfo == null) {
      StringBuilder sb =  new StringBuilder();
      for (byte [] e: map.keySet()) {
        if (sb.length() > 0) {
          sb.append(", ");
        }
        sb.append(Bytes.toString(e));
      }
      LOG.warn(Bytes.toString(COL_REGIONINFO) + " is empty for row: " +
         Bytes.toString(row) + "; has keys: " + sb.toString());
      return null;
    }
    return Writables.getHRegionInfo(regioninfo.getValue());
  }
View Full Code Here


            if (!(deletes.containsKey(readcol) &&
                deletes.get(readcol).longValue() >= readkey.getTimestamp())) {
              if (!isExpired(readkey, ttl, now)) {
                if (!results.containsKey(readcol)) {
                  results.put(readcol,
                              new Cell(readval.get(), readkey.getTimestamp()));
                } else {
                  results.get(readcol).add(readval.get(),
                                           readkey.getTimestamp());
                }
                // need to reinstantiate the readval so we can reuse it,
View Full Code Here

  private boolean get(final HStoreKey key, final byte [] value,
      final int versions, final List<Cell> results,
      final Set<HStoreKey> deletes, final long now) {
    if (!HLogEdit.isDeleted(value)) {
      if (notExpiredAndNotInDeletes(this.ttl, key, now, deletes)) {
        results.add(new Cell(value, key.getTimestamp()));
      }
      // Perhaps only one version is wanted.  I could let this
      // test happen later in the for loop test but it would cost
      // the allocation of an ImmutableBytesWritable.
      if (hasEnoughVersions(versions, results)) {
View Full Code Here

          currentRegion = s.getHRegionInfo();
          RowResult r = null;
          RowResult[] rrs = null;
          while ((rrs = getRegionServerWithRetries(s)) != null) {
            r = rrs[0];
            Cell c = r.get(HConstants.COL_REGIONINFO);
            if (c != null) {
              byte[] value = c.getValue();
              if (value != null) {
                HRegionInfo info = Writables.getHRegionInfoOrNull(value);
                if (info != null) {
                  if (Bytes.equals(info.getTableDesc().getName(), tableName)) {
                    rowsScanned += 1;
View Full Code Here

            HConstants.COLUMN_FAMILY);
          if (regionInfoRow == null) {
            throw new TableNotFoundException(Bytes.toString(tableName));
          }

          Cell value = regionInfoRow.get(COL_REGIONINFO);
          if (value == null || value.getValue().length == 0) {
            throw new IOException("HRegionInfo was null or empty in " +
              Bytes.toString(parentTable));
          }
          // convert the row result into the HRegionLocation we need!
          HRegionInfo regionInfo = (HRegionInfo) Writables.getWritable(
              value.getValue(), new HRegionInfo());
          // possible we got a region of a different table...
          if (!Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
            throw new TableNotFoundException(
              "Table '" + Bytes.toString(tableName) + "' was not found.");
          }
View Full Code Here

        if (!(Bytes.equals(info.getTableDesc().getName(), getTableName()))) {
          return false;
        }

        HServerAddress server = new HServerAddress();
        Cell c = rowResult.get(HConstants.COL_SERVER);
        if (c != null && c.getValue() != null && c.getValue().length > 0) {
          String address = Bytes.toString(c.getValue());
          server = new HServerAddress(address);
        }
       
        if (!(info.isOffline() || info.isSplit())) {
          regionMap.put(new UnmodifyableHRegionInfo(info), server);
View Full Code Here

    super();
    try {
      TreeMap<byte [], Cell> columns =
        new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
      columns.put(Bytes.toBytes("a:1"),
          new Cell(Bytes.toBytes("1"), HConstants.LATEST_TIMESTAMP));
      values.put(Bytes.toBytes("1"), columns);
      columns = new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
      columns.put(Bytes.toBytes("a:2"),
          new Cell(Bytes.toBytes("2"), HConstants.LATEST_TIMESTAMP));
      columns.put(Bytes.toBytes("b:2"),
          new Cell(Bytes.toBytes("2"), HConstants.LATEST_TIMESTAMP));
    } catch (Exception e) {
      e.printStackTrace();
      throw e;
    }
  }
View Full Code Here

   */
  public static void changeOnlineStatus (final HBaseConfiguration c,
      final byte [] row, final boolean onlineOffline)
  throws IOException {
    HTable t = new HTable(c, HConstants.META_TABLE_NAME);
    Cell cell = t.get(row, HConstants.COL_REGIONINFO);
    if (cell == null) {
      throw new IOException("no information for row " + row);
    }
    // Throws exception if null.
    HRegionInfo info = Writables.getHRegionInfo(cell);
View Full Code Here

        if (!(Bytes.equals(info.getTableDesc().getName(), getTableName()))) {
          return false;
        }

        HServerAddress server = new HServerAddress();
        Cell c = rowResult.get(HConstants.COL_SERVER);
        if (c != null && c.getValue() != null && c.getValue().length > 0) {
          String address = Bytes.toString(c.getValue());
          server = new HServerAddress(address);
        }
       
        if (!(info.isOffline() || info.isSplit())) {
          regionMap.put(new UnmodifyableHRegionInfo(info), server);
View Full Code Here

          } else if (!(deletes.containsKey(itCol)
              && deletes.get(itCol).longValue() >= itKey.getTimestamp())) {
            // Skip expired cells
            if (ttl == HConstants.FOREVER ||
                  now < itKey.getTimestamp() + ttl) {
              results.put(itCol, new Cell(val, itKey.getTimestamp()));
            } else {
              addVictim(victims, itKey);
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.Cell$CellIterator

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.