/** * Get a randomly-chosen replication sink to replicate to. * * @return a replication sink to replicate to */ public synchronized SinkPeer getReplicationSink() throws IOException { if (endpoint.getLastRegionServerUpdate() > this.lastUpdateToPeers || sinks.isEmpty()) { LOG.info("Current list of sinks is out of date or empty, updating"); chooseSinks(); } if (sinks.isEmpty()) { throw new IOException("No replication sinks are available"); } ServerName serverName = sinks.get(random.nextInt(sinks.size())); return new SinkPeer(serverName, conn.getAdmin(serverName)); }
/** * Fix multiple assignment by doing silent closes on each RS hosting the region * and then force ZK unassigned node to OFFLINE to trigger assignment by * master. * * @param connection HBase connection to the cluster * @param region Region to undeploy * @param servers list of Servers to undeploy from */ public static void fixMultiAssignment(HConnection connection, HRegionInfo region, List<ServerName> servers) throws IOException, KeeperException, InterruptedException { HRegionInfo actualRegion = new HRegionInfo(region); // Close region on the servers silently for(ServerName server : servers) { closeRegionSilentlyAndWait(connection, server, actualRegion); } // Force ZK node to OFFLINE so master assigns forceOfflineInZK(connection.getAdmin(), actualRegion); }
private void replayToServer(HRegionInfo regionInfo, List<Entry> entries) throws IOException, ServiceException { if (entries.isEmpty()) return; Entry[] entriesArray = new Entry[entries.size()]; entriesArray = entries.toArray(entriesArray); AdminService.BlockingInterface remoteSvr = conn.getAdmin(getLocation().getServerName()); Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p = ReplicationProtbufUtil.buildReplicateWALEntryRequest(entriesArray); PayloadCarryingRpcController controller = rpcControllerFactory.newController(p.getSecond()); try { remoteSvr.replay(controller, p.getFirst()); } catch (ServiceException se) { throw ProtobufUtil.getRemoteException(se); } }
service = hConnection.getAdmin(sn); } catch (RetriesExhaustedException e) { if (e.getCause() != null && e.getCause() instanceof ConnectException) {
loc = hconn.getRegionLocation(tableName, row, true); BlockingInterface remoteSvr = hconn.getAdmin(loc.getServerName()); HRegionInfo region = loc.getRegionInfo(); try {
errors.progress(); try { BlockingInterface server = connection.getAdmin(rsinfo);