zachjsh commented on code in PR #15738:
URL: https://github.com/apache/druid/pull/15738#discussion_r1467959063
##########
server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java:
##########
@@ -3343,6 +3503,64 @@ private ImmutableList<DataSegment>
retrieveUnusedSegments(
);
}
+ private ImmutableList<DataSegmentPlus> retrieveUnusedSegmentsPlus(
+ final List<Interval> intervals,
+ final Integer limit,
+ final String lastSegmentId,
+ final SortOrder sortOrder,
+ final DateTime maxUsedStatusLastUpdatedTime
+ )
+ {
+ return derbyConnector.inReadOnlyTransaction(
+ (handle, status) -> {
+ try (final CloseableIterator<DataSegmentPlus> iterator =
+ SqlSegmentsMetadataQuery.forHandle(
+ handle,
+ derbyConnector,
+
derbyConnectorRule.metadataTablesConfigSupplier().get(),
+ mapper
+ )
+ .retrieveUnusedSegmentsPlus(DS.WIKI, intervals, limit,
lastSegmentId, sortOrder, maxUsedStatusLastUpdatedTime)) {
+ return ImmutableList.copyOf(iterator);
+ }
+ }
+ );
+ }
+
+ private void verifyContainsAllSegmentsPlus(
+ List<DataSegment> expectedSegments,
+ List<DataSegmentPlus> actualUnusedSegments,
Review Comment:
fixed
##########
server/src/test/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinatorTest.java:
##########
@@ -3343,6 +3503,64 @@ private ImmutableList<DataSegment>
retrieveUnusedSegments(
);
}
+ private ImmutableList<DataSegmentPlus> retrieveUnusedSegmentsPlus(
+ final List<Interval> intervals,
+ final Integer limit,
+ final String lastSegmentId,
+ final SortOrder sortOrder,
+ final DateTime maxUsedStatusLastUpdatedTime
+ )
+ {
+ return derbyConnector.inReadOnlyTransaction(
+ (handle, status) -> {
+ try (final CloseableIterator<DataSegmentPlus> iterator =
+ SqlSegmentsMetadataQuery.forHandle(
+ handle,
+ derbyConnector,
+
derbyConnectorRule.metadataTablesConfigSupplier().get(),
+ mapper
+ )
+ .retrieveUnusedSegmentsPlus(DS.WIKI, intervals, limit,
lastSegmentId, sortOrder, maxUsedStatusLastUpdatedTime)) {
+ return ImmutableList.copyOf(iterator);
+ }
+ }
+ );
+ }
+
+ private void verifyContainsAllSegmentsPlus(
+ List<DataSegment> expectedSegments,
+ List<DataSegmentPlus> actualUnusedSegments,
+ DateTime usedStatusLastUpdatedTime)
+ {
+ Map<SegmentId, DataSegment> expectedIdToSegment =
expectedSegments.stream().collect(Collectors.toMap(DataSegment::getId,
Function.identity()));
+ Map<SegmentId, DataSegmentPlus> actualIdToSegmentDto =
actualUnusedSegments.stream()
+ .collect(Collectors.toMap(d -> d.getDataSegment().getId(),
Function.identity()));
+ Assert.assertTrue(expectedIdToSegment.entrySet().stream().allMatch(e -> {
+ DataSegmentPlus segmentDto = actualIdToSegmentDto.get(e.getKey());
+ return segmentDto != null
+ && !segmentDto.getCreatedDate().isAfter(usedStatusLastUpdatedTime)
+ && segmentDto.getUsedStatusLastUpdatedDate() != null
+ &&
segmentDto.getUsedStatusLastUpdatedDate().equals(usedStatusLastUpdatedTime);
+ }));
+ }
+
+ private void verifyEqualsAllSegmentsPlus(
+ List<DataSegment> expectedSegments,
+ List<DataSegmentPlus> actualUnusedSegments,
Review Comment:
fixed
--
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]