-
Notifications
You must be signed in to change notification settings - Fork 11
feat(inkless:switch): validate diskless requires remote storage when consolidation enabled #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
giuseppelillo
merged 2 commits into
main
from
jeqo/kc-149-diskless-remote-storage-config
May 28, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -579,10 +579,24 @@ public boolean wasRemoteStorageEnabled() { | |
| } | ||
|
|
||
| public boolean isSwitchedFromClassicWithRemoteStorage() { | ||
| return isDisklessAllowFromClassicEnabled | ||
| && isDisklessEnabled() | ||
| && wasRemoteStorageExplicitlySet() && wasRemoteStorageEnabled() | ||
| && requestedRemoteStorageEnabled(); | ||
| // Allows both diskless and remote-storage to be set when: | ||
| // - The allow-from-classic flag is on, AND | ||
| // - Diskless is being enabled, AND | ||
| // - Remote-Storage was already enabled (TIERED→DISKLESS switch), OR | ||
| // Remote-Storage is being enabled in the same request | ||
| // AND consolidation is on (CLASSIC→DISKLESS direct switch) | ||
| // If remote.storage.enable doesn't resolve to true, no valid switch is happening: | ||
| // either mutual exclusion won't fire (remote.storage.enable absent) or the request | ||
| // is invalid (remote.storage.enable=false). | ||
| if (!isDisklessAllowFromClassicEnabled || !isDisklessEnabled() || !requestedRemoteStorageEnabled()) { | ||
| return false; | ||
| } | ||
| // TIERED→DISKLESS: Remote-Storage was already explicitly set and enabled | ||
| if (wasRemoteStorageExplicitlySet() && wasRemoteStorageEnabled()) { | ||
| return true; | ||
| } | ||
| // CLASSIC→DISKLESS (single request): Remote-Storage is being newly enabled, requires consolidation gate | ||
| return isRemoteStorageConsolidationEnabled && isRemoteStorageBecomesEnabled(); | ||
| } | ||
|
|
||
| /** Both overrides were already present and remain off; used to skip mutual exclusion without consolidation. */ | ||
|
|
@@ -649,10 +663,19 @@ private static void validateDiskless(Map<String, String> existingConfigs, | |
| // Exception 4: both keys were already present and remain explicitly false (no-op alter); allowed even | ||
| // when cluster consolidation is off, so routine config updates do not trip mutual exclusion. | ||
| final boolean isBothExplicitlyDisabledSteadyState = logConfigHelper.isBothExplicitlyDisabledSteadyStateUpdate(); | ||
| if (!isSwitchedFromClassicWithRemoteStorage && !isDisklessConsolidationOnCreation && !isValidConsolidationModeTransitionOnUpdate | ||
| && !isBothExplicitlyDisabledSteadyState) { | ||
| if (!isSwitchedFromClassicWithRemoteStorage && | ||
| !isDisklessConsolidationOnCreation && | ||
| !isValidConsolidationModeTransitionOnUpdate && | ||
| !isBothExplicitlyDisabledSteadyState) { | ||
| validateDisklessAndRemoteStorageMutualExclusion(logConfigHelper); | ||
| } | ||
|
|
||
| // When consolidation is enabled, enforce that diskless topics must have remote storage. | ||
| // This replaces mutual exclusion with a stricter invariant: diskless.enable=true requires | ||
| // remote.storage.enable=true. | ||
| if (isRemoteStorageConsolidationEnabled) { | ||
| validateDisklessRequiresRemoteStorage(logConfigHelper); | ||
| } | ||
| } | ||
|
|
||
| private static void validateDisklessTransition(LogConfigHelper logConfigHelper, | ||
|
|
@@ -679,6 +702,29 @@ private static void validateDisklessAndRemoteStorageMutualExclusion(LogConfigHel | |
| } | ||
| } | ||
|
|
||
| private static void validateDisklessRequiresRemoteStorage(LogConfigHelper logConfigHelper) { | ||
| // Diskless topics must have remote storage enabled. | ||
| // Only reject when remote.storage.enable is explicitly set to false. | ||
| // If remote.storage.enable was never set (implicit default), allow — | ||
| // the controller will auto-enable remote storage via config record. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When does this happen? Could not find anything
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's coming as a follow-up: #619 |
||
| if (!logConfigHelper.isDisklessEnabled() || logConfigHelper.isRemoteStorageEnabled()) { | ||
| return; | ||
| } | ||
| // Since we returned above if remote storage is enabled, explicit-set here implies set-to-false. | ||
| boolean isRemoteStorageExplicitlySetToFalse = logConfigHelper.wasRemoteStorageExplicitlySet() | ||
| || logConfigHelper.isRemoteStorageExplicitlySet(); | ||
| if (!isRemoteStorageExplicitlySetToFalse) { | ||
| return; | ||
| } | ||
| boolean isDisklessBeingEnabled = logConfigHelper.isCreation() | ||
| || (logConfigHelper.isDisklessExplicitlySet() && !logConfigHelper.wasDisklessEnabled()); | ||
| boolean isRemoteStorageBeingDisabled = logConfigHelper.isRemoteStorageExplicitlySet() && !logConfigHelper.isRemoteStorageEnabled(); | ||
|
jeqo marked this conversation as resolved.
|
||
| // Reject either transition that independently creates diskless + remote.storage.enable=false | ||
| if (isDisklessBeingEnabled || isRemoteStorageBeingDisabled) { | ||
| throw new InvalidConfigurationException( | ||
| "Diskless topics must have remote storage enabled. Set remote.storage.enable=true when enabling diskless."); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Validates the values of the given properties. Should be called only by the broker. | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.