Package org.apache.druid.metadata
Interface SegmentsMetadataManager
- All Known Implementing Classes:
SqlSegmentsMetadataManager,SqlSegmentsMetadataManagerV2
public interface SegmentsMetadataManager
Polls the metadata store periodically and builds a timeline of used segments
(and schemas if schema caching on the Coordinator is enabled).
This class is provisioned by SegmentsMetadataManagerProvider and must
be bound on the Coordinator/Overlord accordingly.
-
Method Summary
Modifier and TypeMethodDescriptionForces the manager to poll the metadata store and update its snapshot.Returns the latest snapshot containing all used segments currently cached on the manager.booleanvoidPopulates used_status_last_updated column in the segments table iteratively until there are no segments with a NULL value for that column.voidstart()Initializes the manager when the service is being started.voidStarts polling segments from the metadata store upon becoming leader.voidstop()Cleans up resources when the service is being shut down.voidvoidStops polling segments from the metadata store when leadership is lost.
-
Method Details
-
start
void start()Initializes the manager when the service is being started. -
stop
void stop()Cleans up resources when the service is being shut down. -
startPollingDatabasePeriodically
void startPollingDatabasePeriodically()Starts polling segments from the metadata store upon becoming leader. -
stopPollingDatabasePeriodically
void stopPollingDatabasePeriodically()Stops polling segments from the metadata store when leadership is lost. -
isPollingDatabasePeriodically
boolean isPollingDatabasePeriodically()- Returns:
- true if currently the leader and polling the metadata store.
-
getRecentDataSourcesSnapshot
DataSourcesSnapshot getRecentDataSourcesSnapshot()Returns the latest snapshot containing all used segments currently cached on the manager. This method returns immediately if the poll period has not elapsed since the latest snapshot was built. Otherwise, it blocks until the snapshot has been refreshed. -
forceUpdateDataSourcesSnapshot
DataSourcesSnapshot forceUpdateDataSourcesSnapshot()Forces the manager to poll the metadata store and update its snapshot. If a poll is already in progress, a new poll is not started. This method blocks until the poll finishes and the snapshot has been refreshed.- Returns:
- The updated snapshot.
-
populateUsedFlagLastUpdatedAsync
void populateUsedFlagLastUpdatedAsync()Populates used_status_last_updated column in the segments table iteratively until there are no segments with a NULL value for that column. -
stopAsyncUsedFlagLastUpdatedUpdate
void stopAsyncUsedFlagLastUpdatedUpdate()
-