Package org.apache.hadoop.hbase.io

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


    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();
        // Check server name.  If null, skip (We used to consider it was on
        // shutdown server but that would mean that we'd reassign regions that
        // were already out being assigned, ones that were product of a split
        // that happened while the shutdown was being processed.
        String serverName = Writables.cellToString(values.get(COL_SERVER));
        if (serverName == null || !deadServerStr.equals(serverName)) {
          // This isn't the server you're looking for - move along
          continue;
        }
View Full Code Here


    try {
      regionServer = master.connection.getHRegionConnection(region.getServer());
      scannerId = regionServer.openScanner(region.getRegionName(),
        COLUMN_FAMILY_ARRAY, EMPTY_START_ROW, HConstants.LATEST_TIMESTAMP, null);
      while (true) {
        RowResult 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 serverName = Writables.cellToString(values.get(COL_SERVER));
        long startCode = Writables.cellToLong(values.get(COL_STARTCODE));

        // Note Region has been assigned.
        checkAssigned(info, serverName, startCode);
        if (isSplitParent(info)) {
          splitParents.put(info, values);
View Full Code Here

     */
    public RowResult[] next(int nbRows) throws IOException {
      // Collect values to be returned here
      ArrayList<RowResult> resultSets = new ArrayList<RowResult>(nbRows);
      for(int i = 0; i < nbRows; i++) {
        RowResult next = next();
        if (next != null) {
          resultSets.add(next);
        } else {
          break;
        }
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

      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

          HRegionInfo oldRegion = currentRegion;
          if (oldRegion != null) {
            startKey = oldRegion.getEndKey();
          }
          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) {
View Full Code Here

          HRegionLocation metaLocation = locateRegion(parentTable, metaKey);
          HRegionInterface server =
            getHRegionConnection(metaLocation.getServerAddress());

          // Query the root region for the location of the meta region
          RowResult regionInfoRow = server.getClosestRowBefore(
            metaLocation.getRegionInfo().getRegionName(), metaKey,
            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.");
          }
          if (regionInfo.isOffline()) {
            throw new RegionOfflineException("region offline: " +
              regionInfo.getRegionNameAsString());
          }
         
          String serverAddress =
            Writables.cellToString(regionInfoRow.get(COL_SERVER));
          if (serverAddress.equals("")) {
            throw new NoServerForRegionException("No server address listed " +
              "in " + Bytes.toString(parentTable) + " for region " +
              regionInfo.getRegionNameAsString());
          }
View Full Code Here

      callable = new ScannerCallable(connection, META_TABLE_NAME,
        COLUMN_FAMILY_ARRAY, startRow, LATEST_TIMESTAMP, null);
      // Open scanner
      connection.getRegionServerWithRetries(callable);
      try {
        RowResult r = null;
        do {
          RowResult[] rrs = connection.getRegionServerWithRetries(callable);
         
          if (rrs == null || rrs.length == 0 || rrs[0].size() == 0) {
            break;
View Full Code Here

      if (indexResult == null) {
        return null;
      }
      RowResult[] result = new RowResult[indexResult.length];
      for (int i = 0; i < indexResult.length; i++) {
        RowResult row = indexResult[i];
        byte[] baseRow = row.get(INDEX_BASE_ROW_COLUMN).getValue();
        LOG.debug("next index row [" + Bytes.toString(row.getRow())
            + "] -> base row [" + Bytes.toString(baseRow) + "]");
        HbaseMapWritable<byte[], Cell> colValues =
          new HbaseMapWritable<byte[], Cell>();
        if (columns != null && columns.length > 0) {
          LOG.debug("Going to base table for remaining columns");
          RowResult baseResult = IndexedTable.this.getRow(baseRow, columns);
         
          if (baseResult != null) {
            colValues.putAll(baseResult);
          }
        }
        for (Entry<byte[], Cell> entry : row.entrySet()) {
          byte[] col = entry.getKey();
          if (HStoreKey.matchingFamily(INDEX_COL_FAMILY_NAME, col)) {
            continue;
          }
          colValues.put(col, entry.getValue());
        }
        result[i] = new RowResult(baseRow, colValues);
      }
      return result;
    }
View Full Code Here

        public RowResult next() {
          if (!hasNext()) {
            return null;
          }
          RowResult temp = next;
          next = null;
          return temp;
        }

        public void remove() {
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.