CASSSIDECAR-427: Implement basic configuration retrieval in ConfigurationManager#358
Open
pauloricardomg wants to merge 2 commits into
Open
CASSSIDECAR-427: Implement basic configuration retrieval in ConfigurationManager#358pauloricardomg wants to merge 2 commits into
pauloricardomg wants to merge 2 commits into
Conversation
c003a12 to
e18a529
Compare
… retrieval Introduce ConfigurationManager that computes the effective configuration for a Cassandra instance by fetching the overlay from the ConfigurationProvider and merging it with the base cassandra.yaml template. New classes: - ConfigurationManager: retrieves effective configuration by loading the base template via ConfigUtils.loadConfiguration and merging it with the provider overlay via ConfigurationOverlaySnapshot.overlay() - ConfigurationManagerException: wraps provider failures with a descriptive message - ConfigUtils: utilities for YAML loading (loadYaml), deep merge of configurations (mergeConfigurations), and loading a YAML file as a ConfigurationOverlaySnapshot (loadConfiguration) ConfigurationOverlaySnapshot gains an overlay() method that produces a new snapshot by deep-merging another snapshot on top, combining cassandraYaml recursively, merging extraJvmOpts, and using the max of both lastModified timestamps.
e18a529 to
28ccef4
Compare
Allow null baseTemplatePath so that overlay-only deployments can initialize with an empty configuration snapshot instead of requiring a YAML file on disk.
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.
Summary
Implement the basic GET configuration flow in the Configuration Manager. When handling retrieval requests, the manager fetches the current overlay from the
ConfigurationProvider, merges it with the base template to compute the effective configuration, and returns the result with its SHA-256 hash and last modified timestamp.New classes
ConfigurationManager: Retrieves effective configuration by loading the base template viaConfigUtils.loadConfigurationand merging it with the provider overlay viaConfigurationOverlaySnapshot.overlay(). Wraps provider failures inConfigurationManagerException.ConfigurationManagerException: Unchecked exception wrapping provider failures with a descriptive message.ConfigUtils: Utilities for YAML loading (loadYaml), deep merge of configurations (mergeConfigurations), and loading a YAML file as aConfigurationOverlaySnapshot(loadConfiguration).Changes to existing classes
ConfigurationOverlaySnapshot: Adds anoverlay()method that produces a new snapshot by deep-merging another snapshot on top, combiningcassandraYamlrecursively, mergingextraJvmOpts, and using the max of bothlastModifiedtimestamps. Renamesoverlayfield/accessor toconfigurationto better reflect its role when representing the effective (merged) configuration.Test plan
ConfigurationManagerTest: Verifies effective configuration retrieval with no overlay, with overlay (merge semantics), and provider failure propagationConfigUtilsTest: Verifies YAML loading, deep merge logic (overlay wins, new keys, nested objects, empty overlay), andloadConfigurationsnapshot creationConfigurationOverlaySnapshotTest: Verifiesoverlay()merge of yaml keys, JVM opts, max lastModified, and deep nested object mergingFileBasedConfigurationProviderTest: Updated to use renamedconfiguration()accessor./gradlew :server:test --tests "org.apache.cassandra.sidecar.configmanagement.*"- all 50 tests pass