use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method setCleanerChoreRunning.
@Override
public SetCleanerChoreRunningResponse setCleanerChoreRunning(RpcController c, SetCleanerChoreRunningRequest req) throws ServiceException {
try {
master.checkInitialized();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
boolean prevValue = master.getLogCleaner().getEnabled() && master.getHFileCleaner().getEnabled();
master.getLogCleaner().setEnabled(req.getOn());
master.getHFileCleaner().setEnabled(req.getOn());
return SetCleanerChoreRunningResponse.newBuilder().setPrevValue(prevValue).build();
}
use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method snapshot.
/**
* Triggers an asynchronous attempt to take a snapshot.
* {@inheritDoc}
*/
@Override
public SnapshotResponse snapshot(RpcController controller, SnapshotRequest request) throws ServiceException {
try {
master.checkInitialized();
master.snapshotManager.checkSnapshotSupport();
LOG.info(master.getClientIdAuditPrefix() + " snapshot request for:" + ClientSnapshotDescriptionUtils.toString(request.getSnapshot()));
// get the snapshot information
SnapshotDescription snapshot = SnapshotDescriptionUtils.validate(request.getSnapshot(), master.getConfiguration());
master.snapshotManager.takeSnapshot(snapshot);
// send back the max amount of time the client should wait for the snapshot to complete
long waitTime = SnapshotDescriptionUtils.getMaxMasterTimeout(master.getConfiguration(), snapshot.getType(), SnapshotDescriptionUtils.DEFAULT_MAX_WAIT_TIME);
return SnapshotResponse.newBuilder().setExpectedTimeout(waitTime).build();
} catch (ForeignException e) {
throw new ServiceException(e.getCause());
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method getClusterStatus.
@Override
public GetClusterStatusResponse getClusterStatus(RpcController controller, GetClusterStatusRequest req) throws ServiceException {
GetClusterStatusResponse.Builder response = GetClusterStatusResponse.newBuilder();
try {
master.checkInitialized();
response.setClusterStatus(ProtobufUtil.convert(master.getClusterStatus()));
} catch (IOException e) {
throw new ServiceException(e);
}
return response.build();
}
use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method getReplicationPeerConfig.
@Override
public GetReplicationPeerConfigResponse getReplicationPeerConfig(RpcController controller, GetReplicationPeerConfigRequest request) throws ServiceException {
GetReplicationPeerConfigResponse.Builder response = GetReplicationPeerConfigResponse.newBuilder();
try {
String peerId = request.getPeerId();
ReplicationPeerConfig peerConfig = master.getReplicationPeerConfig(peerId);
response.setPeerId(peerId);
response.setPeerConfig(ReplicationSerDeHelper.convert(peerConfig));
} catch (ReplicationException | IOException e) {
throw new ServiceException(e);
}
return response.build();
}
use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method deleteSnapshot.
/**
* Execute Delete Snapshot operation.
* @return DeleteSnapshotResponse (a protobuf wrapped void) if the snapshot existed and was
* deleted properly.
* @throws ServiceException wrapping SnapshotDoesNotExistException if specified snapshot did not
* exist.
*/
@Override
public DeleteSnapshotResponse deleteSnapshot(RpcController controller, DeleteSnapshotRequest request) throws ServiceException {
try {
master.checkInitialized();
master.snapshotManager.checkSnapshotSupport();
LOG.info(master.getClientIdAuditPrefix() + " delete " + request.getSnapshot());
master.snapshotManager.deleteSnapshot(request.getSnapshot());
return DeleteSnapshotResponse.newBuilder().build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
Aggregations