Package org.apache.hadoop.hbase.io

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


          regionServer.openScanner(region.getRegionName(), COLUMN_FAMILY_ARRAY,
              EMPTY_START_ROW, System.currentTimeMillis(), null);

        int numberOfRegionsFound = 0;
        while (true) {
          HbaseMapWritable values = regionServer.next(scannerId);
          if (values == null || values.size() == 0) {
            break;
          }

          // TODO: Why does this have to be a sorted map?
          RowMap m = toRowMap(values);
View Full Code Here


          COLUMN_FAMILY_ARRAY, tableName, LATEST_TIMESTAMP,
          null);
       
        // iterate through the scanner, accumulating unique table names
        SCANNER_LOOP: while (true) {
          HbaseMapWritable values = server.next(scannerId);
          if (values == null || values.size() == 0) {
            break;
          }
          for (Map.Entry<Writable, Writable> e: values.entrySet()) {
            HStoreKey key = (HStoreKey) e.getKey();
            if (key.getColumn().equals(COL_REGIONINFO)) {
              HRegionInfo info = new HRegionInfo();
              info = (HRegionInfo) Writables.getWritable(
                  ((ImmutableBytesWritable) e.getValue()).get(), info);
View Full Code Here

   * @throws IOException
   */
  public SortedMap<Text, byte[]> getRow(final Text row, final long ts)
  throws IOException {
    checkClosed();
    HbaseMapWritable value = null;
        
    value = getRegionServerWithRetries(new ServerCallable<HbaseMapWritable>(row) {
      public HbaseMapWritable call() throws IOException {
        return server.getRow(location.getRegionInfo().getRegionName(), row, ts);
      }
    });
   
    SortedMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
    if (value != null && value.size() != 0) {
      for (Map.Entry<Writable, Writable> e: value.entrySet()) {
        HStoreKey key = (HStoreKey) e.getKey();
        results.put(key.getColumn(),
            ((ImmutableBytesWritable) e.getValue()).get());
      }
    }
View Full Code Here

    throws IOException {
      checkClosed();
      if (this.closed) {
        return false;
      }
      HbaseMapWritable values = null;
      // Clear the results so we don't inherit any values from any previous
      // calls to next.
      results.clear();
      do {
        values = server.next(scannerId);
      } while (values != null && values.size() == 0 && nextScanner());

      if (values != null && values.size() != 0) {
        for (Map.Entry<Writable, Writable> e: values.entrySet()) {
          HStoreKey k = (HStoreKey) e.getKey();
          key.setRow(k.getRow());
          key.setVersion(k.getTimestamp());
          key.setColumn(EMPTY_COLUMN);
          results.put(k.getColumn(),
              ((ImmutableBytesWritable) e.getValue()).get());
        }
      }
      return values == null ? false : values.size() != 0;
    }
View Full Code Here

      long scannerId = -1L;
      try {
        scannerId =
          server.openScanner(firstMetaServer.getRegionInfo().getRegionName(),
            COL_REGIONINFO_ARRAY, tableName, System.currentTimeMillis(), null);
        HbaseMapWritable values = server.next(scannerId);
        if (values == null || values.size() == 0) {
          break;
        }
        boolean found = false;
        for (Map.Entry<Writable, Writable> e: values.entrySet()) {
          HStoreKey key = (HStoreKey) e.getKey();
          if (key.getColumn().equals(COL_REGIONINFO)) {
            info = (HRegionInfo) Writables.getWritable(
                  ((ImmutableBytesWritable) e.getValue()).get(), info);
           
View Full Code Here

          server.openScanner(firstMetaServer.getRegionInfo().getRegionName(),
            COL_REGIONINFO_ARRAY, tableName, System.currentTimeMillis(), null);
        boolean isenabled = false;
       
        while (true) {
          HbaseMapWritable values = server.next(scannerId);
          if (values == null || values.size() == 0) {
            if (valuesfound == 0) {
              throw new NoSuchElementException(
                  "table " + tableName + " not found");
            }
            break;
          }
          valuesfound += 1;
          for (Map.Entry<Writable, Writable> e: values.entrySet()) {
            HStoreKey key = (HStoreKey) e.getKey();
            if (key.getColumn().equals(COL_REGIONINFO)) {
              info = (HRegionInfo) Writables.getWritable(
                    ((ImmutableBytesWritable) e.getValue()).get(), info);
           
View Full Code Here

          server.openScanner(firstMetaServer.getRegionInfo().getRegionName(),
            COL_REGIONINFO_ARRAY, tableName, System.currentTimeMillis(), null);
       
        boolean disabled = false;
        while (true) {
          HbaseMapWritable values = server.next(scannerId);
          if (values == null || values.size() == 0) {
            if (valuesfound == 0) {
              throw new NoSuchElementException("table " + tableName + " not found");
            }
            break;
          }
          valuesfound += 1;
          for (Map.Entry<Writable, Writable> e: values.entrySet()) {
            HStoreKey key = (HStoreKey) e.getKey();
            if (key.getColumn().equals(COL_REGIONINFO)) {
              info = (HRegionInfo) Writables.getWritable(
                    ((ImmutableBytesWritable) e.getValue()).get(), info);
           
View Full Code Here

              COLUMN_FAMILY_ARRAY, startRow, LATEST_TIMESTAMP,
              null);

            // iterate through the scanner, accumulating unique table names
            while (true) {
              HbaseMapWritable values = server.next(scannerId);
              if (values == null || values.size() == 0) {
                break;
              }
              for (Map.Entry<Writable, Writable> e: values.entrySet()) {
                HStoreKey key = (HStoreKey) e.getKey();
                if (key.getColumn().equals(COL_REGIONINFO)) {
                  HRegionInfo info = new HRegionInfo();
                  info = (HRegionInfo) Writables.getWritable(
                      ((ImmutableBytesWritable) e.getValue()).get(), info);
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
          HbaseMapWritable regionInfoRow = server.getClosestRowBefore(
            metaLocation.getRegionInfo().getRegionName(), metaKey);

          if (regionInfoRow == null) {
            throw new TableNotFoundException("Table '" + tableName +
              "' does not exist.");
View Full Code Here

      List<ToDoEntry> toDoList = new ArrayList<ToDoEntry>();
      Set<HRegionInfo> regions = new HashSet<HRegionInfo>();
      List<Text> emptyRows = new ArrayList<Text>();
      try {
        while (true) {
          HbaseMapWritable 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;
          }
          // TODO: Why does this have to be a sorted map?
          RowMap rm = toRowMap(values);
          Text row = rm.getRow();
View Full Code Here

TOP

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

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.