Package org.apache.hadoop.hbase.io

Examples of org.apache.hadoop.hbase.io.RowResult


      try {
        scannerId =
          server.openScanner(firstMetaServer.getRegionInfo().getRegionName(),
            HConstants.COL_REGIONINFO_ARRAY, tableName,
            HConstants.LATEST_TIMESTAMP, null);
        RowResult values = server.next(scannerId);
        if (values == null || values.size() == 0) {
          break;
        }
        boolean found = false;
        for (Map.Entry<byte [], Cell> e: values.entrySet()) {
          if (Bytes.equals(e.getKey(), HConstants.COL_REGIONINFO)) {
            info = (HRegionInfo) Writables.getWritable(
              e.getValue().getValue(), info);
           
            if (Bytes.equals(info.getTableDesc().getName(), tableName)) {
View Full Code Here


      for(int i = 0; i < 5; i++)
        batchUpdate.put(COLUMN_FAMILY_STR+i, Bytes.toBytes(i));
     
      table.commit(batchUpdate);
     
      RowResult result = null;
      result = table.getRow(row,  new byte[][] {COLUMN_FAMILY});
      for(int i = 0; i < 5; i++)
        assertTrue(result.containsKey(Bytes.toBytes(COLUMN_FAMILY_STR+i)));
     
      result = table.getRow(row);
      for(int i = 0; i < 5; i++)
        assertTrue(result.containsKey(Bytes.toBytes(COLUMN_FAMILY_STR+i)));

      batchUpdate = new BatchUpdate(row);
      batchUpdate.put("info2:a", Bytes.toBytes("a"));
      table.commit(batchUpdate);
     
      result = table.getRow(row, new byte[][] { COLUMN_FAMILY,
          Bytes.toBytes("info2:a") });
      for(int i = 0; i < 5; i++)
        assertTrue(result.containsKey(Bytes.toBytes(COLUMN_FAMILY_STR+i)));
      assertTrue(result.containsKey(Bytes.toBytes("info2:a")));
  
    } catch (IOException e) {
      e.printStackTrace();
      fail("Should not have any exception " +
        e.getClass());
View Full Code Here

      HbaseMapWritable<byte [], Cell> cells =
        new HbaseMapWritable<byte [], Cell>();
      for (HStore s: stores.values()) {
        s.getFull(key, null, cells);
      }
      return new RowResult(key.getRow(), cells);
    } finally {
      splitsAndClosesLock.readLock().unlock();
    }
  }
View Full Code Here

    /** {@inheritDoc} */
    public RowResult next() throws IOException {
      if (this.closed) {
        return null;
      }
      RowResult values = null;
      do {
        values = getConnection().getRegionServerWithRetries(callable);
      } while ((values == null || values.size() == 0) && nextScanner());

      if (values != null && values.size() != 0) {
        return values;
      }
      return null;
    }
View Full Code Here

          }
         
          // if we get to here, then hasNext() has given us an item to return.
          // we want to return the item and then null out the next pointer, so
          // we use a temporary variable.
          RowResult temp = next;
          next = null;
          return temp;
        }

        public void remove() {
View Full Code Here

    List<ToDoEntry> toDoList = new ArrayList<ToDoEntry>();
    Set<HRegionInfo> regions = new HashSet<HRegionInfo>();
    List<byte []> emptyRows = new ArrayList<byte []>();
    try {
      while (true) {
        RowResult values = null;
        try {
          values = server.next(scannerId);
        } catch (IOException e) {
          LOG.error("Shutdown scanning of meta region",
            RemoteExceptionHandler.checkIOException(e));
          break;
        }
        if (values == null || values.size() == 0) {
          break;
        }
       
        byte [] row = values.getRow();
       
        if (LOG.isDebugEnabled() && row != null) {
          LOG.debug("shutdown scanner looking at " + row.toString());
        }

        // Check server name.  If null, be conservative and treat as though
        // region had been on shutdown server (could be null because we
        // missed edits in hlog because hdfs does not do write-append).
        String serverName = Writables.cellToString(values.get(COL_SERVER));
        if (serverName.length() > 0 &&
            deadServerName.compareTo(serverName) != 0) {
          // This isn't the server you're looking for - move along
          continue;
        }
View Full Code Here

      Scanner scanner = getScanner(id);
      if (scanner == null) {
        throw new IllegalArgument("scanner ID is invalid");
      }
     
      RowResult results = null;
     
      try {
        results = scanner.next();
        if (results == null) {
          throw new NotFound("end of scanner reached");
        }
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      }
     
      ScanEntry retval = new ScanEntry();
      retval.row = results.getRow();
      retval.columns = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
     
      for (Map.Entry<byte [], Cell> e : results.entrySet()) {
        retval.columns.put(e.getKey(), e.getValue().getValue());
      }
      return retval;
    }
View Full Code Here

      HRegion region = getRegion(regionName);
      Map<byte [], Cell> map = region.getFull(row, columnSet, ts);
      HbaseMapWritable<byte [], Cell> result =
        new HbaseMapWritable<byte [], Cell>();
      result.putAll(map);
      return new RowResult(row, result);
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
  }
View Full Code Here

    requestCount.incrementAndGet();
    try {
      // locate the region we're operating on
      HRegion region = getRegion(regionName);
      // ask the region for all the data
      RowResult rr = region.getClosestRowBefore(row);
      return rr;
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
View Full Code Here

        }

        // No data for this row, go get another.
        results.clear();
      }
      return values.size() == 0 ? null : new RowResult(key.getRow(), values);
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.RowResult

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.