Skip to content

Commit

Permalink
some debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
codope committed Jan 30, 2025
1 parent 65f922b commit e4e46aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public Map<ConfigProperty, String> upgrade(HoodieWriteConfig config, HoodieEngin
rollbackFailedWritesAndCompact(table, context, config, upgradeDowngradeHelper, HoodieTableType.MERGE_ON_READ.equals(table.getMetaClient().getTableType()), HoodieTableVersion.SIX);
try {
HoodieTableMetaClient.createTableLayoutOnStorage(context.getStorageConf(), new StoragePath(config.getBasePath()), config.getProps(), TimelineLayoutVersion.VERSION_2, false);
LOG.info(">>> Created table layout on storage for timeline layout version {}", TimelineLayoutVersion.VERSION_2);
} catch (IOException e) {
LOG.error("Failed to create table layout on storage for timeline layout version {}", TimelineLayoutVersion.VERSION_2, e);
throw new HoodieIOException("Failed to create table layout on storage", e);
Expand All @@ -121,6 +122,7 @@ public Map<ConfigProperty, String> upgrade(HoodieWriteConfig config, HoodieEngin
setInitialVersion(tableConfig, tablePropsToAdd);
upgradeKeyGeneratorType(tableConfig, tablePropsToAdd);
upgradeBootstrapIndexType(tableConfig, tablePropsToAdd);
LOG.info(">>> Upgraded table properties: {}", tablePropsToAdd);

// Handle timeline upgrade:
// - Rewrite instants in active timeline to new format
Expand All @@ -140,13 +142,17 @@ public Map<ConfigProperty, String> upgrade(HoodieWriteConfig config, HoodieEngin
CommitMetadataSerDeV2 commitMetadataSerDeV2 = new CommitMetadataSerDeV2();
CommitMetadataSerDeV1 commitMetadataSerDeV1 = new CommitMetadataSerDeV1();
ActiveTimelineV2 activeTimelineV2 = new ActiveTimelineV2(metaClient);
LOG.info(">>> Upgrading {} instants in active timeline", instants.size());
context.map(instants, instant -> {
String originalFileName = instantFileNameGenerator.getFileName(instant);
return upgradeActiveTimelineInstant(instant, originalFileName, metaClient, commitMetadataSerDeV1, commitMetadataSerDeV2, activeTimelineV2);
}, instants.size());
LOG.info(">>> Upgraded {} instants in active timeline", instants.size());
}

LOG.info(">>> Upgrading to LSM timeline");
upgradeToLSMTimeline(table, context, config);
LOG.info(">>> Upgraded to LSM timeline");

return tablePropsToAdd;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static void rollbackFailedWritesAndCompact(HoodieTable table, HoodieEngineContex
}
}
}
LOG.info(">>> Rollback and compaction completed successfully");
} catch (Exception e) {
throw new HoodieException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class TestSevenToEightUpgrade extends RecordLevelIndexTestBase {
hudiOptsWithoutLockConfigs
}

println(">>> write data")
doWriteAndValidateDataAndRecordIndex(hudiOpts,
operation = DataSourceWriteOptions.INSERT_OPERATION_OPT_VAL,
saveMode = SaveMode.Overwrite,
Expand All @@ -72,6 +73,7 @@ class TestSevenToEightUpgrade extends RecordLevelIndexTestBase {

// downgrade table props to version seven
// assert table version is seven and the partition fields in table config does not have partition type
println(">>> downgrade the table")
new UpgradeDowngrade(metaClient, getWriteConfig(hudiOpts), context, SparkUpgradeDowngradeHelper.getInstance)
.run(HoodieTableVersion.SEVEN, null)
metaClient = HoodieTableMetaClient.reload(metaClient)
Expand All @@ -82,10 +84,12 @@ class TestSevenToEightUpgrade extends RecordLevelIndexTestBase {

// auto upgrade the table
// assert table version is eight and the partition fields in table config has partition type
println(">>> auto upgrade the table and write more data")
doWriteAndValidateDataAndRecordIndex(hudiOpts,
operation = DataSourceWriteOptions.UPSERT_OPERATION_OPT_VAL,
saveMode = SaveMode.Append,
validate = false)
println(">>> auto upgrade and commit done")

metaClient = HoodieTableMetaClient.reload(metaClient)
assertEquals(HoodieTableVersion.EIGHT, metaClient.getTableConfig.getTableVersion)
Expand Down

0 comments on commit e4e46aa

Please sign in to comment.