Skip to content

CASSSIDECAR-427: Implement basic configuration retrieval in ConfigurationManager#358

Open
pauloricardomg wants to merge 2 commits into
apache:trunkfrom
pauloricardomg:CASSSIDECAR-427
Open

CASSSIDECAR-427: Implement basic configuration retrieval in ConfigurationManager#358
pauloricardomg wants to merge 2 commits into
apache:trunkfrom
pauloricardomg:CASSSIDECAR-427

Conversation

@pauloricardomg
Copy link
Copy Markdown
Contributor

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 via ConfigUtils.loadConfiguration and merging it with the provider overlay via ConfigurationOverlaySnapshot.overlay(). Wraps provider failures in ConfigurationManagerException.
  • 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 a ConfigurationOverlaySnapshot (loadConfiguration).

Changes to existing classes

  • ConfigurationOverlaySnapshot: Adds 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. Renames overlay field/accessor to configuration to 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 propagation
  • ConfigUtilsTest: Verifies YAML loading, deep merge logic (overlay wins, new keys, nested objects, empty overlay), and loadConfiguration snapshot creation
  • ConfigurationOverlaySnapshotTest: Verifies overlay() merge of yaml keys, JVM opts, max lastModified, and deep nested object merging
  • FileBasedConfigurationProviderTest: Updated to use renamed configuration() accessor
  • Run ./gradlew :server:test --tests "org.apache.cassandra.sidecar.configmanagement.*" - all 50 tests pass

… 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.
Allow null baseTemplatePath so that overlay-only deployments can
initialize with an empty configuration snapshot instead of requiring
a YAML file on disk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant