[BugFix] Support for using core-site.xml if load properties are not set in old broker load (#24804)

If there is no properties in the broker load command, it should roll
back to read the core-site.xml to apply.

Signed-off-by: miomiocat <284487410@qq.com>
This commit is contained in:
miomiocat 2023-06-07 16:35:29 +08:00 committed by GitHub
parent 46476458ca
commit bec9039df8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -745,9 +745,15 @@ public class FileSystemManager {
logger.info("could not find file system for path " + path + " create a new one");
// create a new filesystem
Configuration conf = new Configuration();
conf.set(FS_OSS_ACCESS_KEY, accessKey);
conf.set(FS_OSS_SECRET_KEY, secretKey);
conf.set(FS_OSS_ENDPOINT, endpoint);
if (!accessKey.isEmpty()) {
conf.set(FS_OSS_ACCESS_KEY, accessKey);
}
if (!secretKey.isEmpty()) {
conf.set(FS_OSS_SECRET_KEY, secretKey);
}
if (!endpoint.isEmpty()) {
conf.set(FS_OSS_ENDPOINT, endpoint);
}
conf.set(FS_OSS_IMPL, "org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem");
conf.set(FS_OSS_IMPL_DISABLE_CACHE, disableCache);
FileSystem ossFileSystem = FileSystem.get(pathUri.getUri(), conf);