mirror of https://github.com/apache/druid.git
[Minor]Add metadata-related logs and missing UT for kill tasks. (#10956)
* logs more info when delete segments && add deleteSegments-related UT * revert msic.xml * code review * use log.debugSegments Co-authored-by: yuezhang <yuezhang@freewheel.tv>
This commit is contained in:
parent
b0432be07a
commit
3277479ff7
|
@ -1278,9 +1278,14 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor
|
|||
@Override
|
||||
public Void inTransaction(Handle handle, TransactionStatus transactionStatus)
|
||||
{
|
||||
int segmentSize = segments.size();
|
||||
String dataSource = "";
|
||||
for (final DataSegment segment : segments) {
|
||||
dataSource = segment.getDataSource();
|
||||
deleteSegment(handle, segment);
|
||||
}
|
||||
log.debugSegments(segments, "Delete the metadata of segments");
|
||||
log.info("Removed [%d] segments from metadata storage for dataSource [%s]!", segmentSize, dataSource);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -848,6 +848,39 @@ public class IndexerSQLMetadataStorageCoordinatorTest
|
|||
Assert.assertNull("getDataSourceMetadataNullAfterDelete", coordinator.retrieveDataSourceMetadata("fooDataSource"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSegmentsInMetaDataStorage() throws IOException
|
||||
{
|
||||
// Published segments to MetaDataStorage
|
||||
coordinator.announceHistoricalSegments(SEGMENTS);
|
||||
|
||||
// check segments Published
|
||||
Assert.assertEquals(
|
||||
SEGMENTS,
|
||||
ImmutableSet.copyOf(
|
||||
coordinator.retrieveUsedSegmentsForInterval(
|
||||
defaultSegment.getDataSource(),
|
||||
defaultSegment.getInterval(),
|
||||
Segments.ONLY_VISIBLE
|
||||
)
|
||||
)
|
||||
);
|
||||
// remove segments in MetaDataStorage
|
||||
coordinator.deleteSegments(SEGMENTS);
|
||||
|
||||
// check segments removed
|
||||
Assert.assertEquals(
|
||||
0,
|
||||
ImmutableSet.copyOf(
|
||||
coordinator.retrieveUsedSegmentsForInterval(
|
||||
defaultSegment.getDataSource(),
|
||||
defaultSegment.getInterval(),
|
||||
Segments.ONLY_VISIBLE
|
||||
)
|
||||
).size()
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleAdditionalNumberedShardWithNoCorePartitions() throws IOException
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue