Refactor: convert RealtimeOffsetAutoResetHandler to interface with init(); fix nonLeaderCleanup#18127
Refactor: convert RealtimeOffsetAutoResetHandler to interface with init(); fix nonLeaderCleanup#18127deeppatel710 wants to merge 3 commits intoapache:masterfrom
Conversation
…it(); fix nonLeaderCleanup - Remove redundant public abstract modifiers from RealtimeOffsetAutoResetHandler interface - Update init() javadoc: "called once in constructor" -> "called once after instantiation" - Remove constructor injection from RealtimeOffsetAutoResetKafkaHandler; init() is now the sole initialization path called by the manager after no-arg reflective instantiation - Fix ensureBackfillJobsRunning signature: List<String> -> Collection<String> to match interface - Update RealtimeOffsetAutoResetManager.getOrConstructHandler() to use no-arg constructor + init() - Fix bug in nonLeaderCleanup(): also clear _tableBackfillTopics to avoid stale state on re-election - Fix misleading error message: "Custom analyzer" -> "Custom handler" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@Jackie-Jiang this addresses your review feedback from #15782. Would appreciate a review! |
Jackie-Jiang
left a comment
There was a problem hiding this comment.
Thanks for the contribution
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18127 +/- ##
============================================
- Coverage 63.96% 63.12% -0.84%
+ Complexity 1617 1616 -1
============================================
Files 3179 3213 +34
Lines 193741 195737 +1996
Branches 29926 30240 +314
============================================
- Hits 123918 123551 -367
- Misses 60031 62312 +2281
- Partials 9792 9874 +82
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Remove redundant `ensureBackfillJobsRunning` abstract override from RealtimeOffsetAutoResetKafkaHandler; the interface already declares it - Fix TestRealtimeOffsetAutoResetHandler to use no-arg constructor so reflection-based instantiation in getOrConstructHandler() works correctly - Strengthen testNonLeaderCleanup to assert handler is removed from internal map after nonLeaderCleanup is called Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@Jackie-Jiang Thanks for the approval! I've addressed your feedback in the latest commit (removed the redundant abstract override and fixed the test to use a no-arg constructor). CI workflow needs a maintainer to approve it — could you approve the workflow run and merge when ready? Thanks! |
|
@yashmayya can you run the CI here as well? Thanks!! |
xiangfu0
left a comment
There was a problem hiding this comment.
Found one high-signal backward-compatibility issue; see inline comment.
| handler = (RealtimeOffsetAutoResetHandler) clazz.getConstructor( | ||
| PinotLLCRealtimeSegmentManager.class, PinotHelixResourceManager.class).newInstance( | ||
| _llcRealtimeSegmentManager, _pinotHelixResourceManager); | ||
| handler = (RealtimeOffsetAutoResetHandler) clazz.getConstructor().newInstance(); |
There was a problem hiding this comment.
This changes the auto-reset handler SPI from constructor injection to no-arg construction plus init(). Any existing custom handler compiled against the previous constructor-based contract will now fail to instantiate after upgrade, which is a backward-compatibility break for deployed plugins. Please keep a compatibility path for the legacy constructor (or add a shim/deprecation layer) before switching existing tables to the new loading flow.
There was a problem hiding this comment.
@xiangfu0 Thanks for catching this! You're right — the loading change would break existing handlers that only have the 2-arg constructor.
Fix: getOrConstructHandler() now tries the new no-arg + init() pattern first, and falls back to the deprecated 2-arg constructor (with a WARN log prompting migration) if no no-arg constructor is found.
RealtimeOffsetAutoResetKafkaHandler also has the 2-arg constructor restored as @deprecated so existing subclasses remain source-compatible. Added a test that exercises this fallback path end-to-end.
There was a problem hiding this comment.
@xiangfu0 how about now? can you review this again please? thank you
There was a problem hiding this comment.
@xiangfu0 following up on this , can you please review and stamp this PR? thank you!
…etAutoResetHandler Handlers compiled against the previous constructor-injection SPI contract (PinotLLCRealtimeSegmentManager, PinotHelixResourceManager) would fail to instantiate after upgrade because the new loading code looks for a no-arg constructor. Fix: - getOrConstructHandler() now tries no-arg + init() first; if no no-arg constructor exists it falls back to the old 2-arg constructor with a WARN-level deprecation log, preserving behaviour for existing deployed plugins. - RealtimeOffsetAutoResetKafkaHandler re-adds the @deprecated 2-arg constructor (calling init() internally) so subclasses compiled against the old contract continue to compile and run. - Adds a LegacyRealtimeOffsetAutoResetHandler test fixture and a test that exercises the fallback path end-to-end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Addresses review feedback from #15782 (Jackie-Jiang) that was not carried over when the feature was split and merged as #16492, #16692, and #16724:
public abstractmodifiers fromRealtimeOffsetAutoResetHandlerinterface methods; updatedinit()javadoc to reflect it is called afterinstantiation, not in a constructor
RealtimeOffsetAutoResetKafkaHandler; initialization now happens viainit()called by the manager after reflectiveinstantiation
ensureBackfillJobsRunningsignature:List<String>→Collection<String>to match the interface contractRealtimeOffsetAutoResetManager.getOrConstructHandler()to use no-arg constructor +init()instead of constructor injection via reflectionnonLeaderCleanup(): was not clearing_tableBackfillTopics, leaving stale state when the controller re-acquires leadershipChanges
RealtimeOffsetAutoResetHandler.javainit()RealtimeOffsetAutoResetKafkaHandler.javaCollection<String>signatureRealtimeOffsetAutoResetManager.javainit(); fixednonLeaderCleanup()Labels
refactor,release-notes