refactor: Replace getAllConnectors with ConnectorRegistry APIs#27476
Merged
mbasmanova merged 4 commits intoprestodb:masterfrom Apr 1, 2026
Merged
refactor: Replace getAllConnectors with ConnectorRegistry APIs#27476mbasmanova merged 4 commits intoprestodb:masterfrom
mbasmanova merged 4 commits intoprestodb:masterfrom
Conversation
…ry APIs Summary: Replace getAllConnectors() with ConnectorRegistry::unregisterAll() in PrestoServer::unregisterConnectors(). Change PeriodicTaskManager to accept only the HiveConnectors it needs instead of the full connector map, using ConnectorRegistry::findAll<HiveConnector>(). Differential Revision: D98911125
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactors connector handling to use ConnectorRegistry APIs directly, narrowing PeriodicTaskManager’s dependency to only Hive connectors and simplifying connector unregistration in PrestoServer. Sequence diagram for PrestoServer lifecycle connector handlingsequenceDiagram
participant PrestoServer
participant ConnectorRegistry
participant PeriodicTaskManager
PrestoServer->>ConnectorRegistry: findAllHiveConnector()
ConnectorRegistry-->>PrestoServer: hiveConnectors
PrestoServer->>PeriodicTaskManager: constructor(hiveConnectors, server)
PrestoServer->>PeriodicTaskManager: start()
loop periodic_connector_stats
PeriodicTaskManager->>PeriodicTaskManager: addConnectorStatsTask()
Note over PeriodicTaskManager: Iterate hiveConnectors_ and create HiveConnectorStatsReporter instances
end
PrestoServer->>PrestoServer: shutdown_sequence()
PrestoServer->>ConnectorRegistry: unregisterAll()
ConnectorRegistry-->>PrestoServer: all_connectors_unregistered
Class diagram for refactored connector handlingclassDiagram
class PrestoServer {
+void run()
+void unregisterConnectors()
}
class PeriodicTaskManager {
+PeriodicTaskManager(std::shared_ptr<folly::CPUThreadPoolExecutor> driverCPUExecutor, std::shared_ptr<folly::IOThreadPoolExecutor> spillerExecutor, TaskManager* taskManager, const velox::memory::MemoryAllocator* memoryAllocator, const velox::cache::AsyncDataCache* asyncDataCache, std::vector<std::shared_ptr<velox::connector::hive::HiveConnector>> hiveConnectors, PrestoServer* server)
+void start()
+void addConnectorStatsTask()
-std::shared_ptr<folly::CPUThreadPoolExecutor> driverCPUExecutor_
-std::shared_ptr<folly::IOThreadPoolExecutor> spillerExecutor_
-TaskManager* taskManager_
-const velox::memory::MemoryAllocator* memoryAllocator_
-const velox::cache::AsyncDataCache* asyncDataCache_
-const velox::memory::MemoryArbitrator* arbitrator_
-std::vector<std::shared_ptr<velox::connector::hive::HiveConnector>> hiveConnectors_
-PrestoServer* server_
}
class ConnectorRegistry {
+static std::vector<std::shared_ptr<velox::connector::hive::HiveConnector>> findAllHiveConnector()
+static void unregisterAll()
}
class HiveConnector {
}
PrestoServer --> PeriodicTaskManager : creates
PrestoServer ..> ConnectorRegistry : uses
PeriodicTaskManager o--> HiveConnector : reports_stats_for
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
PrestoServer::unregisterConnectors, consider preserving some of the previous logging (e.g., number and names of connectors being unregistered) so that shutdown behavior remains as observable and debuggable as before. - In
PeriodicTaskManager, you now copy the fullstd::vector<std::shared_ptr<hive::HiveConnector>>into the memberhiveConnectors_; if the manager does not need ownership or mutation, consider taking it as aconst&or making the memberconstto avoid unnecessary copying and clarify lifetime/intent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `PrestoServer::unregisterConnectors`, consider preserving some of the previous logging (e.g., number and names of connectors being unregistered) so that shutdown behavior remains as observable and debuggable as before.
- In `PeriodicTaskManager`, you now copy the full `std::vector<std::shared_ptr<hive::HiveConnector>>` into the member `hiveConnectors_`; if the manager does not need ownership or mutation, consider taking it as a `const&` or making the member `const` to avoid unnecessary copying and clarify lifetime/intent.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
amitkdutta
approved these changes
Mar 31, 2026
Contributor
Author
|
@aditi-pandit Aditi, any chance you could stamp again? |
arhimondr
approved these changes
Mar 31, 2026
bibith4
pushed a commit
to bibith4/presto
that referenced
this pull request
Apr 1, 2026
…odb#27476) Summary: Replace getAllConnectors() with ConnectorRegistry::unregisterAll() in PrestoServer::unregisterConnectors(). Change PeriodicTaskManager to accept only the HiveConnectors it needs instead of the full connector map, using ConnectorRegistry::findAll<HiveConnector>(). Differential Revision: D98911125 == RELEASE NOTES == General Changes * None. Internal refactoring only.
15 tasks
aditi-pandit
reviewed
Apr 1, 2026
Contributor
aditi-pandit
left a comment
There was a problem hiding this comment.
Sorry about the delay.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Replace getAllConnectors() with ConnectorRegistry::unregisterAll() in
PrestoServer::unregisterConnectors(). Change PeriodicTaskManager to
accept only the HiveConnectors it needs instead of the full connector
map, using ConnectorRegistry::findAll().
Differential Revision: D98911125
== RELEASE NOTES ==
General Changes