mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-24 14:38:45 +00:00
bug4811: use only newest master when multiple exist with equal names
This commit is contained in:
+7
-1
@@ -21,6 +21,7 @@ import com.sap.sailing.landscape.SailingAnalyticsProcess;
|
||||
import com.sap.sailing.landscape.SailingAnalyticsProcessConfigurationVariable;
|
||||
import com.sap.sailing.landscape.SailingReleaseRepository;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.landscape.Host;
|
||||
import com.sap.sse.landscape.Release;
|
||||
import com.sap.sse.landscape.ReleaseRepository;
|
||||
@@ -102,9 +103,14 @@ implements SailingAnalyticsProcess<ShardingKey> {
|
||||
|
||||
@Override
|
||||
public Release getVersion(Optional<Duration> optionalTimeout, Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase) throws Exception {
|
||||
// TODO see getRelease TODO note... we should try to obtain this from the REST API /gwt/status where we need to spread the buildversion info across fine-grained attributes
|
||||
return getRelease(SailingReleaseRepository.INSTANCE, optionalTimeout, optionalKeyName, privateKeyEncryptionPassphrase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getStartTimePoint(Optional<Duration> optionalTimeout) throws IOException, ParseException {
|
||||
final JSONObject status = getStatus(optionalTimeout);
|
||||
return TimePoint.of(((Number) status.get("start_time_millis")).longValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpeditionUdpPort(Optional<Duration> optionalTimeout, Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase)
|
||||
|
||||
@@ -552,7 +552,10 @@ public interface AwsLandscape<ShardingKey> extends Landscape<ShardingKey> {
|
||||
* specified by {@code tagName} and discovers all application server processes configured on it. These are then
|
||||
* grouped by {@link ApplicationProcess#getServerName(Optional, Optional, byte[]) server name}, and using
|
||||
* {@link ApplicationProcess#getMasterServerName(Optional)} the master/replica relationships between the processes with equal server
|
||||
* name are discovered. From this, an {@link ApplicationReplicaSet} is established per server name.
|
||||
* name are discovered. From this, an {@link ApplicationReplicaSet} is established per server name.<p>
|
||||
*
|
||||
* Should more than one master exist with equal server name, only the newest master is considered.
|
||||
*
|
||||
* @param optionalTimeout
|
||||
* an optional timeout for communicating with the application server(s) to try to read the application
|
||||
* configuration; used, e.g., as timeout during establishing SSH connections
|
||||
|
||||
+5
-1
@@ -1094,7 +1094,11 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
|
||||
// then applicationProcess is a replica in the serverName cluster:
|
||||
Util.addToValueSet(replicasByServerName, serverName, applicationProcess);
|
||||
} else {
|
||||
mastersByServerName.put(serverName, applicationProcess);
|
||||
// check if it's a new or else a newer master:
|
||||
if (!mastersByServerName.containsKey(serverName)
|
||||
|| mastersByServerName.get(serverName).getStartTimePoint(optionalTimeout).before(applicationProcess.getStartTimePoint(optionalTimeout))) {
|
||||
mastersByServerName.put(serverName, applicationProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -9,8 +9,11 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.landscape.AvailabilityZone;
|
||||
import com.sap.sse.landscape.Host;
|
||||
import com.sap.sse.landscape.Landscape;
|
||||
@@ -138,4 +141,6 @@ extends Process<RotatingFileBasedLog, MetricsT> {
|
||||
}
|
||||
|
||||
Release getVersion(Optional<Duration> optionalTimeout, Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase) throws Exception;
|
||||
|
||||
TimePoint getStartTimePoint(Optional<Duration> optionalTimeout) throws IOException, ParseException;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ import com.sap.sse.landscape.Host;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ProcessFactory<ShardingKey, MetricsT extends ApplicationProcessMetrics, ProcessT extends ApplicationProcess<ShardingKey, MetricsT, ProcessT>, HostT extends Host> {
|
||||
/**
|
||||
* @param additionalProperties
|
||||
* can be used to pass through values required for calling the {@link ApplicationProcess} subclass
|
||||
* constructor which may require more arguments than the ones that appear as fixed arguments
|
||||
* on this method.
|
||||
*/
|
||||
ProcessT createProcess(HostT host, int port, String serverDirectory, int telnetPort, String serverName,
|
||||
Map<String, Object> additionalProperties);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user