use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class AsymmetricRemoteSyncTask method startSync.
public void startSync() {
InetAddressAndPort local = FBUtilities.getBroadcastAddressAndPort();
SyncRequest request = new SyncRequest(desc, local, nodePair.coordinator, nodePair.peer, rangesToSync, previewKind, true);
String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst);
Tracing.traceRepair(message);
MessagingService.instance().send(Message.out(SYNC_REQ, request), request.src);
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class IncrementalRepairTask method performUnsafe.
@Override
public Future<CoordinatedRepairResult> performUnsafe(ExecutorPlus executor) throws Exception {
// the local node also needs to be included in the set of participants, since coordinator sessions aren't persisted
Set<InetAddressAndPort> allParticipants = ImmutableSet.<InetAddressAndPort>builder().addAll(neighborsAndRanges.participants).add(FBUtilities.getBroadcastAddressAndPort()).build();
// Not necessary to include self for filtering. The common ranges only contains neighbhor node endpoints.
List<CommonRange> allRanges = neighborsAndRanges.filterCommonRanges(keyspace, cfnames);
CoordinatorSession coordinatorSession = ActiveRepairService.instance.consistent.coordinated.registerSession(parentSession, allParticipants, neighborsAndRanges.shouldExcludeDeadParticipants);
return coordinatorSession.execute(() -> runRepair(parentSession, true, executor, allRanges, cfnames));
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class LocalSyncTask method createStreamPlan.
@VisibleForTesting
StreamPlan createStreamPlan() {
InetAddressAndPort remote = nodePair.peer;
StreamPlan plan = new StreamPlan(StreamOperation.REPAIR, 1, false, pendingRepair, previewKind).listeners(this).flushBeforeTransfer(pendingRepair == null);
if (requestRanges) {
// see comment on RangesAtEndpoint.toDummyList for why we synthesize replicas here
plan.requestRanges(remote, desc.keyspace, RangesAtEndpoint.toDummyList(rangesToSync), RangesAtEndpoint.toDummyList(Collections.emptyList()), desc.columnFamily);
}
if (transferRanges) {
// send ranges to the remote node if we are not performing a pull repair
// see comment on RangesAtEndpoint.toDummyList for why we synthesize replicas here
plan.transferRanges(remote, desc.keyspace, RangesAtEndpoint.toDummyList(rangesToSync), desc.columnFamily);
}
return plan;
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class InboundConnectionSettings method withDefaults.
// note that connectTo is updated even if specified, in the case of pre40 messaging and using encryption (to update port)
public InboundConnectionSettings withDefaults() {
// this is for the socket that can be plain, only ssl, or optional plain/ssl
if (bindAddress.getPort() != DatabaseDescriptor.getStoragePort() && bindAddress.getPort() != DatabaseDescriptor.getSSLStoragePort())
throw new ConfigurationException(format("Local endpoint port %d doesn't match YAML configured port %d or legacy SSL port %d", bindAddress.getPort(), DatabaseDescriptor.getStoragePort(), DatabaseDescriptor.getSSLStoragePort()));
IInternodeAuthenticator authenticator = this.authenticator;
ServerEncryptionOptions encryption = this.encryption;
Integer socketReceiveBufferSizeInBytes = this.socketReceiveBufferSizeInBytes;
Integer applicationReceiveQueueCapacityInBytes = this.applicationReceiveQueueCapacityInBytes;
AcceptVersions acceptMessaging = this.acceptMessaging;
AcceptVersions acceptStreaming = this.acceptStreaming;
SocketFactory socketFactory = this.socketFactory;
Function<InetAddressAndPort, InboundMessageHandlers> handlersFactory = this.handlers;
if (authenticator == null)
authenticator = DatabaseDescriptor.getInternodeAuthenticator();
if (encryption == null)
encryption = DatabaseDescriptor.getInternodeMessagingEncyptionOptions();
if (socketReceiveBufferSizeInBytes == null)
socketReceiveBufferSizeInBytes = DatabaseDescriptor.getInternodeSocketReceiveBufferSizeInBytes();
if (applicationReceiveQueueCapacityInBytes == null)
applicationReceiveQueueCapacityInBytes = DatabaseDescriptor.getInternodeApplicationReceiveQueueCapacityInBytes();
if (acceptMessaging == null)
acceptMessaging = accept_messaging;
if (acceptStreaming == null)
acceptStreaming = accept_streaming;
if (socketFactory == null)
socketFactory = instance().socketFactory;
if (handlersFactory == null)
handlersFactory = instance()::getInbound;
Preconditions.checkArgument(socketReceiveBufferSizeInBytes == 0 || socketReceiveBufferSizeInBytes >= 1 << 10, "illegal socket send buffer size: " + socketReceiveBufferSizeInBytes);
Preconditions.checkArgument(applicationReceiveQueueCapacityInBytes >= 1 << 10, "illegal application receive queue capacity: " + applicationReceiveQueueCapacityInBytes);
return new InboundConnectionSettings(authenticator, bindAddress, encryption, socketReceiveBufferSizeInBytes, applicationReceiveQueueCapacityInBytes, acceptMessaging, acceptStreaming, socketFactory, handlersFactory);
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class SetHostStatWithPort method add.
public void add(String token, String host, Map<String, Float> ownerships) throws UnknownHostException {
InetAddressAndPort endpoint = InetAddressAndPort.getByName(host);
Float owns = ownerships.get(endpoint.getHostAddressAndPort());
hostStats.add(new HostStatWithPort(token, endpoint, resolveIp, owns));
}
Aggregations