Skip to content

Remove unnecessary generationMetadata field/getter from GroupedTasks and refactor dependent code #177

@nikagra

Description

@nikagra

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 generationMetadata field and the getGenerationMetadata() getter from GroupedTasks.
  • In the GroupedTasks(Map, GenerationMetadata) constructor, only extract and store generationMetadata.getId().
  • Update LocalTransport.java:
    • Change currentGenerationByTable to a Map<TableName, GenerationId>.
    • Update getCurrentGenerationId(TableName) accordingly.
    • Store the GenerationId in configureWorkers(TableName, GroupedTasks).
  • 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

  1. GroupedTasks.java: Drop the metadata field/getter, modify constructor.
  2. LocalTransport.java: Switch map and update methods to use GenerationId.
  3. MockMasterTransport.java: Remove metadata tracking and calls.
  4. GroupedTasksTest.java: Remove obsolete assertions.

This issue tracks the work required to clean up the unnecessary coupling in the GroupedTasks API and supporting code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions