Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ZK-based segment loading, remove usage of skife from DruidCoordinatorConfig #15705

Merged
merged 25 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4f14ccf
Remove usage of skife from DruidCoordinatorConfig
kfaraz Jan 17, 2024
34e3bd4
Remove old config class
kfaraz Jan 17, 2024
7db4bc4
Address static checks
kfaraz Jan 17, 2024
748d37b
Fix tests
kfaraz Jan 17, 2024
550d0bb
Remove unnecessary mocks
kfaraz Jan 17, 2024
da9c528
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Jan 18, 2024
a85ec53
Fix config typos
kfaraz Jan 18, 2024
611d940
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Feb 9, 2024
06b97cb
Fix config condition
kfaraz Feb 13, 2024
b0c7fa1
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Feb 29, 2024
7f55e9a
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Mar 22, 2024
e9a5e64
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Apr 19, 2024
62f8920
Fix test, spotbug check
kfaraz Apr 19, 2024
0020446
Move validation to DruidCoordinatorConfig
kfaraz Apr 19, 2024
6ce7c26
Move DruidCoordinatorConfig to different package
kfaraz Apr 19, 2024
18e79a4
Fix validation of killunusedconfig
kfaraz Apr 19, 2024
1c26bc1
Simplify and fix KillSupervisorsCustomDuty
kfaraz Apr 19, 2024
a2a928c
Address review comments
kfaraz Apr 24, 2024
0f18464
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Apr 25, 2024
47a9e4e
Fix new tests
kfaraz Apr 25, 2024
032f2b7
Add KillUnusedSchemasConfig
kfaraz Apr 25, 2024
c10a5c9
Remove KillUnusedSchemasConfig
kfaraz Apr 25, 2024
9e79a07
Minor renames
kfaraz Apr 29, 2024
65d774d
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Apr 29, 2024
c7b04af
Merge branch 'master' of github.com:apache/druid into remove_coord_sk…
kfaraz Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
import org.apache.druid.server.DruidNode;
import org.apache.druid.server.coordinator.balancer.BalancerStrategyFactory;
import org.apache.druid.server.coordinator.compact.CompactionSegmentSearchPolicy;
import org.apache.druid.server.coordinator.config.CoordinatorKillConfigs;
import org.apache.druid.server.coordinator.config.DruidCoordinatorConfig;
import org.apache.druid.server.coordinator.config.KillUnusedSegmentsConfig;
import org.apache.druid.server.coordinator.duty.BalanceSegments;
import org.apache.druid.server.coordinator.duty.CollectSegmentAndServerStats;
import org.apache.druid.server.coordinator.duty.CompactSegments;
Expand Down Expand Up @@ -182,7 +185,6 @@ public DruidCoordinator(
ServiceAnnouncer serviceAnnouncer,
@Self DruidNode self,
CoordinatorCustomDutyGroups customDutyGroups,
BalancerStrategyFactory balancerStrategyFactory,
LookupCoordinatorManager lookupCoordinatorManager,
@Coordinator DruidLeaderSelector coordLeaderSelector,
CompactionSegmentSearchPolicy compactionSegmentSearchPolicy
Expand All @@ -200,7 +202,7 @@ public DruidCoordinator(

this.executorFactory = scheduledExecutorFactory;

this.balancerStrategyFactory = balancerStrategyFactory;
this.balancerStrategyFactory = config.getBalancerStrategyFactory();
this.lookupCoordinatorManager = lookupCoordinatorManager;
this.coordLeaderSelector = coordLeaderSelector;
this.compactSegments = initializeCompactSegmentsDuty(compactionSegmentSearchPolicy);
Expand Down Expand Up @@ -545,10 +547,13 @@ private List<CoordinatorDuty> makeHistoricalManagementDuties()
List<CoordinatorDuty> makeIndexingServiceDuties()
{
final List<CoordinatorDuty> duties = new ArrayList<>();
if (config.isKillUnusedSegmentsEnabled()) {
duties.add(new KillUnusedSegments(metadataManager.segments(), overlordClient, config));
final KillUnusedSegmentsConfig killUnusedConfig = config.getKillConfigs().unusedSegments(
config.getCoordinatorIndexingPeriod()
);
if (killUnusedConfig.isCleanupEnabled()) {
duties.add(new KillUnusedSegments(metadataManager.segments(), overlordClient, killUnusedConfig));
}
if (config.isKillPendingSegmentsEnabled()) {
if (config.getKillConfigs().pendingSegments().isCleanupEnabled()) {
duties.add(new KillStalePendingSegments(overlordClient));
}

Expand All @@ -565,12 +570,17 @@ List<CoordinatorDuty> makeIndexingServiceDuties()

private List<CoordinatorDuty> makeMetadataStoreManagementDuties()
{
final CoordinatorKillConfigs killConfigs = config.getKillConfigs();
return Arrays.asList(
new KillSupervisors(config, metadataManager.supervisors()),
new KillAuditLog(config, metadataManager.audit()),
new KillRules(config, metadataManager.rules()),
new KillDatasourceMetadata(config, metadataManager.indexer(), metadataManager.supervisors()),
new KillCompactionConfig(config, metadataManager.segments(), metadataManager.configs())
new KillSupervisors(killConfigs.supervisors(), metadataManager.supervisors()),
new KillAuditLog(killConfigs.audit(), metadataManager.audit()),
new KillRules(killConfigs.rules(), metadataManager.rules()),
new KillDatasourceMetadata(
killConfigs.datasource(),
metadataManager.indexer(),
metadataManager.supervisors()
),
new KillCompactionConfig(killConfigs.compaction(), metadataManager.segments(), metadataManager.configs())
);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.druid.server.coordinator.config;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.common.config.Configs;
import org.joda.time.Duration;

public class CoordinatorKillConfigs
{
public static CoordinatorKillConfigs STANDARD
kfaraz marked this conversation as resolved.
Show resolved Hide resolved
= new CoordinatorKillConfigs(null, null, null, null, null, null, null, null, null, null, null, null);

@JsonProperty("supervisor")
private final MetadataCleanupConfig supervisors;
kfaraz marked this conversation as resolved.
Show resolved Hide resolved

@JsonProperty("audit")
private final MetadataCleanupConfig audit;

@JsonProperty("datasource")
private final MetadataCleanupConfig datasource;

@JsonProperty("rule")
private final MetadataCleanupConfig rules;
kfaraz marked this conversation as resolved.
Show resolved Hide resolved

@JsonProperty("compaction")
private final MetadataCleanupConfig compaction;

@JsonProperty("pendingSegments")
private final MetadataCleanupConfig pendingSegments;

// Raw configs for killing unused segments
// These have been added as fields because KillUnusedSegmentsConfig is initialized lazily
kfaraz marked this conversation as resolved.
Show resolved Hide resolved
@JsonProperty("on")
private final Boolean killUnusedEnabled;

@JsonProperty("period")
private final Duration killUnusedPeriod;

@JsonProperty("durationToRetain")
private final Duration killUnusedDurationToRetain;

@JsonProperty("ignoreDurationToRetain")
private final Boolean killUnusedIgnoreDurationToRetain;

@JsonProperty("bufferPeriod")
private final Duration killUnusedBufferPeriod;

@JsonProperty("maxSegments")
private final Integer killUnusedMaxSegments;

@JsonCreator
public CoordinatorKillConfigs(
@JsonProperty("pendingSegments") MetadataCleanupConfig pendingSegments,
@JsonProperty("supervisor") MetadataCleanupConfig supervisors,
@JsonProperty("audit") MetadataCleanupConfig audit,
@JsonProperty("datasource") MetadataCleanupConfig datasource,
@JsonProperty("rule") MetadataCleanupConfig rules,
@JsonProperty("compaction") MetadataCleanupConfig compaction,
// Configs for cleanup of unused segments
kfaraz marked this conversation as resolved.
Show resolved Hide resolved
@JsonProperty("on") Boolean killUnusedEnabled,
@JsonProperty("period") Duration killUnusedPeriod,
@JsonProperty("durationToRetain") Duration killUnusedDurationToRetain,
@JsonProperty("ignoreDurationToRetain") Boolean killUnusedIgnoreDurationToRetain,
@JsonProperty("bufferPeriod") Duration killUnusedBufferPeriod,
@JsonProperty("maxSegments") Integer killUnusedMaxSegments
)
{
this.pendingSegments = Configs.valueOrDefault(pendingSegments, MetadataCleanupConfig.STANDARD);
this.supervisors = Configs.valueOrDefault(supervisors, MetadataCleanupConfig.STANDARD);
this.audit = Configs.valueOrDefault(audit, MetadataCleanupConfig.STANDARD);
this.datasource = Configs.valueOrDefault(datasource, MetadataCleanupConfig.STANDARD);
this.rules = Configs.valueOrDefault(rules, MetadataCleanupConfig.STANDARD);
this.compaction = Configs.valueOrDefault(compaction, MetadataCleanupConfig.STANDARD);

this.killUnusedEnabled = killUnusedEnabled;
this.killUnusedPeriod = killUnusedPeriod;
this.killUnusedDurationToRetain = killUnusedDurationToRetain;
this.killUnusedBufferPeriod = killUnusedBufferPeriod;
this.killUnusedIgnoreDurationToRetain = killUnusedIgnoreDurationToRetain;
this.killUnusedMaxSegments = killUnusedMaxSegments;
}

public MetadataCleanupConfig audit()
{
return audit;
}

public MetadataCleanupConfig datasource()
{
return datasource;
}

public MetadataCleanupConfig rules()
{
return rules;
}

public MetadataCleanupConfig compaction()
{
return compaction;
}

public MetadataCleanupConfig pendingSegments()
{
return pendingSegments;
}

public MetadataCleanupConfig supervisors()
{
return supervisors;
}

/**
* Creates a KillUnusedSegmentsConfig.
*/
public KillUnusedSegmentsConfig unusedSegments(Duration indexingPeriod)
{
return new KillUnusedSegmentsConfig(
killUnusedEnabled,
Configs.valueOrDefault(killUnusedPeriod, indexingPeriod),
killUnusedDurationToRetain,
killUnusedIgnoreDurationToRetain,
killUnusedBufferPeriod,
killUnusedMaxSegments
);
}
}
Loading
Loading