Replicates all ASG status changes to peer eureka nodes except for
replication traffic to this node.
768991
private void replicateASGInfoToReplicaNodes(final String asgName,
                                                final ASGStatus newStatus, final PeerEurekaNode node) {
        CurrentRequestVersion.set(Version.V2);
        try {
            node.statusUpdate(asgName, newStatus);
        } catch (Throwable e) {
            logger.error("Cannot replicate ASG status information to {}", node.getServiceUrl(), e);
        }
    }
1041771
public static br_replicateconfig replicate(nitro_service client, br_replicateconfig resource) throws Exception
	{
		return ((br_replicateconfig[]) resource.perform_operation(client, "replicate"))[0];
	}
415356
def _update_rs_with_primary_from_member(
        sds,
        replica_set_name,
        server_description):
    
    assert replica_set_name is not None

    if replica_set_name != server_description.replica_set_name:
        sds.pop(server_description.address)
    elif (server_description.me and
          server_description.address != server_description.me):
        sds.pop(server_description.address)

    # Had this member been the primary?
    return _check_has_primary(sds)
1310861
def nodes_changed?(new_nodes)
      return true if address_for(@master) != new_nodes[:master]
      return true if different?(addresses_for(@slaves), new_nodes[:slaves])
      false
    end
455435
public void setReplicationInstancePrivateIpAddresses(java.util.Collection<String> replicationInstancePrivateIpAddresses) {
        if (replicationInstancePrivateIpAddresses == null) {
            this.replicationInstancePrivateIpAddresses = null;
            return;
        }

        this.replicationInstancePrivateIpAddresses = new java.util.ArrayList<String>(replicationInstancePrivateIpAddresses);
    }
1288233
@Override
    public boolean statusUpdate(final String appName, final String id,
                                final InstanceStatus newStatus, String lastDirtyTimestamp,
                                final boolean isReplication) {
        if (super.statusUpdate(appName, id, newStatus, lastDirtyTimestamp, isReplication)) {
            replicateToPeers(Action.StatusUpdate, appName, id, null, newStatus, isReplication);
            return true;
        }
        return false;
    }
917025
def refresh_peers(node, &block)
      node.peers.each do |node|
        if node.address.resolved
          block.call(node) unless seeds.include?(node)
          peers.push(node) unless peers.include?(node)
        end
      end
    end
1272512
private Observable<ProposedBucketConfigContext> refreshAgainstNode(final String bucketName,
        final NetworkAddress hostname) {
        final Credential credential = registrations().get(bucketName);
        if (credential == null) {
            LOGGER.debug("Ignoring refresh attempt since it seems the bucket registration is gone (closed).");
            return Observable.empty();
        }

        return Observable.defer(new Func0<Observable<BucketConfigResponse>>() {
            @Override
            public Observable<BucketConfigResponse> call() {
                return cluster()
                    .<BucketConfigResponse>send(new BucketConfigRequest(HttpLoader.TERSE_PATH, hostname, bucketName,
                        credential.username(), credential.password()))
                    .flatMap(new Func1<BucketConfigResponse, Observable<BucketConfigResponse>>() {
                        @Override
                        public Observable<BucketConfigResponse> call(BucketConfigResponse response) {
                            if (response.status().isSuccess()) {
                                LOGGER.debug("Successfully got config refresh from terse bucket remote.");
                                return Observable.just(response);
                            }

                            LOGGER.debug("Terse bucket config refresh failed, falling back to verbose.");
                            return cluster().send(
                                new BucketConfigRequest(HttpLoader.VERBOSE_PATH, hostname, bucketName,
                                    credential.username(), credential.password()));
                        }
                    });
            }
        }).map(new Func1<BucketConfigResponse, ProposedBucketConfigContext>() {
            @Override
            public ProposedBucketConfigContext call(final BucketConfigResponse response) {
                String config = response.config().replace("$HOST", hostname.address());
                return new ProposedBucketConfigContext(bucketName, config, hostname);
            }
        }).doOnError(new Action1<Throwable>() {
            @Override
            public void call(Throwable ex) {
                LOGGER.debug("Could not fetch config from bucket \"" + bucketName + "\" against \""
                    + hostname + "\".", ex);
            }
        });
    }
932441
private CompletableFuture<Void> replicateAndInvalidate(CacheTopology cacheTopology) {
      Address nextMember = getNextMember(cacheTopology);
      if (nextMember != null) {
         HashSet<Address> otherMembers = new HashSet<>(cacheTopology.getActualMembers());
         Address localAddress = rpcManager.getAddress();
         otherMembers.remove(localAddress);
         otherMembers.remove(nextMember);

         IntSet oldSegments;
         if (cacheTopology.getCurrentCH().getMembers().contains(localAddress)) {
            oldSegments = IntSets.from(cacheTopology.getCurrentCH().getSegmentsForOwner(localAddress));
            oldSegments.retainAll(cacheTopology.getPendingCH().getSegmentsForOwner(localAddress));
         } else {
            log.trace("Local address is not a member of currentCH, returning");
            return CompletableFutures.completedNull();
         }

         log.trace("Segments to replicate and invalidate: " + oldSegments);
         if (oldSegments.isEmpty()) {
            return CompletableFutures.completedNull();
         }

         // we'll start at 1, so the counter will never drop to 0 until we send all chunks
         AtomicInteger outboundInvalidations = new AtomicInteger(1);
         CompletableFuture<Void> outboundTaskFuture = new CompletableFuture<>();
         OutboundTransferTask outboundTransferTask = new OutboundTransferTask(nextMember, oldSegments,
            cacheTopology.getCurrentCH().getNumSegments(), chunkSize, cacheTopology.getTopologyId(), keyPartitioner,
            task -> {
               if (outboundInvalidations.decrementAndGet() == 0) {
                  outboundTaskFuture.complete(null);
               }
            }, chunks -> invalidateChunks(chunks, otherMembers, outboundInvalidations, outboundTaskFuture, cacheTopology),
            OutboundTransferTask::defaultMapEntryFromDataContainer, OutboundTransferTask::defaultMapEntryFromStore,
            dataContainer, persistenceManager, rpcManager, commandsFactory, entryFactory, timeout, cacheName, true, true);
         outboundTransferTask.execute(executorService);
         return outboundTaskFuture;
      } else {
         return CompletableFutures.completedNull();
      }
   }
