the-other-tim-brown commented on code in PR #11375:
URL: https://github.com/apache/hudi/pull/11375#discussion_r1625111858
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/table/action/TestCleanPlanner.java:
##########
@@ -160,6 +178,12 @@ void testPartitionsForIncrCleaning(HoodieWriteConfig
config, String earliestInst
mockLastCleanCommit(mockHoodieTable, lastCleanInstant,
earliestInstantsInLastClean, activeTimeline, cleanMetadataOptionPair);
mockFewActiveInstants(mockHoodieTable, activeInstantsPartitions,
savepointsTrackedInLastClean, areCommitsForSavepointsRemoved);
+ // mock getAllPartitions
+ HoodieStorage storage = mock(HoodieStorage.class);
+ when(mockHoodieTable.getStorage()).thenReturn(storage);
+ mockedStatic.when(() -> FSUtils.getAllPartitionPaths(context, storage,
config.getMetadataConfig(), config.getBasePath()))
Review Comment:
we could also update the CleanPlanner to use
`hoodieTable.getMetadataTable().getAllPartitionPaths()` which could make the
test setup cleaner as well
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/table/action/TestCleanPlanner.java:
##########
@@ -393,23 +417,23 @@ static Stream<Arguments>
keepLatestByHoursOrCommitsArgsIncrCleanPartitions() {
Map<String, List<String>> latestSavepoints = new HashMap<>();
latestSavepoints.put(savepoint2, Collections.singletonList(PARTITION1));
latestSavepoints.put(savepoint3, Collections.singletonList(PARTITION1));
-
arguments.addAll(buildArgumentsForCleanByHoursAndCommitsIncrCleanPartitionsCases(
+
arguments.addAll(buildArgumentsForCleanByHoursAndCommitsIncrCleanPartitionsCases(true,
earliestInstant, lastCompletedInLastClean, lastCleanInstant,
earliestInstantInLastClean, Collections.singletonList(PARTITION1),
Collections.singletonMap(savepoint2,
Collections.singletonList(PARTITION1)),
activeInstantsPartitionsMap2, latestSavepoints,
twoPartitionsInActiveTimeline, false));
// 2 savepoints were tracked in previous clean. one of them is removed in
latest. A partition which was part of the removed savepoint should be added in
final
// list of partitions to clean
Map<String, List<String>> previousSavepoints = new HashMap<>();
- latestSavepoints.put(savepoint2, Collections.singletonList(PARTITION1));
- latestSavepoints.put(savepoint3, Collections.singletonList(PARTITION2));
-
arguments.addAll(buildArgumentsForCleanByHoursAndCommitsIncrCleanPartitionsCases(
+ previousSavepoints.put(savepoint2, Collections.singletonList(PARTITION1));
+ previousSavepoints.put(savepoint3, Collections.singletonList(PARTITION2));
+
arguments.addAll(buildArgumentsForCleanByHoursAndCommitsIncrCleanPartitionsCases(true,
earliestInstant, lastCompletedInLastClean, lastCleanInstant,
earliestInstantInLastClean, Collections.singletonList(PARTITION1),
- previousSavepoints, activeInstantsPartitionsMap2,
Collections.singletonMap(savepoint3, Collections.singletonList(PARTITION2)),
twoPartitionsInActiveTimeline, false));
+ previousSavepoints, activeInstantsPartitionsMap2,
Collections.singletonMap(savepoint3, Collections.singletonList(PARTITION2)),
threePartitionsInActiveTimeline, false));
Review Comment:
Should the descriptions in the comments be updated to match the changes in
the expected partitions?
--
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]