Package com.illumon.iris.controller
Class PersistentQueryController
java.lang.Object
com.fishlib.util.process.OnetimeShutdownTask
com.illumon.iris.controller.PersistentQueryController
- All Implemented Interfaces:
com.fishlib.util.process.ShutdownManager.Task
public final class PersistentQueryController
extends com.fishlib.util.process.OnetimeShutdownTask
Stand-alone controller for Iris.
Hosts a configuration PHT, a state PDHT, monitors server status, and dispatches stop/start commands.
Thread-safety notes:
- All changes to IrisQueryInfos are protected by the lock on the associated PDHT's map.
- All PersistentQueryConfiguration instances that are published (in the associated PHT or PersistentQueryInfo) are guaranteed not to be further mutated. Hence, they can be read safely at all times.
- All changes to a PersistentQueryConfiguration (by serial, not by instance, since published instances are immutable) are protected by a serial-specific lock. Query starts/stops are also protected, since they must always use the most up-to-date version of the configuration.
Configuration properties
- PersistentQueryController.port - The port for communication
- PersistentQueryController.useLocalGit (optional) - When set to true use the local filesystem as a repository
- PersistentQueryController.gitGcEnabled (optional) - When set to true a git gc will be periodically performed
- PersistentQueryController.statusCheckTimes - When an AnomalyClient is used, defines the times to check in with status
- PersistentQueryController.failureWindowMillis - How long failures are queued
- PersistentQueryController.failureNumQueriesThreshold - How many failures are required before notifying the AnomalyClient
- PersistentQueryController.failureResendMillis - The minimum gap between failure messages
- PersistentQueryController.commitCheckpointImmediate (optional) - Immediately checkpoint the PDHT state on startup
- RemoteProcessingRequestProfile.defaultProfile - The default JVM args profile to use
- RemoteProcessingRequestProfile.noneProfile - The JVM profile to use when "None" is selected
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final int
static final double
static final long
static final long
static final int
How long will we wait for our etcd election lease to be granted or renewed, in milliseconds before determining that we had a failure.static final int
What is the maximum frequency which we will try to renew an election lease.static final int
How often, in seconds, do we renew our etcd lease for leader election.static final int
How long does our etcd lease for leader election last, in seconds? If we do not renew the lease for this many seconds, then etcd will automatically revoke it, and we will lose our leadership and our registration in dh-resolver will be removed.static final int
static final int
How long in seconds the controller wait to load existing worker state.static final int
How long will we wait for our etcd PQ State lease to be granted or renewed, in milliseconds before determining that we had a failure.static final int
What is the maximum frequency which we will try to renew a PQ State lease.static final int
How often, in seconds, do we renew our etcd lease for PQ State KVs.static final int
How long does our etcd lease for PQ state last, in seconds? If we do not renew the lease for this many seconds, then etcd will automatically revoke it, and our presence KV will be removed.static final int
static final int
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionPersistentQueryController
(String processNameForLogging, String processInfoId, AuditEventLogger auditEventLogger, PersistentQueryStateLogger stateLogLogger, PersistentQueryConfigurationLogger configurationLogLogger, ResourceUtilizationLogger resourceUtilizationLogger, QueryUserAssignmentLogger queryUserAssignmentLogger, io.deephaven.enterprise.niowrapper.sched.Scheduler scheduler, io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, io.deephaven.enterprise.ProcessStatusReporter chatBotClient, ScriptPathLoaderManager scriptPathLoaderManager, String errorEmailRecipientAddress, IrisGroupProvider irisGroupProvider, ScheduledExecutorService executorService, AuthenticationClient authClient, Function<String, PublicPrivateKeyEncryption> encryptionFactory, ControllerDispatcherHandler.ConnectionFactory dispatcherConnectionFactory, io.deephaven.shadow.jetcd.io.etcd.jetcd.Client etcdClient, io.deephaven.enterprise.etcdclient.presence.PresenceKvLeaseHandler pqStateLeaseHandler, byte[] uuid, io.deephaven.enterprise.etcdclient.lease.LeaseHandler electionLeaseHandler, io.deephaven.enterprise.etcdclient.election.ElectionCandidate electionCandidate) -
Method Summary
Modifier and TypeMethodDescriptiongetSelectionProviderStatus
(UserContext userContext) Query the controller's activeIServerSelectionProvider
for status.static void
selectionProviderCommand
(UserContext userContext, String command) Provide a String command to the controller's activeIServerSelectionProvider
.void
shutdown()
void
start
(io.deephaven.shadow.core.io.grpc.ServerBuilder<?> serverBuilder, Supplier<PqStorage> pqStorageFactory, boolean loadStateFromPresenceKvs) Methods inherited from class com.fishlib.util.process.OnetimeShutdownTask
adapt, awaitShutdown, awaitShutdown, invoke, isShutdown
-
Field Details
-
RESET_ON_STARTUP
- See Also:
-
MAX_POSSIBLE_HEAP_GB
public static final int MAX_POSSIBLE_HEAP_GB- See Also:
-
DEFAULT_MAX_HEAP_SIZE_GB
public static final double DEFAULT_MAX_HEAP_SIZE_GB -
MAX_DESYNC_RETRIES
public static final int MAX_DESYNC_RETRIES -
CONTROLLER_PRESENCE_KV_TTL_SECONDS
public static final int CONTROLLER_PRESENCE_KV_TTL_SECONDS -
ETCD_STATE_LEASE_TTL_SECONDS
public static final int ETCD_STATE_LEASE_TTL_SECONDSHow long does our etcd lease for PQ state last, in seconds? If we do not renew the lease for this many seconds, then etcd will automatically revoke it, and our presence KV will be removed. Any process using our presence KV as sign of liveness will consider us dead. -
ETCD_STATE_LEASE_RENEW_SECONDS
public static final int ETCD_STATE_LEASE_RENEW_SECONDSHow often, in seconds, do we renew our etcd lease for PQ State KVs. This must be less thanETCD_STATE_LEASE_TTL_SECONDS
; for safety it should be no more than 50% of the TTL value. -
ETCD_STATE_LEASE_RENEW_RETRY_DELAY_SECONDS
public static final int ETCD_STATE_LEASE_RENEW_RETRY_DELAY_SECONDSWhat is the maximum frequency which we will try to renew a PQ State lease. If a lease renewal times out, we will try again more quickly than the standard ETCD_STATE_LEASE_RENEW_SECONDS. -
ETCD_STATE_LEASE_KEEPALIVE_TIMEOUT_MS
public static final int ETCD_STATE_LEASE_KEEPALIVE_TIMEOUT_MSHow long will we wait for our etcd PQ State lease to be granted or renewed, in milliseconds before determining that we had a failure. -
ETCD_ELECTION_LEASE_TTL_SECONDS
public static final int ETCD_ELECTION_LEASE_TTL_SECONDSHow long does our etcd lease for leader election last, in seconds? If we do not renew the lease for this many seconds, then etcd will automatically revoke it, and we will lose our leadership and our registration in dh-resolver will be removed. -
ETCD_ELECTION_LEASE_RENEW_SECONDS
public static final int ETCD_ELECTION_LEASE_RENEW_SECONDSHow often, in seconds, do we renew our etcd lease for leader election. This must be less thanETCD_ELECTION_LEASE_TTL_SECONDS
; for safety it should be no more than 50% of the TTL value. -
ETCD_ELECTION_LEASE_RENEW_RETRY_DELAY_SECONDS
public static final int ETCD_ELECTION_LEASE_RENEW_RETRY_DELAY_SECONDSWhat is the maximum frequency which we will try to renew an election lease. If a lease renewal times out, we will try again more quickly than the standard ETCD_ELECTION_LEASE_RENEW_SECONDS. -
ETCD_ELECTION_LEASE_KEEPALIVE_TIMEOUT_MS
public static final int ETCD_ELECTION_LEASE_KEEPALIVE_TIMEOUT_MSHow long will we wait for our etcd election lease to be granted or renewed, in milliseconds before determining that we had a failure. -
ETCD_STATE_KVS_LOAD_TIMEOUT_SECONDS
public static final int ETCD_STATE_KVS_LOAD_TIMEOUT_SECONDSHow long in seconds the controller wait to load existing worker state. -
ETCD_STATE_KVS_LOAD_BATCH_SIZE
public static final int ETCD_STATE_KVS_LOAD_BATCH_SIZE -
CONTROLLER_ELECTION_CAMPAIGN_KEY
- See Also:
-
ELECTION_RPC_TIMEOUT_MILLIS
public static final long ELECTION_RPC_TIMEOUT_MILLIS -
ELECTION_OBSERVE_TIMEOUT_MILLIS
public static final long ELECTION_OBSERVE_TIMEOUT_MILLIS
-
-
Constructor Details
-
PersistentQueryController
public PersistentQueryController(@NotNull String processNameForLogging, @NotNull String processInfoId, @NotNull AuditEventLogger auditEventLogger, @NotNull PersistentQueryStateLogger stateLogLogger, @NotNull PersistentQueryConfigurationLogger configurationLogLogger, @NotNull ResourceUtilizationLogger resourceUtilizationLogger, @NotNull QueryUserAssignmentLogger queryUserAssignmentLogger, @NotNull io.deephaven.enterprise.niowrapper.sched.Scheduler scheduler, @Nullable io.deephaven.enterprise.comm.ConnectionMonitor.Params connectionMonitorParams, @Nullable io.deephaven.enterprise.ProcessStatusReporter chatBotClient, @NotNull ScriptPathLoaderManager scriptPathLoaderManager, @Nullable String errorEmailRecipientAddress, @NotNull IrisGroupProvider irisGroupProvider, @NotNull ScheduledExecutorService executorService, @NotNull AuthenticationClient authClient, @NotNull Function<String, PublicPrivateKeyEncryption> encryptionFactory, @NotNull ControllerDispatcherHandler.ConnectionFactory dispatcherConnectionFactory, @NotNull io.deephaven.shadow.jetcd.io.etcd.jetcd.Client etcdClient, @NotNull io.deephaven.enterprise.etcdclient.presence.PresenceKvLeaseHandler pqStateLeaseHandler, @NotNull byte[] uuid, @NotNull io.deephaven.enterprise.etcdclient.lease.LeaseHandler electionLeaseHandler, @NotNull io.deephaven.enterprise.etcdclient.election.ElectionCandidate electionCandidate) throws IOException, ConfigurationVerificationException
-
-
Method Details
-
start
public void start(@NotNull io.deephaven.shadow.core.io.grpc.ServerBuilder<?> serverBuilder, @NotNull Supplier<PqStorage> pqStorageFactory, boolean loadStateFromPresenceKvs) throws IOException, PqStorageException - Throws:
IOException
PqStorageException
-
shutdown
public void shutdown()- Specified by:
shutdown
in classcom.fishlib.util.process.OnetimeShutdownTask
-
getSelectionProviderStatus
Query the controller's activeIServerSelectionProvider
for status.- Parameters:
userContext
- the user making the request- Returns:
- a free-form string of server selection provider information
-
selectionProviderCommand
Provide a String command to the controller's activeIServerSelectionProvider
.This can be used to mutate the internal state of the selection provider. For example, the SimpleServerSelectionProvider enables the administrator to mark backend servers as administratively down to exclude them from the server selection logic (for new queries).
- Parameters:
userContext
- the user making the requestcommand
- the free-form server-selection provider command (e.g. JSON)- Returns:
- a free-form string of server selection provider command results
-
getGroupProvider
-
getConfigurationLogLogger
-
getAuthClient
-
getPresenceManager
-
getWorkerKindMap
-
main
public static void main(String... args) throws IOException, ClassNotFoundException, ConfigurationVerificationException, PqStorageException
-