Java 类org.apache.hadoop.hbase.procedure.Procedure 实例源码

项目:ditb    文件:MasterFlushTableProcedureManager.java   
@Override
public synchronized boolean isProcedureDone(ProcedureDescription desc) throws IOException {
  // Procedure instance name is the table name.
  TableName tableName = TableName.valueOf(desc.getInstance());
  Procedure proc = procMap.get(tableName);
  if (proc == null) {
    // The procedure has not even been started yet.
    // The client would request the procedure and call isProcedureDone().
    // The HBaseAdmin.execProcedure() wraps both request and isProcedureDone().
    return false;
  }
  // We reply on the existing Distributed Procedure framework to give us the status.
  return proc.isCompleted();
}
项目:pbase    文件:MasterFlushTableProcedureManager.java   
@Override
public synchronized boolean isProcedureDone(ProcedureDescription desc) throws IOException {
  // Procedure instance name is the table name.
  TableName tableName = TableName.valueOf(desc.getInstance());
  Procedure proc = procMap.get(tableName);
  if (proc == null) {
    // The procedure has not even been started yet.
    // The client would request the procedure and call isProcedureDone().
    // The HBaseAdmin.execProcedure() wraps both request and isProcedureDone().
    return false;
  }
  // We reply on the existing Distributed Procedure framework to give us the status.
  return proc.isCompleted();
}
项目:hbase    文件:MasterFlushTableProcedureManager.java   
@Override
public synchronized boolean isProcedureDone(ProcedureDescription desc) throws IOException {
  // Procedure instance name is the table name.
  TableName tableName = TableName.valueOf(desc.getInstance());
  Procedure proc = procMap.get(tableName);
  if (proc == null) {
    // The procedure has not even been started yet.
    // The client would request the procedure and call isProcedureDone().
    // The HBaseAdmin.execProcedure() wraps both request and isProcedureDone().
    return false;
  }
  // We reply on the existing Distributed Procedure framework to give us the status.
  return proc.isCompleted();
}
项目:PyroDB    文件:MasterFlushTableProcedureManager.java   
@Override
public synchronized boolean isProcedureDone(ProcedureDescription desc) throws IOException {
  // Procedure instance name is the table name.
  TableName tableName = TableName.valueOf(desc.getInstance());
  Procedure proc = procMap.get(tableName);
  if (proc == null) {
    // The procedure has not even been started yet.
    // The client would request the procedure and call isProcedureDone().
    // The HBaseAdmin.execProcedure() wraps both request and isProcedureDone().
    return false;
  }
  // We reply on the existing Distributed Procedure framework to give us the status.
  return proc.isCompleted();
}
项目:ditb    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = ClientSnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:LCIndex-HBase-0.94.16    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = SnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:pbase    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = ClientSnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:HIndex    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = ClientSnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:IRIndex    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = SnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:hbase    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = ClientSnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
      ProtobufUtil.createSnapshotDesc(expected));
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:PyroDB    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = ClientSnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:c5    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = ClientSnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:HBase-Research    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = SnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:hbase-0.94.8-qod    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = SnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:hbase-0.94.8-qod    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = SnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}
项目:hindex    文件:SnapshotManager.java   
/**
 * Check if the specified snapshot is done
 *
 * @param expected
 * @return true if snapshot is ready to be restored, false if it is still being taken.
 * @throws IOException IOException if error from HDFS or RPC
 * @throws UnknownSnapshotException if snapshot is invalid or does not exist.
 */
public boolean isSnapshotDone(SnapshotDescription expected) throws IOException {
  // check the request to make sure it has a snapshot
  if (expected == null) {
    throw new UnknownSnapshotException(
       "No snapshot name passed in request, can't figure out which snapshot you want to check.");
  }

  String ssString = SnapshotDescriptionUtils.toString(expected);

  // check to see if the sentinel exists,
  // and if the task is complete removes it from the in-progress snapshots map.
  SnapshotSentinel handler = removeSentinelIfFinished(this.snapshotHandlers, expected);

  // stop tracking "abandoned" handlers
  cleanupSentinels();

  if (handler == null) {
    // If there's no handler in the in-progress map, it means one of the following:
    //   - someone has already requested the snapshot state
    //   - the requested snapshot was completed long time ago (cleanupSentinels() timeout)
    //   - the snapshot was never requested
    // In those cases returns to the user the "done state" if the snapshots exists on disk,
    // otherwise raise an exception saying that the snapshot is not running and doesn't exist.
    if (!isSnapshotCompleted(expected)) {
      throw new UnknownSnapshotException("Snapshot " + ssString
          + " is not currently running or one of the known completed snapshots.");
    }
    // was done, return true;
    return true;
  }

  // pass on any failure we find in the sentinel
  try {
    handler.rethrowExceptionIfFailed();
  } catch (ForeignException e) {
    // Give some procedure info on an exception.
    String status;
    Procedure p = coordinator.getProcedure(expected.getName());
    if (p != null) {
      status = p.getStatus();
    } else {
      status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
    }
    throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status, e,
        expected);
  }

  // check to see if we are done
  if (handler.isFinished()) {
    LOG.debug("Snapshot '" + ssString + "' has completed, notifying client.");
    return true;
  } else if (LOG.isDebugEnabled()) {
    LOG.debug("Snapshoting '" + ssString + "' is still in progress!");
  }
  return false;
}