-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Do not kill segments with referenced load specs from deep storage #16667
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
Merged
AmatyaAvadhanula
merged 20 commits into
apache:master
from
AmatyaAvadhanula:segment_kill_with_upgrades
Jul 15, 2024
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b93c574
Add root_segment_id to segment schema
AmatyaAvadhanula 6a68565
Fix DataSegmentPlus serde test
AmatyaAvadhanula 5905c35
Add kill task changes
AmatyaAvadhanula d3e487d
Fix test
AmatyaAvadhanula 5975563
Batch the metadata calls
AmatyaAvadhanula 80eefc7
Add new task action and other feedback
AmatyaAvadhanula 65ab152
Rename root_segment_id to upgraded_from_segment_id
AmatyaAvadhanula 7e7c0d5
Merge remote-tracking branch 'upstream/master' into segment_kill_with…
AmatyaAvadhanula 32c5ab9
Break up task action
AmatyaAvadhanula c20a15c
Merge remote-tracking branch 'upstream/master' into segment_kill_with…
AmatyaAvadhanula 4fa1265
Address most review comments
AmatyaAvadhanula 570b33a
Address feedback
AmatyaAvadhanula d57ca01
Address feedback
AmatyaAvadhanula 1224ea7
Move classes
AmatyaAvadhanula 8689595
suggested logic with failing tests
AmatyaAvadhanula 13e73b2
Merge remote-tracking branch 'upstream/master' into segment_kill_with…
AmatyaAvadhanula f54dd1a
Address review comments
AmatyaAvadhanula 4b69b24
Merge remote-tracking branch 'upstream/master' into segment_kill_with…
AmatyaAvadhanula ed553ab
Remove unneeded methods
AmatyaAvadhanula ebc8362
Add doc
AmatyaAvadhanula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
90 changes: 90 additions & 0 deletions
90
...n/java/org/apache/druid/indexing/common/actions/RetrieveUpgradedFromSegmentIdsAction.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /* | ||
| * 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.indexing.common.actions; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.core.type.TypeReference; | ||
| import org.apache.druid.indexing.common.task.Task; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Task action to retrieve the segment IDs from which a given set of segments were upgraded. | ||
| */ | ||
| public class RetrieveUpgradedFromSegmentIdsAction implements TaskAction<UpgradedFromSegmentsResponse> | ||
| { | ||
| private final String dataSource; | ||
| private final Set<String> segmentIds; | ||
|
|
||
| @JsonCreator | ||
| public RetrieveUpgradedFromSegmentIdsAction( | ||
| @JsonProperty("dataSource") String dataSource, | ||
| @JsonProperty("segmentIds") Set<String> segmentIds | ||
| ) | ||
| { | ||
| this.dataSource = dataSource; | ||
| this.segmentIds = segmentIds; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public String getDataSource() | ||
| { | ||
| return dataSource; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public Set<String> getSegmentIds() | ||
| { | ||
| return segmentIds; | ||
| } | ||
|
|
||
| @Override | ||
| public TypeReference<UpgradedFromSegmentsResponse> getReturnTypeReference() | ||
| { | ||
| return new TypeReference<UpgradedFromSegmentsResponse>() | ||
| { | ||
| }; | ||
| } | ||
|
|
||
| @Override | ||
| public UpgradedFromSegmentsResponse perform(Task task, TaskActionToolbox toolbox) | ||
| { | ||
| return new UpgradedFromSegmentsResponse( | ||
| toolbox.getIndexerMetadataStorageCoordinator() | ||
| .retrieveUpgradedFromSegmentIds(dataSource, segmentIds) | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isAudited() | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() | ||
| { | ||
| return getClass().getSimpleName() + "{" + | ||
| "dataSource='" + dataSource + '\'' + | ||
| ", segmentIds=" + segmentIds + | ||
| '}'; | ||
| } | ||
| } |
95 changes: 95 additions & 0 deletions
95
...ain/java/org/apache/druid/indexing/common/actions/RetrieveUpgradedToSegmentIdsAction.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /* | ||
| * 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.indexing.common.actions; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.core.type.TypeReference; | ||
| import org.apache.druid.indexing.common.task.Task; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Task action to determine the set of all segments containing the same load spec given the parent id. <br/> | ||
| * Returns a map from a segment ID to a set containing: | ||
| * <ol> | ||
| * <li> all segment IDs that were upgraded from it AND are still present in the metadata store </li> | ||
| * <li> the segment ID itself if and only if it is still present in the metadata store </li> | ||
| * </ol> | ||
| */ | ||
| public class RetrieveUpgradedToSegmentIdsAction implements TaskAction<UpgradedToSegmentsResponse> | ||
| { | ||
| private final String dataSource; | ||
| private final Set<String> segmentIds; | ||
|
|
||
| @JsonCreator | ||
| public RetrieveUpgradedToSegmentIdsAction( | ||
| @JsonProperty("dataSource") String dataSource, | ||
| @JsonProperty("segmentIds") Set<String> segmentIds | ||
| ) | ||
| { | ||
| this.dataSource = dataSource; | ||
| this.segmentIds = segmentIds; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public String getDataSource() | ||
| { | ||
| return dataSource; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public Set<String> getSegmentIds() | ||
| { | ||
| return segmentIds; | ||
| } | ||
|
|
||
| @Override | ||
| public TypeReference<UpgradedToSegmentsResponse> getReturnTypeReference() | ||
| { | ||
| return new TypeReference<UpgradedToSegmentsResponse>() | ||
| { | ||
| }; | ||
| } | ||
|
|
||
| @Override | ||
| public UpgradedToSegmentsResponse perform(Task task, TaskActionToolbox toolbox) | ||
| { | ||
| return new UpgradedToSegmentsResponse( | ||
| toolbox.getIndexerMetadataStorageCoordinator() | ||
| .retrieveUpgradedToSegmentIds(dataSource, segmentIds) | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isAudited() | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() | ||
| { | ||
| return getClass().getSimpleName() + "{" + | ||
| "dataSource='" + dataSource + '\'' + | ||
| ", segmentIds=" + segmentIds + | ||
| '}'; | ||
| } | ||
| } |
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
44 changes: 44 additions & 0 deletions
44
.../src/main/java/org/apache/druid/indexing/common/actions/UpgradedFromSegmentsResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * 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.indexing.common.actions; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| public class UpgradedFromSegmentsResponse | ||
| { | ||
| private final Map<String, String> upgradedFromSegmentIds; | ||
|
|
||
| @JsonCreator | ||
| public UpgradedFromSegmentsResponse( | ||
| @JsonProperty("upgradedFromSegmentIds") Map<String, String> upgradedFromSegmentIds | ||
| ) | ||
| { | ||
| this.upgradedFromSegmentIds = upgradedFromSegmentIds; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public Map<String, String> getUpgradedFromSegmentIds() | ||
| { | ||
| return upgradedFromSegmentIds; | ||
| } | ||
| } |
46 changes: 46 additions & 0 deletions
46
...ce/src/main/java/org/apache/druid/indexing/common/actions/UpgradedToSegmentsResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * 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.indexing.common.actions; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| public class UpgradedToSegmentsResponse | ||
| { | ||
|
|
||
| private final Map<String, Set<String>> upgradedToSegmentIds; | ||
|
|
||
| @JsonCreator | ||
| public UpgradedToSegmentsResponse( | ||
| @JsonProperty("upgradedToSegmentIds") Map<String, Set<String>> upgradedToSegmentIds | ||
| ) | ||
| { | ||
| this.upgradedToSegmentIds = upgradedToSegmentIds; | ||
| } | ||
|
|
||
| @JsonProperty | ||
| public Map<String, Set<String>> getUpgradedToSegmentIds() | ||
| { | ||
| return upgradedToSegmentIds; | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.