Skip to content

fix(inkless:migration): fix classic-to-diskless migration validation#558

Merged
giuseppelillo merged 1 commit intomainfrom
jeqo/fix-log-config-validation
Apr 1, 2026
Merged

fix(inkless:migration): fix classic-to-diskless migration validation#558
giuseppelillo merged 1 commit intomainfrom
jeqo/fix-log-config-validation

Conversation

@jeqo
Copy link
Copy Markdown
Contributor

@jeqo jeqo commented Mar 31, 2026

The isClassicToDisklessMigration detection in LogConfig.validateDiskless was dead code: it required !isRemoteStorageExplicitlySet, but in the real controller path (ConfigurationControlManager.validateAlterConfig), props is the merged state of existing overrides + requested changes, so remote.storage.enable is
always present.
Fix by detecting migration via state transition instead: diskless newly enabled (!wasDisklessEnabled) while remote storage was already enabled in existing config.

Also add LogConfigTest to inkless PR CI and kafka.log.* to nightly CI to prevent regressions in diskless config validation.

@jeqo jeqo force-pushed the jeqo/fix-log-config-validation branch from ac977fa to 7add542 Compare March 31, 2026 15:37
@jeqo jeqo marked this pull request as ready for review March 31, 2026 16:09
@jeqo jeqo requested a review from Copilot March 31, 2026 16:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes diskless config validation for classic-to-diskless migrations by changing the migration detection logic to use a state-transition check (diskless newly enabled while remote storage was already enabled), and expands CI coverage to reduce regression risk.

Changes:

  • Update LogConfig.validateDiskless to detect classic-to-diskless migration based on existing vs new state rather than “remote.storage.enable not explicitly set”.
  • Update LogConfigTest to reflect the controller’s merged-props behavior when validating migration.
  • Extend Inkless PR and nightly GitHub Actions workflows to include additional diskless/log-config related test patterns.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
storage/src/main/java/org/apache/kafka/storage/internals/log/LogConfig.java Adjusts migration detection logic in diskless validation.
core/src/test/scala/unit/kafka/log/LogConfigTest.scala Updates unit test to match merged-props controller flow for migration validation.
.github/workflows/inkless.yml Adds additional :core:test filters (Inkless/Diskless + LogConfigTest).
.github/workflows/inkless-nightly.yml Adds additional :core:test filters to include kafka.log.* nightly.
Comments suppressed due to low confidence (1)

