Skip to content

refactor(inkless): cache LogConfig in InklessMetadataView#474

Merged
giuseppelillo merged 2 commits intomainfrom
jeqo/refactor-metadata-logconfig
Mar 6, 2026
Merged

refactor(inkless): cache LogConfig in InklessMetadataView#474
giuseppelillo merged 2 commits intomainfrom
jeqo/refactor-metadata-logconfig

Conversation

@jeqo
Copy link
Copy Markdown
Contributor

@jeqo jeqo commented Jan 9, 2026

  • Return LogConfig from MetadataView#getTopicConfig instead of Properties, consolidating the LogConfig.fromProps merge logic into InklessMetadataView and removing it from callers (AppendHandler, RetentionEnforcer). Remove getDefaultConfig from the MetadataView interface as it was only needed by callers to construct LogConfig themselves.

  • Cache LogConfig per topic in InklessMetadataView to avoid reconstructing it on every produce request. Classic Kafka caches LogConfig in LocalLog (via LogManager -> UnifiedLog -> LocalLog.config), updated through hooks in TopicConfigHandler and DynamicLogConfig. Inkless lacked an equivalent — LogConfig.fromProps was called on every getTopicConfig, parsing and validating 40+ config fields each time.

  • The cache (ConcurrentHashMap) is populated lazily and kept up to date by:

    • TopicConfigHandler.updateLogConfig: pushes topic-level config changes via InklessMetadataView#updateTopicConfig
    • DynamicInklessLogConfig (new BrokerReconfigurable): rebuilds all cached entries when broker-level defaults change, preserving topic-specific overrides

Test plan:

  • Existing InklessMetadataViewTest passes (including new GetTopicConfigTest cases)
  • DynamicBrokerConfigTest passes with DynamicInklessLogConfig wiring
  • ReplicaManagerTest passes with InklessMetadataView concrete type
  • RetentionEnforcerTest and AppendHandlerTest pass with simplified LogConfig usage
  • Full storage:inkless test suite passes

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

This PR refactors the MetadataView#getTopicConfig method to return LogConfig instead of Properties, consolidating configuration merging logic into the MetadataView implementation. This simplifies callers by removing redundant LogConfig.fromProps() calls and eliminates the need to separately access default configurations.

Key changes:

  • Interface change in MetadataView to return LogConfig instead of Properties
  • Implementation in InklessMetadataView now merges default and topic-specific configs internally
  • Simplified caller code in AppendHandler and RetentionEnforcer

Reviewed changes

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

Show a summary per file
File Description
storage/inkless/src/main/java/io/aiven/inkless/control_plane/MetadataView.java Updated interface method signature to return LogConfig instead of Properties
core/src/main/scala/kafka/server/metadata/InklessMetadataView.scala Implemented getTopicConfig to merge default configs with topic overrides using LogConfig.fromProps
storage/inkless/src/main/java/io/aiven/inkless/produce/AppendHandler.java Simplified getLogConfigs method by removing LogConfig.fromProps call and refactored constructor to accept Function<String, LogConfig>
storage/inkless/src/main/java/io/aiven/inkless/delete/RetentionEnforcer.java Replaced LogConfig.fromProps call with direct method reference to getTopicConfig
storage/inkless/src/test/java/io/aiven/inkless/produce/AppendHandlerTest.java Simplified test setup by removing SharedState and related mock dependencies
storage/inkless/src/test/java/io/aiven/inkless/delete/RetentionEnforcerTest.java Updated mocks to return LogConfig instead of Properties and added try-with-resources for proper cleanup
storage/inkless/src/test/java/io/aiven/inkless/merge/FileMergerIntegrationTest.java Simplified mock setup to return LogConfig directly
storage/inkless/src/test/java/io/aiven/inkless/delete/FileCleanerIntegrationTest.java Simplified mock setup to return LogConfig directly

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

@jeqo jeqo force-pushed the jeqo/refactor-metadata-logconfig branch from 1dce5f5 to 6e7b51f Compare January 9, 2026 17:54
@jeqo jeqo requested a review from Copilot January 9, 2026 17:54
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 9 out of 9 changed files in this pull request and generated no new comments.


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

@jeqo jeqo force-pushed the jeqo/refactor-metadata-logconfig branch 2 times, most recently from bb4745f to 5520b56 Compare March 3, 2026 15:52
@jeqo jeqo changed the base branch from jeqo/refactor-shared-state to main March 3, 2026 15:52
@jeqo jeqo marked this pull request as ready for review March 3, 2026 15:53
@jeqo jeqo marked this pull request as draft March 3, 2026 17:58
@jeqo jeqo requested a review from Copilot March 4, 2026 11: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 14 out of 14 changed files in this pull request and generated 3 comments.


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

@jeqo jeqo changed the title refactor(inkless): return LogConfig from MetadataView#getTopicConfig refactor(inkless): cache LogConfig in InklessMetadataView Mar 4, 2026
Change MetadataView#getTopicConfig to return LogConfig instead of
Properties, consolidating the responsibility of merging default and
topic-specific configurations into the MetadataView implementation.

This simplifies callers by:
- Removing redundant LogConfig.fromProps() calls in RetentionEnforcer
  and AppendHandler
- Eliminating the need for callers to access default configs separately
- Reducing test setup by removing mock configuration for default configs

The InklessMetadataView now handles merging default configs with topic
overrides internally, providing a fully-resolved LogConfig to consumers.
@jeqo jeqo force-pushed the jeqo/refactor-metadata-logconfig branch from f37c974 to 33c655a Compare March 4, 2026 12:44
@jeqo jeqo requested a review from Copilot March 4, 2026 12:51
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 15 out of 15 changed files in this pull request and generated 1 comment.


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

