bvaradar commented on code in PR #11923:
URL: https://github.com/apache/hudi/pull/11923#discussion_r1835170241
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/EightToSevenDowngradeHandler.java:
##########
@@ -72,20 +81,43 @@ public Map<ConfigProperty, String>
downgrade(HoodieWriteConfig config, HoodieEng
HoodieTableMetaClient metaClient =
HoodieTableMetaClient.builder().setConf(context.getStorageConf().newInstance()).setBasePath(config.getBasePath()).build();
List<HoodieInstant> instants =
metaClient.getActiveTimeline().getInstants();
if (!instants.isEmpty()) {
+ InstantFileNameFactory instantFileNameFactory =
metaClient.getTimelineLayout().getInstantFileNameFactory();
+ CommitMetadataSerDeV2 commitMetadataSerDeV2 = new
CommitMetadataSerDeV2();
+ CommitMetadataSerDeV1 commitMetadataSerDeV1 = new
CommitMetadataSerDeV1();
+ ActiveTimelineV1 activeTimelineV1 = new ActiveTimelineV1(metaClient);
+ String tmpFilePrefix = "temp_commit_file_for_eight_to_seven_downgrade_";
context.map(instants, instant -> {
- if (instant.getFileName().contains(UNDERSCORE)) {
+ String fileName = instantFileNameFactory.getFileName(instant);
+ if (fileName.contains(UNDERSCORE)) {
try {
// Rename the metadata file name from the
${instant_time}_${completion_time}.action[.state] format in version 1.x to the
${instant_time}.action[.state] format in version 0.x.
- StoragePath fromPath = new StoragePath(metaClient.getMetaPath(),
instant.getFileName());
- StoragePath toPath = new StoragePath(metaClient.getMetaPath(),
instant.getFileName().replaceAll(UNDERSCORE + "\\d+", ""));
- boolean success = metaClient.getStorage().rename(fromPath, toPath);
+ StoragePath fromPath = new StoragePath(metaClient.getMetaPath(),
fileName);
+ StoragePath toPath = new StoragePath(metaClient.getMetaPath(),
fileName.replaceAll(UNDERSCORE + "\\d+", ""));
+ boolean success = true;
Review Comment:
Created [HUDI-8496](https://issues.apache.org/jira/browse/HUDI-8496) cc
@codope
--
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]