Skip to content

CASSSIDECAR-426: Add FileBasedConfigurationProvider for file-based overlay persistence#352

Open
pauloricardomg wants to merge 10 commits into
apache:worktree-CASSSIDECAR-424from
pauloricardomg:CASSSIDECAR-426
Open

CASSSIDECAR-426: Add FileBasedConfigurationProvider for file-based overlay persistence#352
pauloricardomg wants to merge 10 commits into
apache:worktree-CASSSIDECAR-424from
pauloricardomg:CASSSIDECAR-426

Conversation

@pauloricardomg
Copy link
Copy Markdown
Contributor

Summary

Implement FileBasedConfigurationProvider, the default ConfigurationProvider shipped with Sidecar as defined in CEP-62 (CASSSIDECAR-424).

  • Persists configuration overlays as JSON files at {configDir}/{instanceId}/config.json
  • Atomic writes via temp file + Files.move(ATOMIC_MOVE) to prevent corruption from crashes
  • Hash-based optimistic concurrency control rejects storeOverlay calls when the provided hash doesn't match the current overlay hash
  • Per-instance locking for thread safety under concurrent access
  • Add Jackson annotations (@JsonCreator, @JsonProperty, @JsonIgnore) and JavaTimeModule to ConfigurationOverlaySnapshot for direct JSON serialization
  • Promote jackson-datatype-jsr310 from integrationTestImplementation to implementation scope

Test plan

  • Overlay CRUD: store and retrieve, hash preserved across serialization round-trip
  • Optimistic concurrency: stale hash rejected, null hash on existing overlay rejected, hash on missing overlay rejected
  • Instance isolation: overlays for different instances are independent
  • Concurrent writes (same instance): only one thread succeeds, others get conflict
  • Concurrent writes (different instances): all succeed
  • Persistence across provider instances: new provider over same directory reads previously stored data
  • Directory structure created on demand
  • No partial/temp files left after write
  • Overwrite existing overlay with valid hash succeeds
  • Extra JVM opts round-trip correctly

pauloricardomg and others added 8 commits May 19, 2026 12:15
Introduce the pluggable overlay storage abstraction as defined in CEP-62
with ConfigurationProvider interface, CassandraConfigurationOverlay model,
ConfigurationOverlaySnapshot wrapper, and InMemoryConfigurationProvider
sample implementation.
… String>

Make update semantics consistent between cassandraYaml and extraJvmOpts:
both now use a map where a null value removes the entry and a non-null
value upserts it. Keys use the full JVM flag (e.g. -Dcassandra.jmx.local.port).
…mmutability

The constructor now deep-copies the input ObjectNode so that external
mutation of the original reference cannot corrupt the overlay. The
accessor documents that callers must not mutate the returned node.
Improves readability of CassandraConfigurationOverlay and
ConfigurationOverlaySnapshot string representations in logs and
debugging output.
…erlay persistence

Implement the default ConfigurationProvider that persists overlays as
JSON files under per-instance directories ({configDir}/{instanceId}/config.json).
Writes are atomic via temp file + rename. Hash-based optimistic concurrency
control rejects stale updates. Add Jackson annotations and JavaTimeModule
to ConfigurationOverlaySnapshot for direct JSON serialization.
@pauloricardomg pauloricardomg force-pushed the worktree-CASSSIDECAR-424 branch from a45830f to bd32867 Compare May 19, 2026 20:02
@pauloricardomg pauloricardomg force-pushed the worktree-CASSSIDECAR-424 branch 2 times, most recently from ad56510 to c7b8446 Compare May 21, 2026 18:32
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