prashantwason commented on code in PR #19661:
URL: https://github.com/apache/hudi/pull/19661#discussion_r4210907274
##########
hudi-spark-datasource/hudi-spark/src/test/java/org/apache/hudi/table/action/rollback/TestCopyOnWriteRollbackActionExecutor.java:
##########
@@ -601,7 +601,7 @@ public void testRollbackWhenReplaceCommitIsPresent() throws
Exception {
String rollbackInstant = WriteClientTestUtils.createNewInstantTime();
BaseRollbackPlanActionExecutor copyOnWriteRollbackPlanActionExecutor =
new BaseRollbackPlanActionExecutor(context, table.getConfig(), table,
rollbackInstant, needRollBackInstant, false,
- !table.getConfig().shouldRollbackUsingMarkers(), false);
+ table.getConfig().shouldRollbackUsingMarkers(), false,
Option.empty());
Review Comment:
Not intentional — good catch. Restored the original
`!table.getConfig().shouldRollbackUsingMarkers()` (matching master) in
1f7ed7f02b4f.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/restore/CopyOnWriteRestoreActionExecutor.java:
##########
@@ -53,7 +53,7 @@ protected HoodieRollbackMetadata
rollbackInstant(HoodieInstant instantToRollback
transactionManager.beginStateChange(Option.empty(), Option.empty());
try {
newInstantTime = table.getMetaClient().createNewInstantTime(false);
- table.scheduleRollback(context, newInstantTime, instantToRollback,
false, false, true);
+ table.scheduleRollback(context, newInstantTime, instantToRollback,
false, false, true, Option.empty());
Review Comment:
Agreed, these should be enriched too. All internally scheduled rollbacks now
pass `CommitMetadataProperties.enrich(Option.empty(), config, context)`: both
restore executors and the `rollbackInflightInstant` /
`rollbackInflightLogCompaction` paths in `HoodieTable` (1f7ed7f02b4f), plus the
pending-clustering rollback in `BaseSparkCommitActionExecutor` (2aaff7f8cdc9).
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/table/TestBaseHoodieTable.java:
##########
@@ -130,7 +130,8 @@ public HoodieCleanMetadata clean(HoodieEngineContext
context, String cleanInstan
@Override
public Option<HoodieRollbackPlan> scheduleRollback(HoodieEngineContext
context, String instantTime, HoodieInstant instantToRollback,
- boolean
skipTimelinePublish, boolean shouldRollbackUsingMarkers, boolean isRestore) {
+ boolean
skipTimelinePublish, boolean shouldRollbackUsingMarkers, boolean isRestore,
+ Option extraMetadata) {
countOfScheduleRollbackFunctionCalls++;
Review Comment:
Keeping the raw `Option` here intentionally: `TestBaseHoodieTable` extends
the raw `HoodieTable`, so the inherited abstract methods are erased. Declaring
the parameter as `Option<Map<String, String>>` does not override — javac
reports a name clash ("have the same erasure, yet neither overrides the
other"). This matches every other override in this stub (`createCleanerPlan`,
`scheduleClustering`, `scheduleCompaction`, etc.).
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/TestCommitMetadataProperties.java:
##########
@@ -155,6 +164,120 @@ void enrich_preservesCallerProvidedKeys() {
assertNotNull(result.get(HUDI_VERSION_KEY));
}
+ // ---- Tests for extraMetadata in all instant types ----
+
+ @Test
+ void rollbackPlan_extraMetadataFieldPresent() {
+ Map<String, String> extraMetadata = new HashMap<>();
+ extraMetadata.put(HUDI_VERSION_KEY, "1.2.0");
+ extraMetadata.put(ENGINE_KEY, "SPARK");
+
+ HoodieRollbackPlan plan = new HoodieRollbackPlan(
+ new HoodieInstantInfo("001", "commit"),
+ Collections.emptyList(), 1, extraMetadata);
+
+ assertEquals("1.2.0", plan.getExtraMetadata().get(HUDI_VERSION_KEY));
+ assertEquals("SPARK", plan.getExtraMetadata().get(ENGINE_KEY));
+ }
+
+ @Test
+ void rollbackPlan_extraMetadataNullByDefault() {
+ HoodieRollbackPlan plan = new HoodieRollbackPlan(
+ new HoodieInstantInfo("001", "commit"),
+ Collections.emptyList(), 1, null);
Review Comment:
Done — switched all four `assertEquals(null, ...)` calls to
`assertNull(...)` in 1f7ed7f02b4f.
--
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]