@jeqo jeqo force-pushed the jeqo/refactor-metadata-logconfig branch from 33c655a to f84843c Compare March 4, 2026 13:50
@jeqo jeqo requested a review from Copilot March 4, 2026 13:58
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 15 out of 15 changed files in this pull request and generated no new comments.


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

@jeqo jeqo force-pushed the jeqo/refactor-metadata-logconfig branch from f84843c to 0e445c5 Compare March 4, 2026 14:27
@jeqo jeqo requested a review from Copilot March 4, 2026 14:39
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 17 out of 17 changed files in this pull request and generated no new comments.


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

@jeqo jeqo marked this pull request as ready for review March 4, 2026 15:00
@jeqo jeqo requested review from Mwea and giuseppelillo March 5, 2026 10:55
Classic Kafka avoids reconstructing LogConfig on every produce request by
caching it in LocalLog (via LogManager -> UnifiedLog -> LocalLog.config),
updated through hooks in TopicConfigHandler and DynamicLogConfig.

Inkless lacked an equivalent, calling LogConfig.fromProps on every
getTopicConfig — an expensive operation that parses 40+ config fields.

Add a ConcurrentHashMap cache in InklessMetadataView, populated lazily
and kept up to date by:
- TopicConfigHandler.updateLogConfig: pushes topic-level config changes
- DynamicInklessLogConfig (new BrokerReconfigurable): rebuilds all
  cached entries when broker-level defaults change, preserving
  topic-specific overrides

Also removes getDefaultConfig and updateTopicConfig from MetadataView
interface — both are implementation details of InklessMetadataView.
ReplicaManager now exposes the concrete InklessMetadataView type.
@jeqo jeqo force-pushed the jeqo/refactor-metadata-logconfig branch from 0e445c5 to 6ed00cb Compare March 5, 2026 12:12
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

@giuseppelillo giuseppelillo merged commit 590936e into main Mar 6, 2026
4 checks passed
@giuseppelillo giuseppelillo deleted the jeqo/refactor-metadata-logconfig branch March 6, 2026 15:13
AnatolyPopov pushed a commit that referenced this pull request Mar 23, 2026
* refactor(inkless): return LogConfig from MetadataView#getTopicConfig

Change MetadataView#getTopicConfig to return LogConfig instead of
Properties, consolidating the responsibility of merging default and
topic-specific configurations into the MetadataView implementation.

This simplifies callers by:
- Removing redundant LogConfig.fromProps() calls in RetentionEnforcer
  and AppendHandler
- Eliminating the need for callers to access default configs separately
- Reducing test setup by removing mock configuration for default configs

The InklessMetadataView now handles merging default configs with topic
overrides internally, providing a fully-resolved LogConfig to consumers.

* refactor(inkless): cache LogConfig per topic in InklessMetadataView

Classic Kafka avoids reconstructing LogConfig on every produce request by
caching it in LocalLog (via LogManager -> UnifiedLog -> LocalLog.config),
updated through hooks in TopicConfigHandler and DynamicLogConfig.

Inkless lacked an equivalent, calling LogConfig.fromProps on every
getTopicConfig — an expensive operation that parses 40+ config fields.

Add a ConcurrentHashMap cache in InklessMetadataView, populated lazily
and kept up to date by:
- TopicConfigHandler.updateLogConfig: pushes topic-level config changes
- DynamicInklessLogConfig (new BrokerReconfigurable): rebuilds all
  cached entries when broker-level defaults change, preserving
  topic-specific overrides

Also removes getDefaultConfig and updateTopicConfig from MetadataView
interface — both are implementation details of InklessMetadataView.
ReplicaManager now exposes the concrete InklessMetadataView type.

(cherry picked from commit 590936e)
jeqo added a commit that referenced this pull request Mar 23, 2026
* refactor(inkless): return LogConfig from MetadataView#getTopicConfig

Change MetadataView#getTopicConfig to return LogConfig instead of
Properties, consolidating the responsibility of merging default and
topic-specific configurations into the MetadataView implementation.

This simplifies callers by:
- Removing redundant LogConfig.fromProps() calls in RetentionEnforcer
  and AppendHandler
- Eliminating the need for callers to access default configs separately
- Reducing test setup by removing mock configuration for default configs

The InklessMetadataView now handles merging default configs with topic
overrides internally, providing a fully-resolved LogConfig to consumers.

* refactor(inkless): cache LogConfig per topic in InklessMetadataView

Classic Kafka avoids reconstructing LogConfig on every produce request by
caching it in LocalLog (via LogManager -> UnifiedLog -> LocalLog.config),
updated through hooks in TopicConfigHandler and DynamicLogConfig.

Inkless lacked an equivalent, calling LogConfig.fromProps on every
getTopicConfig — an expensive operation that parses 40+ config fields.

Add a ConcurrentHashMap cache in InklessMetadataView, populated lazily
and kept up to date by:
- TopicConfigHandler.updateLogConfig: pushes topic-level config changes
- DynamicInklessLogConfig (new BrokerReconfigurable): rebuilds all
  cached entries when broker-level defaults change, preserving
  topic-specific overrides

Also removes getDefaultConfig and updateTopicConfig from MetadataView
interface — both are implementation details of InklessMetadataView.
ReplicaManager now exposes the concrete InklessMetadataView type.
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.

3 participants