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
add interface to auto clean mysql pendingSegments table #3831
Conversation
…aSegment.java to struct the task table’s data, add getNotActiveTask and deletePendingSegments in IndexerSQLMetadataStorageCoordinator.java to finish the delete logic, add test in TestIndexerMetadataStorageCoordinator.java.
deletePendingSegment’s sql -> “DELETE from %1s WHERE sequence_name LIKE '%2s%%” and format other code
…aSegment.java to struct the task table’s data, add getNotActiveTask and deletePendingSegments in IndexerSQLMetadataStorageCoordinator.java to finish the delete logic, add test in TestIndexerMetadataStorageCoordinator.java.
deletePendingSegment’s sql -> “DELETE from %1s WHERE sequence_name LIKE '%2s%%” and format other code
@KurtYoung can you take a look? |
@@ -0,0 +1,94 @@ | |||
package io.druid.timeline; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing license header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haoxiang47 there are many whitespace changes, can we please revert them?
https://github.com/druid-io/druid/pull/3831/files?w=1 indicates there's only new code added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import java.util.Map; | ||
|
||
/** | ||
* Created by haoxiang on 16/11/11. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we generally dont have author info
this.interval = interval; | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a weird comment
@@ -121,6 +124,12 @@ public void deleteSegments(Set<DataSegment> segments) | |||
} | |||
|
|||
@Override | |||
public List<TaskDataSegment> getNotActiveTask(final Interval interval){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InactiveTasks*
@@ -39,10 +40,12 @@ | |||
final private Set<DataSegment> published = Sets.newConcurrentHashSet(); | |||
final private Set<DataSegment> nuked = Sets.newConcurrentHashSet(); | |||
final private List<DataSegment> unusedSegments; | |||
final private List<TaskDataSegment> taskDataSegments; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inactiveTaskSegments
* @param interval Filter the tasks to ones that include tasks in this interval exclusively. Start is inclusive, end is exclusive | ||
* @return The TaskDataSegment list which used to match the pendingSegment table's payload | ||
*/ | ||
List<TaskDataSegment> getNotActiveTask(final Interval interval); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InactiveTasks
private final Interval interval; | ||
|
||
@JsonCreator | ||
public TaskDataSegment( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure this class is needed? What is the class used for serde when writing to pending Segments table?
@gianm is there any possible race condition where active=0 but we still need the segment? |
@fjy Yeah, i will take a look. @haoxiang47 thanks for your work, and i think it's better to keep the code style consistent with current project, it contains too many spaces and format changes, make it hard to see what exactly had been changed. |
Yeah thanks for review, I will keep the code style first and update my code, so excepet the code style, if there has any other problem? My logic will simplely like this: compare the druid_tasks and druid_pendingSegments, find the dataset which 'active' is 0 in druid_tasks and match the sequence_name in druid_pendingSegments and baseSequenceName in druid_tasks's payload ioConfig parameter which type is kafka. and then I have the question that where should this interface to action? maybe in overlord or kafka supervisior? |
For the issue 3565, I finished the interface to delete unused pendingSeglments, add TaskDataSegment.java to struct the task table’s data, add getNotActiveTask and deletePendingSegments in IndexerSQLMetadataStorageCoordinator.java to finish the delete logic, add test in TestIndexerMetadataStorageCoordinator.java.