kfaraz commented on code in PR #15637: URL: https://github.com/apache/druid/pull/15637#discussion_r1445602972
########## indexing-service/src/main/java/org/apache/druid/indexing/common/actions/CleanMetadataAction.java: ########## @@ -0,0 +1,55 @@ +/* + * 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.core.type.TypeReference; +import org.apache.druid.indexing.common.task.Task; + +public class CleanMetadataAction implements TaskAction<Void> Review Comment: Please add a javadoc here. I would prefer using some kind of response object rather than void. This response object could potentially contain the information of whether the cleanup was successful or not, how many rows of which table were deleted, etc. (probably not needed in this PR, but let's return something meaningful anyway.) Also, rename: ```suggestion public class CleanupMetadataAction implements TaskAction<Void> ``` ########## server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java: ########## @@ -2267,7 +2267,8 @@ private String buildSqlToInsertSegments() * * @return Map from append Segment ID to REPLACE lock version */ - private Map<String, String> getAppendSegmentsCommittedDuringTask( + @VisibleForTesting Review Comment: Please don't do this. Try to find some other cleaner way to test this. ########## indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java: ########## @@ -108,8 +108,9 @@ public String setup(TaskToolbox toolbox) throws Exception }; task.run(toolbox); - // call it 3 times, once to update location in setup, then one for status and location in cleanup - Mockito.verify(taskActionClient, times(3)).submit(any()); + // call it 3 times, once to update location in setup, then one for status and location in cleanup, Review Comment: ```suggestion // call it 4 times, once to update location in setup, then one for status and location in cleanup, ``` ########## server/src/main/java/org/apache/druid/indexing/overlord/IndexerMetadataStorageCoordinator.java: ########## @@ -443,4 +443,10 @@ SegmentPublishResult commitMetadataOnly( * @return DataSegment used segment corresponding to given id */ DataSegment retrieveSegmentForId(String id, boolean includeUnused); + + /** + * Clean entries in upgrade segments table after the corresponding replace task has ended + * @param taskId - task id with the replace locks + */ + void cleanUpgradeSegmentsTableForTask(String taskId); Review Comment: ```suggestion void deleteUpgradeSegmentsForTask(String taskId); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
