Package org.apache.hadoop.hbase.io

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


          oldRegion1,
          oldRegion2
      };
      for(int r = 0; r < regionsToDelete.length; r++) {
        long lockid = Math.abs(rand.nextLong());
        BatchUpdate b = new BatchUpdate(lockid);
        lockid = b.startUpdate(regionsToDelete[r]);
        b.delete(lockid, COL_REGIONINFO);
        b.delete(lockid, COL_SERVER);
        b.delete(lockid, COL_STARTCODE);
        b.delete(lockid, COL_SPLITA);
        b.delete(lockid, COL_SPLITB);
        root.batchUpdate(HConstants.LATEST_TIMESTAMP, b);
        lockid = -1L;

        if(LOG.isDebugEnabled()) {
          LOG.debug("updated columns in row: " + regionsToDelete[r]);
        }
      }
      HRegionInfo newInfo = newRegion.getRegionInfo();
      newInfo.setOffline(true);
      long lockid = Math.abs(rand.nextLong());
      BatchUpdate b = new BatchUpdate(lockid);
      lockid = b.startUpdate(newRegion.getRegionName());
      b.put(lockid, COL_REGIONINFO, Writables.getBytes(newInfo));
      root.batchUpdate(System.currentTimeMillis(), b);
      if(LOG.isDebugEnabled()) {
        LOG.debug("updated columns in row: " + newRegion.getRegionName());
      }
    }
View Full Code Here


   * @throws IOException
   */
  static void offlineRegionInMETA(final HRegionInterface srvr,
      final Text metaRegionName, final HRegionInfo info)
  throws IOException {
    BatchUpdate b = new BatchUpdate(rand.nextLong());
    long lockid = b.startUpdate(info.getRegionName());
    info.setOffline(true);
    b.put(lockid, COL_REGIONINFO, Writables.getBytes(info));
    b.delete(lockid, COL_SERVER);
    b.delete(lockid, COL_STARTCODE);
    // If carrying splits, they'll be in place when we show up on new
    // server.
    srvr.batchUpdate(metaRegionName, b);
  }
View Full Code Here

    }

    protected void updateRegionInfo(HRegionInterface server, Text regionName,
        HRegionInfo i) throws IOException {

      BatchUpdate b = new BatchUpdate(rand.nextLong());
      long lockid = b.startUpdate(i.regionName);
      b.put(lockid, COL_REGIONINFO, Writables.getBytes(i));
      server.batchUpdate(regionName, System.currentTimeMillis(), b);
      if (LOG.isDebugEnabled()) {
        LOG.debug("updated columns in row: " + i.regionName);
      }
    }
View Full Code Here

   * @return Row lockid.
   */
  public synchronized long startUpdate(final Text row) {
    checkClosed();
    updateInProgress(false);
    batch.set(new BatchUpdate(rand.nextLong()));
    return batch.get().startUpdate(row);
  }
View Full Code Here

      // 3. Insert into meta
         
      HRegionInfo info = region.getRegionInfo();
      Text regionName = region.getRegionName();
      BatchUpdate b = new BatchUpdate(rand.nextLong());
      long lockid = b.startUpdate(regionName);
      b.put(lockid, COL_REGIONINFO, Writables.getBytes(info));
      server.batchUpdate(metaRegionName, System.currentTimeMillis(), b);

      // 4. Close the new region to flush it to disk.  Close its log file too.
     
      region.close();
View Full Code Here

        " because daughter splits no longer hold references");
        if (!HRegion.deleteRegion(fs, dir, parent.getRegionName())) {
          LOG.warn("Deletion of " + parent.getRegionName() + " failed");
        }
       
        BatchUpdate b = new BatchUpdate(rand.nextLong());
        long lockid = b.startUpdate(parent.getRegionName());
        b.delete(lockid, COL_REGIONINFO);
        b.delete(lockid, COL_SERVER);
        b.delete(lockid, COL_STARTCODE);
        srvr.batchUpdate(metaRegionName, System.currentTimeMillis(), b);
        result = true;
      } else if (LOG.isDebugEnabled()) {
        // If debug, note we checked and current state of daughters.
        LOG.debug("Checked " + parent.getRegionName() +
View Full Code Here

      if (LOG.isDebugEnabled()) {
        LOG.debug(split.getRegionName().toString()
            +" no longer has references to " + parent.toString());
      }
     
      BatchUpdate b = new BatchUpdate(rand.nextLong());
      long lockid = b.startUpdate(parent);
      b.delete(lockid, splitColumn);
      srvr.batchUpdate(metaRegionName, System.currentTimeMillis(), b);
       
      return result;
    }
View Full Code Here

        }
      }

      // Remove server from root/meta entries
      for (ToDoEntry e: toDoList) {
        BatchUpdate b = new BatchUpdate(rand.nextLong());
        long lockid = b.startUpdate(e.row);
        if (e.deleteRegion) {
          b.delete(lockid, COL_REGIONINFO);
        } else if (e.regionOffline) {
          e.info.offLine = true;
          b.put(lockid, COL_REGIONINFO, Writables.getBytes(e.info));
        }
        b.delete(lockid, COL_SERVER);
        b.delete(lockid, COL_STARTCODE);
        server.batchUpdate(regionName, System.currentTimeMillis(), b);
      }

      // Get regions reassigned
      for (Map.Entry<Text, HRegionInfo> e: regions.entrySet()) {
View Full Code Here

          metaRegionName = r.getRegionName();
          server = connection.getHRegionConnection(r.getServer());
        }

        try {
          BatchUpdate b = new BatchUpdate(rand.nextLong());
          long lockid = b.startUpdate(regionInfo.regionName);

          if (deleteRegion) {
            b.delete(lockid, COL_REGIONINFO);

          } else if (!reassignRegion ) {
            regionInfo.offLine = true;
            b.put(lockid, COL_REGIONINFO, Writables.getBytes(regionInfo));
          }
          b.delete(lockid, COL_SERVER);
          b.delete(lockid, COL_STARTCODE);
          server.batchUpdate(metaRegionName, System.currentTimeMillis(), b);

          break;

        } catch (IOException e) {
View Full Code Here

        LOG.info("updating row " + region.getRegionName() + " in table " +
          metaRegionName + " with startcode " +
          Writables.bytesToLong(this.startCode) + " and server "+
          serverAddress.toString());
        try {
          BatchUpdate b = new BatchUpdate(rand.nextLong());
          long lockid = b.startUpdate(region.getRegionName());
          b.put(lockid, COL_SERVER,
            Writables.stringToBytes(serverAddress.toString()));
          b.put(lockid, COL_STARTCODE, startCode);
          server.batchUpdate(metaRegionName, System.currentTimeMillis(), b);
          if (region.tableDesc.getName().equals(META_TABLE_NAME)) {
            // It's a meta region.
            MetaRegion m = new MetaRegion(this.serverAddress,
              this.region.regionName, this.region.startKey);
View Full Code Here

TOP

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

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.