-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Problem
The generationMetadata field and the getGenerationMetadata() getter in the GroupedTasks class are unnecessary and introduce ambiguous API coupling between master and worker code. This is especially problematic since the only real consumer (LocalTransport) uses it only to call .getId(), which is already available via getGenerationId(). Keeping a nullable getGenerationMetadata() also exposes risk of NPE and runs counter to the PR's goal of workers operating with just GenerationId.
Proposed Solution
- Remove the
generationMetadatafield and thegetGenerationMetadata()getter fromGroupedTasks. - In the
GroupedTasks(Map, GenerationMetadata)constructor, only extract and storegenerationMetadata.getId(). - Update
LocalTransport.java:- Change
currentGenerationByTableto aMap<TableName, GenerationId>. - Update
getCurrentGenerationId(TableName)accordingly. - Store the
GenerationIdinconfigureWorkers(TableName, GroupedTasks).
- Change
- Update
MockMasterTransport.java(tests):- Remove metadata-related map and methods.
- Replace usage with the new approach.
- Remove related assertions in
GroupedTasksTest.java.
Benefits
- Cleaner, safer API (no nullable getter).
- More precise decoupling of worker/master logic.
- Removes technical debt and reduces confusion for users of the API.
Example Refactoring Steps
GroupedTasks.java: Drop the metadata field/getter, modify constructor.LocalTransport.java: Switch map and update methods to useGenerationId.MockMasterTransport.java: Remove metadata tracking and calls.GroupedTasksTest.java: Remove obsolete assertions.
This issue tracks the work required to clean up the unnecessary coupling in the GroupedTasks API and supporting code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels