Search in sources :

Example 1 with InconsistentReplicaSetNamesException

use of com.eightkdata.mongowp.exceptions.InconsistentReplicaSetNamesException in project torodb by torodb.

the class TopologyHeartbeatHandler method start.

CompletableFuture<Status<ReplicaSetConfig>> start(HostAndPort seed) {
    executor.addVersionChangeListener(versionChangeListener);
    return executor.onCurrentVersion().andThenApplyAsync(networkHandler.askForConfig(new RemoteCommandRequest<>(seed, "admin", Empty.getInstance())), (coord, remoteConfig) -> {
        Status<ReplicaSetConfig> result = remoteConfig.asStatus();
        if (!result.isOk()) {
            return result;
        }
        ReplicaSetConfig replConfig = result.getResult();
        try {
            checkRemoteReplSetConfig(replConfig);
            updateConfig(coord, replConfig);
            return result;
        } catch (InconsistentReplicaSetNamesException ex) {
            return Status.from(ex);
        }
    });
}
Also used : ReplicaSetConfig(com.torodb.mongodb.commands.pojos.ReplicaSetConfig) InconsistentReplicaSetNamesException(com.eightkdata.mongowp.exceptions.InconsistentReplicaSetNamesException) FromExceptionRemoteCommandRequest(com.eightkdata.mongowp.client.core.MongoConnection.FromExceptionRemoteCommandRequest)

Aggregations

FromExceptionRemoteCommandRequest (com.eightkdata.mongowp.client.core.MongoConnection.FromExceptionRemoteCommandRequest)1 InconsistentReplicaSetNamesException (com.eightkdata.mongowp.exceptions.InconsistentReplicaSetNamesException)1 ReplicaSetConfig (com.torodb.mongodb.commands.pojos.ReplicaSetConfig)1