mirror of
https://github.com/Graylog2/graylog2-server.git
synced 2026-03-13 09:32:21 +08:00
DataNode: Added new state so that we don't automatically start (#17952)
* added new states * fix error message * adding new state to test * removed doubled line * start if insecure has been chosen * adding jump * always start if everything's confgured * fixing test
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.graylog.datanode.process;
|
||||
|
||||
public enum ProcessEvent {
|
||||
PROCESS_PREPARED,
|
||||
PROCESS_STARTED,
|
||||
HEALTH_CHECK_OK,
|
||||
HEALTH_CHECK_FAILED,
|
||||
|
||||
@@ -23,6 +23,10 @@ public enum ProcessState {
|
||||
* Fresh created process, not started yet
|
||||
*/
|
||||
WAITING_FOR_CONFIGURATION(DataNodeStatus.UNCONFIGURED),
|
||||
/**
|
||||
* All configuration files have been written
|
||||
*/
|
||||
PREPARED(DataNodeStatus.PREPARED),
|
||||
/**
|
||||
* The process is running on the underlying OS and has a process ID. It's not responding to the REST API yet
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,12 @@ public class ProcessStateMachine {
|
||||
|
||||
// Freshly created process, it hasn't started yet and doesn't have any pid.
|
||||
config.configure(ProcessState.WAITING_FOR_CONFIGURATION)
|
||||
.permit(ProcessEvent.PROCESS_PREPARED, ProcessState.PREPARED)
|
||||
// jump to started only allowed to facilitate startup with insecure config
|
||||
.permit(ProcessEvent.PROCESS_STARTED, ProcessState.STARTING)
|
||||
.ignore(ProcessEvent.HEALTH_CHECK_FAILED);
|
||||
|
||||
config.configure(ProcessState.PREPARED)
|
||||
.permit(ProcessEvent.PROCESS_STARTED, ProcessState.STARTING)
|
||||
.permit(ProcessEvent.PROCESS_TERMINATED, ProcessState.TERMINATED)
|
||||
.permit(ProcessEvent.PROCESS_STOPPED, ProcessState.TERMINATED)
|
||||
|
||||
Reference in New Issue
Block a user