shangxinli commented on code in PR #20348:
URL: https://github.com/apache/hudi/pull/20348#discussion_r4304760757


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/NineToEightDowngradeHandler.java:
##########
@@ -78,6 +82,7 @@ public UpgradeDowngrade.TableConfigChangeSet 
downgrade(HoodieWriteConfig config,
                                                          
SupportsUpgradeDowngrade upgradeDowngradeHelper) {
     final HoodieTable table = upgradeDowngradeHelper.getTable(config, context);
     HoodieTableMetaClient metaClient = table.getMetaClient();
+    validateOrderingFields(metaClient.getTableConfig(), 
HoodieTableVersion.EIGHT);

Review Comment:
   nit: UpgradeDowngrade.run already validates this with the real target 
version before any handler runs, so this call only fires when the handler is 
driven directly, and it hardcodes 8 even for a 10 to 6 request.



##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/table/upgrade/TestNineToEightDowngradeHandler.java:
##########
@@ -251,6 +253,42 @@ void testDowngradeForOtherPayloadClass() {
     }
   }
 
+  @Test
+  void testDowngradeRefusesSeveralOrderingFields() {
+    try (MockedStatic<UpgradeDowngradeUtils> utilities = 
Mockito.mockStatic(UpgradeDowngradeUtils.class)) {
+      when(tableConfig.getOrderingFieldsStr()).thenReturn(Option.of("ts,seq"));
+      HoodieUpgradeDowngradeException exception = 
assertThrows(HoodieUpgradeDowngradeException.class,
+          () -> handler.downgrade(config, context, "anyInstant", 
upgradeDowngradeHelper));
+      assertEquals("Cannot downgrade to table version 8: 
hoodie.table.ordering.fields=ts,seq orders records on several fields, "

Review Comment:
   nit: three tests across three modules assert this message verbatim, so any 
wording tweak breaks all of them - matching on the ordering.fields part like 
the orchestration test does would be enough.



-- 
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]

Reply via email to