apache / druid

Apache Druid: a high performance real-time analytics database.
https://druid.apache.org/
Apache License 2.0
13.53k stars 3.71k forks source link

Removed org.apache.druid.discovery.BrokerClient by switching to org.apache.druid.sql.client.BrokerClient. Also upgraded SegmentLoadStatusFetcherTest to reflect changes. #17470

Open satwik-codeium opened 2 weeks ago

satwik-codeium commented 2 weeks ago

Description

This PR updates the SegmentLoadStatusFetcher to use the new SQL package's BrokerClient implementation, replacing the deprecated discovery-based BrokerClient. This change improves code maintainability and aligns with Druid's ongoing modernization efforts.

Migrated BrokerClient Implementation

Updated Test Framework

Release note

Migrated Multi-Stage Query's segment load status checking to use the new SQL package's BrokerClient, removing dependency on the deprecated discovery-based implementation. This change improves code maintainability and provides better SQL task state handling.


Key changed/added classes in this PR

This PR has:

Design Decisions:

  1. Task State Management:

    • Switched to using TaskState for explicit state tracking
    • Simplified error handling by properly propagating task status
    • Improved readability by separating state management from query execution
  2. Test Structure:

    • Mock responses now simulate realistic task state transitions
    • Maintained existing test scenarios while adapting to new API
    • Added proper verification of task state changes
  3. Error Handling:

    • Improved error propagation through SqlTaskStatus
    • Added explicit handling of failed tasks
    • Enhanced logging for better debugging