mirror of
https://github.com/apache/druid.git
synced 2025-02-17 07:25:02 +00:00
Use DruidLeaderSelector in CliCoordinator.HearbeatSupplier (#16215)
This commit is contained in:
parent
524842a3bb
commit
3471352dac
@ -42,6 +42,7 @@ import org.apache.druid.client.DirectDruidClientFactory;
|
|||||||
import org.apache.druid.client.HttpServerInventoryViewResource;
|
import org.apache.druid.client.HttpServerInventoryViewResource;
|
||||||
import org.apache.druid.client.InternalQueryConfig;
|
import org.apache.druid.client.InternalQueryConfig;
|
||||||
import org.apache.druid.client.coordinator.Coordinator;
|
import org.apache.druid.client.coordinator.Coordinator;
|
||||||
|
import org.apache.druid.discovery.DruidLeaderSelector;
|
||||||
import org.apache.druid.discovery.NodeRole;
|
import org.apache.druid.discovery.NodeRole;
|
||||||
import org.apache.druid.error.DruidException;
|
import org.apache.druid.error.DruidException;
|
||||||
import org.apache.druid.guice.ConfigProvider;
|
import org.apache.druid.guice.ConfigProvider;
|
||||||
@ -465,12 +466,12 @@ public class CliCoordinator extends ServerRunnable
|
|||||||
|
|
||||||
private static class HeartbeatSupplier implements Provider<Supplier<Map<String, Object>>>
|
private static class HeartbeatSupplier implements Provider<Supplier<Map<String, Object>>>
|
||||||
{
|
{
|
||||||
private final DruidCoordinator coordinator;
|
private final DruidLeaderSelector leaderSelector;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HeartbeatSupplier(DruidCoordinator coordinator)
|
public HeartbeatSupplier(@Coordinator DruidLeaderSelector leaderSelector)
|
||||||
{
|
{
|
||||||
this.coordinator = coordinator;
|
this.leaderSelector = leaderSelector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -478,7 +479,7 @@ public class CliCoordinator extends ServerRunnable
|
|||||||
{
|
{
|
||||||
return () -> {
|
return () -> {
|
||||||
Map<String, Object> heartbeatTags = new HashMap<>();
|
Map<String, Object> heartbeatTags = new HashMap<>();
|
||||||
heartbeatTags.put("leader", coordinator.isLeader() ? 1 : 0);
|
heartbeatTags.put("leader", leaderSelector.isLeader() ? 1 : 0);
|
||||||
|
|
||||||
return heartbeatTags;
|
return heartbeatTags;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user