Java Code Examples for org.apache.hadoop.hbase.replication.ReplicationPeerConfig#isSerial()
The following examples show how to use
org.apache.hadoop.hbase.replication.ReplicationPeerConfig#isSerial() .
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: ModifyPeerProcedure.java From hbase with Apache License 2.0 | 6 votes |
@VisibleForTesting protected void reopenRegions(MasterProcedureEnv env) throws IOException { ReplicationPeerConfig peerConfig = getNewPeerConfig(); ReplicationPeerConfig oldPeerConfig = getOldPeerConfig(); TableStateManager tsm = env.getMasterServices().getTableStateManager(); for (TableDescriptor td : env.getMasterServices().getTableDescriptors().getAll().values()) { if (!td.hasGlobalReplicationScope()) { continue; } TableName tn = td.getTableName(); if (!peerConfig.needToReplicate(tn)) { continue; } if (oldPeerConfig != null && oldPeerConfig.isSerial() && oldPeerConfig.needToReplicate(tn)) { continue; } if (needReopen(tsm, tn)) { addChildProcedure(new ReopenTableRegionsProcedure(tn)); } } }
Example 2
Source File: PeerProcedureHandlerImpl.java From hbase with Apache License 2.0 | 5 votes |
@Override public void updatePeerConfig(String peerId) throws ReplicationException, IOException { Lock peerLock = peersLock.acquireLock(peerId); ReplicationPeers peers = replicationSourceManager.getReplicationPeers(); ReplicationPeerImpl peer = null; ReplicationPeerConfig oldConfig = null; PeerState oldState = null; boolean success = false; try { peer = peers.getPeer(peerId); if (peer == null) { throw new ReplicationException("Peer with id=" + peerId + " is not cached."); } oldConfig = peer.getPeerConfig(); oldState = peer.getPeerState(); ReplicationPeerConfig newConfig = peers.refreshPeerConfig(peerId); // also need to refresh peer state here. When updating a serial replication peer we may // disable it first and then enable it. PeerState newState = peers.refreshPeerState(peerId); // RS need to start work with the new replication config change if (!ReplicationUtils.isNamespacesAndTableCFsEqual(oldConfig, newConfig) || oldConfig.isSerial() != newConfig.isSerial() || (oldState.equals(PeerState.ENABLED) && newState.equals(PeerState.DISABLED))) { replicationSourceManager.refreshSources(peerId); } success = true; } finally { if (!success && peer != null) { // Reset peer config if refresh source failed peer.setPeerConfig(oldConfig); peer.setPeerState(oldState.equals(PeerState.ENABLED)); } peerLock.unlock(); } }