Rajeev-01 commented on code in PR #13740:
URL: https://github.com/apache/hudi/pull/13740#discussion_r2290330723
##########
hudi-common/src/main/java/org/apache/hudi/common/util/ConfigUtils.java:
##########
@@ -685,11 +686,37 @@ public static TypedProperties fetchConfigs(
public static void recoverIfNeeded(HoodieStorage storage, StoragePath
cfgPath,
StoragePath backupCfgPath) throws
IOException {
+ boolean needCopy = false;
if (!storage.exists(cfgPath)) {
- // copy over from backup
- try (InputStream in = storage.open(backupCfgPath);
- OutputStream out = storage.create(cfgPath, false)) {
- FileIOUtils.copy(in, out);
+ needCopy = true;
+ } else {
+ TypedProperties props = new TypedProperties();
+ try (InputStream in = storage.open(cfgPath)) {
+ props.load(in);
+ if (!props.containsKey(TABLE_CHECKSUM.key()) ||
!HoodieTableConfig.validateChecksum(props)) {
+ // the cfg file is invalid
+ storage.deleteFile(cfgPath);
+ needCopy = true;
+ }
+ }
+ }
+ if (needCopy && storage.exists(backupCfgPath)) {
Review Comment:
Yeah that's true, but keeping the FS operations open for users, I just added
it as a preventive check 😅
--
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]