danny0405 commented on code in PR #12250:
URL: https://github.com/apache/hudi/pull/12250#discussion_r1841746148
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngradeUtils.java:
##########
@@ -107,4 +132,95 @@ static void updateMetadataTableVersion(HoodieEngineContext
context, HoodieTableV
throw new HoodieIOException("Error while updating metadata table
version", e);
}
}
+
+ static void upgradeToLSMTimeline(HoodieTable table, HoodieEngineContext
engineContext, HoodieWriteConfig config) {
+ // migrate archived timeline
+ LSMTimelineWriter lsmTimelineWriter =
LSMTimelineWriter.getInstance(config, table);
+ HoodieArchivedTimeline archivedTimeline =
table.getMetaClient().getArchivedTimeline();
+ Consumer<Exception> exceptionHandler = e -> {
+ if (config.isFailOnTimelineArchivingEnabled()) {
+ throw new HoodieException(e);
+ }
+ };
+
lsmTimelineWriter.write(Collections.singletonList(ActiveAction.fromInstants(archivedTimeline.getInstants())),
+ Option.of(action -> deleteAnyLeftOverMarkers(table, engineContext,
config, action)), Option.of(exceptionHandler));
+ }
+
+ static void downgradeFromLSMTimeline(HoodieTable table, HoodieEngineContext
engineContext, HoodieWriteConfig config) {
+ HoodieArchivedTimeline lsmArchivedTimeline =
table.getMetaClient().getArchivedTimeline();
+
+ Consumer<Exception> exceptionHandler = e -> {
+ if (config.isFailOnTimelineArchivingEnabled()) {
+ throw new HoodieException("Failed to downgrade LSM timeline to old
archived format", e);
+ }
+ };
+
+ // Migrate the LSM timeline back to the old archived timeline format
+ try {
+ // TODO: Convert instants from the LSM format to the old format
Review Comment:
We need timeline archiver v1 from Balaj's PR. cc @bvaradar
--
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]