Skip to content

Implement SDK support for Topic Auto-Partitioning Settings #476

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Eistern
Copy link

@Eistern Eistern commented May 6, 2025

This PR introduces support for configuring and describing auto-partitioning settings for YDB topics within the Java SDK. Users can now define the auto-partitioning strategy and its associated parameters (stabilization window, utilization thresholds) when creating or altering topics. These settings are also reflected in the TopicDescription returned by describeTopic.

Key Changes:

  • Auto-Partitioning Configuration:

    • Added AutoPartitioningStrategy enum (DISABLED, SCALE_UP, SCALE_UP_AND_DOWN, PAUSED) to define the auto-partitioning behavior.
    • Introduced AutoPartitioningWriteStrategySettings (for createTopic and describeTopic) and AlterAutoPartitioningWriteStrategySettings (for alterTopic) to manage:
      • stabilizationWindow
      • upUtilizationPercent
      • downUtilizationPercent
    • These settings are now part of PartitioningSettings and AlterPartitioningSettings respectively.
  • SDK Method Updates:

    • createTopic: Can now specify initial auto-partitioning settings via CreateTopicSettings -> PartitioningSettings.
    • alterTopic: Can now modify auto-partitioning settings via AlterTopicSettings -> AlterPartitioningSettings. AlterAutoPartitioningWriteStrategySettings allows for partial updates (e.g., changing only the stabilization window).
    • describeTopic: TopicDescription now includes the currently configured auto-partitioning strategy and write strategy settings.
  • New Classes:

    • tech.ydb.topic.settings.AutoPartitioningStrategy
    • tech.ydb.topic.settings.AutoPartitioningWriteStrategySettings
    • tech.ydb.topic.settings.AlterAutoPartitioningWriteStrategySettings
  • Refactoring & Improvements:

    • Implemented equals() and hashCode() methods for various topic description classes (TopicDescription, PartitioningSettings, Consumer, ConsumerDescription, ConsumerPartitionInfo, MultipleWindowsStat, PartitionInfo, PartitionStats, SupportedCodecs, TopicStats, OffsetsRangeImpl) to improve data integrity and simplify comparisons, particularly in tests.
  • Testing:

    • Added a new integration test step07_alterTopicWithAutoPartitioning to verify the alterTopic functionality with new auto-partitioning settings.
      • Note: This test is currently marked @Ignore as the auto-partitioning feature via alterTopic requires YDB server version 25.1 or newer.
    • Minor fix in existing test (e.g., msg.commit().join())

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2025

Codecov Report

Attention: Patch coverage is 35.83333% with 77 lines in your changes missing coverage. Please review.

Project coverage is 58.72%. Comparing base (943d5aa) to head (77f469b).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...main/java/tech/ydb/topic/impl/TopicClientImpl.java 23.63% 41 Missing and 1 partial ⚠️
...gs/AlterAutoPartitioningWriteStrategySettings.java 0.00% 20 Missing ⚠️
.../ydb/topic/settings/AlterPartitioningSettings.java 0.00% 10 Missing ⚠️
...ettings/AutoPartitioningWriteStrategySettings.java 85.00% 3 Missing ⚠️
.../tech/ydb/topic/settings/PartitioningSettings.java 80.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #476      +/-   ##
============================================
- Coverage     58.76%   58.72%   -0.04%     
- Complexity     2170     2179       +9     
============================================
  Files           320      323       +3     
  Lines         12942    13063     +121     
  Branches       1269     1278       +9     
============================================
+ Hits           7605     7671      +66     
- Misses         4720     4769      +49     
- Partials        617      623       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Eistern Eistern marked this pull request as draft May 7, 2025 09:06
@Eistern
Copy link
Author

Eistern commented May 7, 2025

Dropped equals/hashCode implementations to reintroduce them in the separate PR

@Eistern Eistern marked this pull request as ready for review May 7, 2025 10:03
@alex268 alex268 requested review from alex268 and pnv1 and removed request for alex268 May 7, 2025 10:47
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