Rajeev-01 commented on code in PR #13740:
URL: https://github.com/apache/hudi/pull/13740#discussion_r2290606800
##########
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:
I mean a user can access to the file system and they can perform ops. Let me
remove that check which removes the extra file system call and also keeps the
`HoodieTableConfig#modify` method nature as it is.
--
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]