Better cleanup during datanode preflight restart#25061
Open
Better cleanup during datanode preflight restart#25061
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the cleanup process during datanode preflight restart by properly removing signed certificates from the datanode keystore and resetting the state machine to waiting for configuration. This prevents unexpected automatic startups and addresses random integration test failures.
Changes:
- Added
REMOVE_NODE_CONFIGURATIONlifecycle trigger to properly clean up datanode state - Introduced
initWithSelfSignedCertificate()method to reset keystore to self-signed certificate - Enhanced integration tests with proper datanode disconnection waiting to ensure clean state between tests
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| DataNodeLifecycleTrigger.java | Added new REMOVE_NODE_CONFIGURATION enum value for cleanup trigger |
| DataNodeCommandService.java | Added removeNodeConfiguration() interface method |
| DataNodeCommandServiceImpl.java | Implemented removeNodeConfiguration() to post lifecycle event |
| PreflightResource.java | Added call to removeNodeConfiguration() after stopping node during preflight reset |
| OpensearchEvent.java | Added PROCESS_CONFIGURATION_REMOVED event for state machine |
| OpensearchStateMachine.java | Added state transition from TERMINATED to WAITING_FOR_CONFIGURATION |
| OpensearchProcess.java | Added removeConfiguration() interface method |
| OpensearchProcessImpl.java | Implemented removeConfiguration() to clear configuration |
| OpensearchProcessService.java | Added event handler for REMOVE_NODE_CONFIGURATION trigger |
| DatanodeKeystore.java | Moved and implemented initWithSelfSignedCertificate() method to reset keystore |
| DatanodeKeystoreInitService.java | Refactored to use new keystore initialization method |
| DatanodeKeystoreTest.java | Added comprehensive tests for self-signed certificate initialization |
| DatanodeProvisioningIT.java | Added waitForDatanodesDisconnected() to ensure clean state between tests |
| pr-25061.toml | Added changelog entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
data-node/src/main/java/org/graylog/datanode/opensearch/OpensearchProcessService.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/graylog/datanode/bootstrap/preflight/inits/DatanodeKeystoreInitService.java
Outdated
Show resolved
Hide resolved
data-node/src/test/java/org/graylog/datanode/configuration/DatanodeKeystoreTest.java
Outdated
Show resolved
Hide resolved
data-node/src/test/java/org/graylog/datanode/configuration/DatanodeKeystoreTest.java
Outdated
Show resolved
Hide resolved
data-node/src/test/java/org/graylog/datanode/configuration/DatanodeKeystoreTest.java
Outdated
Show resolved
Hide resolved
full-backend-tests/src/test/java/org/graylog/searchbackend/datanode/DatanodeProvisioningIT.java
Outdated
Show resolved
Hide resolved
data-node/src/main/java/org/graylog/datanode/configuration/DatanodeKeystore.java
Outdated
Show resolved
Hide resolved
data-node/src/test/java/org/graylog/datanode/configuration/DatanodeKeystoreTest.java
Outdated
Show resolved
Hide resolved
graylog2-server/src/main/java/org/graylog2/datanode/DataNodeCommandServiceImpl.java
Show resolved
Hide resolved
...-node/src/main/java/org/graylog/datanode/opensearch/statemachine/OpensearchStateMachine.java
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is properly handling datanode cleanup during reset of initial preflight setup and migration to databode. It removes signed certificate from the datanode keystore and resets the state machine to waiting for configuration.This should prevent unexpected automatic startups and fix integration tests that are failing now randomly.
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: