From 487aa416809a2d255fbb3519fd768f2f9ff89eae Mon Sep 17 00:00:00 2001 From: aiceflower Date: Wed, 27 Sep 2023 14:11:47 +0800 Subject: [PATCH] update fun name --- .../apache/linkis/storage/utils/FileSystemUtils.scala | 11 +++++++++-- .../linkis/entrance/log/HDFSCacheLogWriter.scala | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala index 1f1ffb9edb..3eb234a964 100644 --- a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala +++ b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/FileSystemUtils.scala @@ -57,7 +57,7 @@ object FileSystemUtils extends Logging { val fileSystem = FSFactory.getFsByProxyUser(filePath, user).asInstanceOf[FileSystem] Utils.tryFinally { fileSystem.init(null) - createFileWithFileSystem(fileSystem, filePath, user, createParentWhenNotExists) + createNewFileWithFileSystem(fileSystem, filePath, user, createParentWhenNotExists) }(Utils.tryQuietly(fileSystem.close())) } @@ -83,7 +83,14 @@ object FileSystemUtils extends Logging { } } - def createFileWithFileSystem( + /** + * create new file and set file owner by FileSystem + * @param fileSystem + * @param filePath + * @param user + * @param createParentWhenNotExists + */ + def createNewFileAndSetOwnerWithFileSystem( fileSystem: FileSystem, filePath: FsPath, user: String, diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala index a272f1e8a1..4f37ff1040 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/log/HDFSCacheLogWriter.scala @@ -59,7 +59,12 @@ class HDFSCacheLogWriter(logPath: String, charset: String, sharedCache: Cache, u private def init(): Unit = { fileSystem.init(new util.HashMap[String, String]()) - FileSystemUtils.createNewFileWithFileSystem(fileSystem, new FsPath(logPath), user, true) + FileSystemUtils.createNewFileAndSetOwnerWithFileSystem( + fileSystem, + new FsPath(logPath), + user, + true + ) } @throws[IOException]