696787
public synchronized long[] updateReplicas(List<Long> replicas, Map<Integer, Long> partitionMasters) {
        return updateReplicasInternal(replicas, partitionMasters, null);
    }
213660
@Override
    public int syncUp() {
        // Copy entire entry from neighboring DS node
        int count = 0;

        for (int i = 0; ((i < serverConfig.getRegistrySyncRetries()) && (count == 0)); i++) {
            if (i > 0) {
                try {
                    Thread.sleep(serverConfig.getRegistrySyncRetryWaitMs());
                } catch (InterruptedException e) {
                    logger.warn("Interrupted during registry transfer..");
                    break;
                }
            }
            Applications apps = eurekaClient.getApplications();
            for (Application app : apps.getRegisteredApplications()) {
                for (InstanceInfo instance : app.getInstances()) {
                    try {
                        if (isRegisterable(instance)) {
                            register(instance, instance.getLeaseInfo().getDurationInSecs(), true);
                            count++;
                        }
                    } catch (Throwable t) {
                        logger.error("During DS init copy", t);
                    }
                }
            }
        }
        return count;
    }
969454
def suspend(self, instance_id):
        '''
        
        '''
        nt_ks = self.compute_conn
        response = nt_ks.servers.suspend(instance_id)
        return True
381394
def heartbeat(self):
        
        pipeline = self.conn.pipeline()
        now = time.time()
        for replica in self.replicas:
            pipeline.zadd(self.key, '{start}:{name}'.format(
                start=replica[0],
                name=replica[1]
            ), now)
        ret = pipeline.execute()

        # Only notify the other nodes if we're not in the ring yet.
        if any(ret):
            self._notify()
1017
def _pause_all_nodes(self, max_thread_pool_size=0):
        
        failed = 0

        def _pause_specific_node(node):
            if not node.instance_id:
                log.warning("Node `%s` has no instance id."
                            " It is either already stopped, or"
                            " never created properly.  Not attempting"
                            " to stop it again.", node.name)
                return None
            try:
                return node.pause()
            except Exception as err:
                log.error(
                    "Could not stop node `%s` (instance ID `%s`): %s %s",
                    node.name, node.instance_id, err, err.__class__)
                node.update_ips()
                return None

        nodes = self.get_all_nodes()
        thread_pool = self._make_thread_pool(max_thread_pool_size)
        for node, state in zip(nodes, thread_pool.map(_pause_specific_node, nodes)):
            if state is None:
                failed += 1
            else:
                self.paused_nodes[node.name] = state

        return failed
983276
def on_view_change_complete(self):
        

        self.future_primaries_handler.set_node_state()

        if not self.replicas.all_instances_have_primary:
            raise LogicError(
                "{} Not all replicas have "
                "primaries: {}".format(self, self.replicas.primary_name_by_inst_id)
            )

        self._cancel(self._check_view_change_completed)

        for replica in self.replicas.values():
            replica.on_view_change_done()
        self.view_changer.last_completed_view_no = self.view_changer.view_no
        # Remove already ordered requests from requests list after view change
        # If view change happen when one half of nodes ordered on master
        # instance and backup but other only on master then we need to clear
        # requests list.  We do this to stop transactions ordering  on backup
        # replicas that have already been ordered on master.
        # Test for this case in plenum/test/view_change/
        # test_no_propagate_request_on_different_last_ordered_before_vc.py
        for replica in self.replicas.values():
            replica.clear_requests_and_fix_last_ordered()
        self.monitor.reset()
104693
public void collectUnfreshPeers(int expireTimeoutSec) {
    for (TrackedPeer peer : this.peers.values()) {
      if (!peer.isFresh(expireTimeoutSec)) {
        this.peers.remove(new PeerUID(peer.getAddress(), this.getHexInfoHash()));
      }
    }
  }
326749
private void removeFromReplicaLayer(final Node followedReplica) {
		final Node prev = NeoUtils.getPrevSingleNode(followedReplica,
				SocialGraphRelationshipType.GRAPHITY);
		final Node next = NeoUtils.getNextSingleNode(followedReplica,
				SocialGraphRelationshipType.GRAPHITY);

		// bridge the user replica in the replica layer
		prev.getSingleRelationship(SocialGraphRelationshipType.GRAPHITY,
				Direction.OUTGOING).delete();
		if (next != null) {
			next.getSingleRelationship(SocialGraphRelationshipType.GRAPHITY,
					Direction.INCOMING).delete();
			prev.createRelationshipTo(next,
					SocialGraphRelationshipType.GRAPHITY);
		}

		// remove the followship
		followedReplica.getSingleRelationship(
				SocialGraphRelationshipType.FOLLOW, Direction.INCOMING)
				.delete();

		// remove the replica node itself
		followedReplica.getSingleRelationship(
				SocialGraphRelationshipType.REPLICA, Direction.OUTGOING)
				.delete();
		followedReplica.delete();
	}