org.apache.hadoop.hbase.regionserver.Region.Operation Java Examples

The following examples show how to use org.apache.hadoop.hbase.regionserver.Region.Operation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RangerAuthorizationCoprocessor.java    From ranger with Apache License 2.0 6 votes vote down vote up
@Override
public void postStartRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx,	Operation operation) throws IOException {
	if(LOG.isDebugEnabled()) {
		LOG.debug("==> RangerAuthorizationCoprocessor.postStartRegionOperation()");
	}

	try {
		activatePluginClassLoader();
		implRegionObserver.postStartRegionOperation(ctx, operation);
	} finally {
		deactivatePluginClassLoader();
	}

	if(LOG.isDebugEnabled()) {
		LOG.debug("<== RangerAuthorizationCoprocessor.postStartRegionOperation()");
	}
}
 
Example #2
Source File: RangerAuthorizationCoprocessor.java    From ranger with Apache License 2.0 6 votes vote down vote up
@Override
public void postCloseRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx, Operation operation) throws IOException {
	if(LOG.isDebugEnabled()) {
		LOG.debug("==> RangerAuthorizationCoprocessor.postCloseRegionOperation()");
	}

	try {
		activatePluginClassLoader();
		implRegionObserver.postCloseRegionOperation(ctx, operation);
	} finally {
		deactivatePluginClassLoader();
	}

	if(LOG.isDebugEnabled()) {
		LOG.debug("<== RangerAuthorizationCoprocessor.postCloseRegionOperation()");
	}
}
 
Example #3
Source File: RegionCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postStartRegionOperation(final Operation op) throws IOException {
  execOperation(coprocEnvironments.isEmpty()? null:
      new RegionObserverOperationWithoutResult() {
    @Override
    public void call(RegionObserver observer) throws IOException {
      observer.postStartRegionOperation(this, op);
    }
  });
}
 
Example #4
Source File: RegionCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postCloseRegionOperation(final Operation op) throws IOException {
  execOperation(coprocEnvironments.isEmpty()? null:
      new RegionObserverOperationWithoutResult() {
    @Override
    public void call(RegionObserver observer) throws IOException {
      observer.postCloseRegionOperation(this, op);
    }
  });
}
 
Example #5
Source File: SimpleRegionObserver.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void postCloseRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
    Operation op) throws IOException {
  if (ctPostStartRegionOperation.get() > 0) {
    ctPostCloseRegionOperation.incrementAndGet();
  }
}
 
Example #6
Source File: FlushSnapshotSubprocedure.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public Void call() throws Exception {
  // Taking the region read lock prevents the individual region from being closed while a
  // snapshot is in progress.  This is helpful but not sufficient for preventing races with
  // snapshots that involve multiple regions and regionservers.  It is still possible to have
  // an interleaving such that globally regions are missing, so we still need the verification
  // step.
  LOG.debug("Starting snapshot operation on " + region);
  region.startRegionOperation(Operation.SNAPSHOT);
  try {
    if (skipFlush) {
    /*
     * This is to take an online-snapshot without force a coordinated flush to prevent pause
     * The snapshot type is defined inside the snapshot description. FlushSnapshotSubprocedure
     * should be renamed to distributedSnapshotSubprocedure, and the flush() behavior can be
     * turned on/off based on the flush type.
     * To minimized the code change, class name is not changed.
     */
      LOG.debug("take snapshot without flush memstore first");
    } else {
      LOG.debug("Flush Snapshotting region " + region.toString() + " started...");
      boolean succeeded = false;
      long readPt = region.getReadPoint(IsolationLevel.READ_COMMITTED);
      for (int i = 0; i < MAX_RETRIES; i++) {
        FlushResult res = region.flush(true);
        if (res.getResult() == FlushResult.Result.CANNOT_FLUSH) {
          // CANNOT_FLUSH may mean that a flush is already on-going
          // we need to wait for that flush to complete
          region.waitForFlushes();
          if (region.getMaxFlushedSeqId() >= readPt) {
            // writes at the start of the snapshot have been persisted
            succeeded = true;
            break;
          }
        } else {
          succeeded = true;
          break;
        }
      }
      if (!succeeded) {
        throw new IOException("Unable to complete flush after " + MAX_RETRIES + " attempts");
      }
    }
    region.addRegionToSnapshot(snapshotDesc, monitor);
    if (skipFlush) {
      LOG.debug("... SkipFlush Snapshotting region " + region.toString() + " completed.");
    } else {
      LOG.debug("... Flush Snapshotting region " + region.toString() + " completed.");
    }
  } finally {
    LOG.debug("Closing snapshot operation on " + region);
    region.closeRegionOperation(Operation.SNAPSHOT);
  }
  return null;
}
 
Example #7
Source File: SimpleRegionObserver.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public void postStartRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
    Operation op) throws IOException {
  ctPostStartRegionOperation.incrementAndGet();
}
 
Example #8
Source File: DelegateRegionObserver.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void postStartRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx,
        Operation operation) throws IOException {
    delegate.postStartRegionOperation(ctx, operation);
}
 
Example #9
Source File: DelegateRegionObserver.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void postCloseRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx,
        Operation operation) throws IOException {
    delegate.postCloseRegionOperation(ctx, operation);
}
 
Example #10
Source File: RegionObserver.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * This will be called for region operations where read lock is acquired in
 * {@link Region#startRegionOperation()}.
 * @param ctx
 * @param operation The operation is about to be taken on the region
 */
default void postStartRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx,
    Operation operation) throws IOException {}
 
Example #11
Source File: RegionObserver.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Called after releasing read lock in {@link Region#closeRegionOperation()}.
 * @param ctx
 * @param operation
 */
default void postCloseRegionOperation(ObserverContext<RegionCoprocessorEnvironment> ctx,
    Operation operation) throws IOException {}