storage/src/main/java/org/apache/kafka/storage/internals/log/LogConfig.java:537

  • isClassicToDisklessMigration currently only checks that remote storage was enabled in the existing config, but it does not verify that remote.storage.enable remains enabled in the new (merged) config. This means a request could enable diskless.enable=true while simultaneously setting remote.storage.enable=false (and potentially remote.log.delete.on.disable=true), which would incorrectly bypass the mutual-exclusion validation even though both configs are explicitly set. Consider requiring remote.storage.enable to be true in newConfigs (or otherwise ensuring the new remote-storage state is enabled) as part of the migration detection.
        final boolean wasRemoteStorageEnabled = Boolean.parseBoolean(existingConfigs.getOrDefault(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG, "false"));
        final boolean isClassicToDisklessMigration = isDisklessAllowFromClassicEnabled
            && isDisklessEnabled && !wasDisklessEnabled
            && wasRemoteStorageExplicitlySet && wasRemoteStorageEnabled;
        if (!isClassicToDisklessMigration) {
            final boolean hasExplicitDiskless = isDisklessExplicitlySet || wasDisklessExplicitlySet;
            final boolean hasExplicitRemoteStorage = isRemoteStorageExplicitlySet || wasRemoteStorageExplicitlySet;
            validateDisklessAndRemoteStorageMutualExclusion(isDisklessExplicitlySet, isRemoteStorageExplicitlySet, hasExplicitDiskless, hasExplicitRemoteStorage);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/test/scala/unit/kafka/log/LogConfigTest.scala
Comment thread .github/workflows/inkless.yml Outdated
@jeqo jeqo force-pushed the jeqo/fix-log-config-validation branch from 7add542 to ddb59ad Compare March 31, 2026 16:48
@jeqo jeqo requested a review from Copilot March 31, 2026 16:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread storage/src/main/java/org/apache/kafka/storage/internals/log/LogConfig.java Outdated
Comment thread .github/workflows/inkless.yml
@jeqo jeqo force-pushed the jeqo/fix-log-config-validation branch 2 times, most recently from 2f04473 to 8f03f4b Compare March 31, 2026 17:46
@jeqo jeqo requested a review from Copilot March 31, 2026 17:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeqo jeqo force-pushed the jeqo/fix-log-config-validation branch from 8f03f4b to b3eb14d Compare March 31, 2026 18:25
@jeqo jeqo requested a review from Copilot March 31, 2026 18:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/test/scala/unit/kafka/log/LogConfigTest.scala
…and add LogConfigTest to CI

The isClassicToDisklessMigration detection in LogConfig.validateDiskless was
dead code: it required !isRemoteStorageExplicitlySet, but in the real controller
path (ConfigurationControlManager.validateAlterConfig), props is the merged
state of existing overrides + requested changes, so remote.storage.enable is
always present. Fix by detecting migration via state transition instead:
diskless newly enabled (!wasDisklessEnabled) while remote storage was already
enabled in existing config.

Also add LogConfigTest to inkless PR CI and kafka.log.* to nightly CI to
prevent regressions in diskless config validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeqo jeqo force-pushed the jeqo/fix-log-config-validation branch from b3eb14d to e478ad4 Compare March 31, 2026 18:38
@jeqo jeqo requested a review from Copilot March 31, 2026 18:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

&& wasRemoteStorageExplicitlySet && wasRemoteStorageEnabled;
if (!isClassicToDisklessMigration) {
final boolean requestedRemoteStorageEnabled = (Boolean) newConfigs.get(TopicConfig.REMOTE_LOG_STORAGE_ENABLE_CONFIG);
final boolean isDisklessWithRemoteStorageLegacy = isDisklessAllowFromClassicEnabled
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not getting why this is called Legacy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Maybe isMigratedFromClassicWithRemoteStorage or similar is better. @viktorsomogyi maybe this can be fixed as part of #556?

Copy link
Copy Markdown
Contributor

@giuseppelillo giuseppelillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one small comment about a variable name that can be fixed later.

@giuseppelillo giuseppelillo merged commit 81d36eb into main Apr 1, 2026
12 checks passed
@giuseppelillo giuseppelillo deleted the jeqo/fix-log-config-validation branch April 1, 2026 08:26
jeqo added a commit that referenced this pull request Apr 1, 2026
…and add LogConfigTest to CI (#558)

The isClassicToDisklessMigration detection in LogConfig.validateDiskless was
dead code: it required !isRemoteStorageExplicitlySet, but in the real controller
path (ConfigurationControlManager.validateAlterConfig), props is the merged
state of existing overrides + requested changes, so remote.storage.enable is
always present. Fix by detecting migration via state transition instead:
diskless newly enabled (!wasDisklessEnabled) while remote storage was already
enabled in existing config.

Also add LogConfigTest to inkless PR CI and kafka.log.* to nightly CI to
prevent regressions in diskless config validation.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
jeqo added a commit that referenced this pull request Apr 1, 2026
…and add LogConfigTest to CI (#558)

The isClassicToDisklessMigration detection in LogConfig.validateDiskless was
dead code: it required !isRemoteStorageExplicitlySet, but in the real controller
path (ConfigurationControlManager.validateAlterConfig), props is the merged
state of existing overrides + requested changes, so remote.storage.enable is
always present. Fix by detecting migration via state transition instead:
diskless newly enabled (!wasDisklessEnabled) while remote storage was already
enabled in existing config.

Also add LogConfigTest to inkless PR CI and kafka.log.* to nightly CI to
prevent regressions in diskless config validation.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

4 participants