/** * Atomically bulk load several HFiles into an open region * @return true if successful, false is failed but recoverably (no action) * @throws ServiceException if failed unrecoverably */ @Override public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller, final BulkLoadHFileRequest request) throws ServiceException { try { checkOpen(); requestCount.increment(); Region region = getRegion(request.getRegion()); List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>(); for (FamilyPath familyPath: request.getFamilyPathList()) { familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(), familyPath.getPath())); } boolean bypass = false; if (region.getCoprocessorHost() != null) { bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths); } boolean loaded = false; if (!bypass) { loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum(), null); } if (region.getCoprocessorHost() != null) { loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded); } BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder(); builder.setLoaded(loaded); return builder.build(); } catch (IOException ie) { throw new ServiceException(ie); } }
/** * A helper to bulk load a list of HFiles using client protocol. * * @param client * @param familyPaths * @param regionName * @param assignSeqNum * @return true if all are loaded * @throws IOException */ public static boolean bulkLoadHFile(final ClientService.BlockingInterface client, final List<Pair<byte[], String>> familyPaths, final byte[] regionName, boolean assignSeqNum) throws IOException { BulkLoadHFileRequest request = RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum); try { BulkLoadHFileResponse response = client.bulkLoadHFile(null, request); return response.getLoaded(); } catch (ServiceException se) { throw getRemoteException(se); } }
/** * Atomically bulk load several HFiles into an open region * * @return true if successful, false is failed but recoverably (no action) * @throws IOException if failed unrecoverably */ @Override public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller, final BulkLoadHFileRequest request) throws ServiceException { try { checkOpen(); requestCount.increment(); HRegion region = getRegion(request.getRegion()); List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>(); for (FamilyPath familyPath : request.getFamilyPathList()) { familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(), familyPath.getPath())); } boolean bypass = false; if (region.getCoprocessorHost() != null) { bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths); } boolean loaded = false; if (!bypass) { loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum()); } if (region.getCoprocessorHost() != null) { loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded); } BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder(); builder.setLoaded(loaded); return builder.build(); } catch (IOException ie) { throw new ServiceException(ie); } }
/** * Atomically bulk load several HFiles into an open region * @return true if successful, false is failed but recoverably (no action) * @throws IOException if failed unrecoverably */ @Override public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller, final BulkLoadHFileRequest request) throws ServiceException { try { checkOpen(); requestCount.increment(); HRegion region = getRegion(request.getRegion()); List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>(); for (FamilyPath familyPath: request.getFamilyPathList()) { familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(), familyPath.getPath())); } boolean bypass = false; if (region.getCoprocessorHost() != null) { bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths); } boolean loaded = false; if (!bypass) { loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum()); } if (region.getCoprocessorHost() != null) { loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded); } BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder(); builder.setLoaded(loaded); return builder.build(); } catch (IOException ie) { throw new ServiceException(ie); } }
/** * A helper to bulk load a list of HFiles using client protocol. * * @param client * @param familyPaths * @param regionName * @param assignSeqNum * @param controller * @return true if all are loaded * @throws IOException */ public static boolean bulkLoadHFile(final ClientService.BlockingInterface client, final List<Pair<byte[], String>> familyPaths, final byte[] regionName, boolean assignSeqNum, PayloadCarryingRpcController controller) throws IOException { BulkLoadHFileRequest request = RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum); try { BulkLoadHFileResponse response = client.bulkLoadHFile(controller, request); return response.getLoaded(); } catch (ServiceException se) { throw getRemoteException(se); } }
/** * Atomically bulk load several HFiles into an open region * @return true if successful, false is failed but recoverably (no action) * @throws IOException if failed unrecoverably */ @Override public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller, final BulkLoadHFileRequest request) throws ServiceException { try { requestCount.increment(); HRegion region = getRegion(request.getRegion()); List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>(); for (FamilyPath familyPath: request.getFamilyPathList()) { familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(), familyPath.getPath())); } boolean bypass = false; if (region.getCoprocessorHost() != null) { bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths); } boolean loaded = false; if (!bypass) { loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum()); } if (region.getCoprocessorHost() != null) { loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded); } BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder(); builder.setLoaded(loaded); return builder.build(); } catch (IOException ie) { throw new ServiceException(ie); } }
/** * A helper to bulk load a list of HFiles using client protocol. * * @param client * @param familyPaths * @param regionName * @param assignSeqNum * @return true if all are loaded * @throws IOException */ public static boolean bulkLoadHFile(final ClientProtocol client, final List<Pair<byte[], String>> familyPaths, final byte[] regionName, boolean assignSeqNum) throws IOException { BulkLoadHFileRequest request = RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum); try { BulkLoadHFileResponse response = client.bulkLoadHFile(null, request); return response.getLoaded(); } catch (ServiceException se) { throw getRemoteException(se); } }
@Override public BulkLoadHFileResponse bulkLoadHFile(RpcController controller, BulkLoadHFileRequest request) throws ServiceException { // TODO Auto-generated method stub return null; }
@Override public BulkLoadHFileResponse bulkLoadHFile( RpcController controller, BulkLoadHFileRequest request) throws ServiceException { throw new NotImplementedException(); }