Skip to content

Commit

Permalink
fix: create the posix_extension directory automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang733 committed Jan 11, 2023
1 parent 08cf862 commit 4bcd877
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.qcloud.cos</groupId>
<artifactId>hadoop-cos</artifactId>
<version>8.2.0</version>
<version>8.2.1</version>
<packaging>jar</packaging>

<name>Apache Hadoop Tencent Cloud COS Support</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ public synchronized void initialize(Configuration configuration) throws IOExcept
// 获取用户配置的 POSIX extension 特性目录
String cacheDirPath = configuration.get(
CosNConfigKeys.COSN_POSIX_EXTENSION_TMP_DIR, CosNConfigKeys.DEFAULT_POSIX_EXTENSION_TMP_DIR);
this.cacheDir = new File(cacheDirPath);
// 正式构建 MappedFactory 用于后续创建本地缓存文件
boolean deleteOnExit = configuration.getBoolean(
CosNConfigKeys.COSN_MAPDISK_DELETEONEXIT_ENABLED, CosNConfigKeys.DEFAULT_COSN_MAPDISK_DELETEONEXIT_ENABLED);
this.mappedBufferFactory = new CosNRandomAccessMappedBufferFactory(cacheDirPath, deleteOnExit);

this.cacheDir = new File(cacheDirPath);
// 检查当前目录空间是否足够
long usableSpace = this.cacheDir.getUsableSpace();
long usableSpace = this.cacheDir.getParentFile().getUsableSpace();
long quotaSize = configuration.getLong(CosNConfigKeys.COSN_POSIX_EXTENSION_TMP_DIR_QUOTA,
CosNConfigKeys.DEFAULT_COSN_POSIX_EXTENSION_TMP_DIR_QUOTA);
Preconditions.checkArgument(quotaSize <= usableSpace,
Expand All @@ -75,11 +79,6 @@ public synchronized void initialize(Configuration configuration) throws IOExcept
this.highWaterMarkRemainingSpace = (long) (quotaSize * (1 - highWaterMark));
this.lowWaterMarkRemainingSpace = (long) (quotaSize * (1 - lowWaterMark));

// 正式构建 MappedFactory 用于后续创建本地缓存文件
boolean deleteOnExit = configuration.getBoolean(
CosNConfigKeys.COSN_MAPDISK_DELETEONEXIT_ENABLED, CosNConfigKeys.DEFAULT_COSN_MAPDISK_DELETEONEXIT_ENABLED);
this.mappedBufferFactory = new CosNRandomAccessMappedBufferFactory(cacheDirPath, deleteOnExit);

this.referCount.incrementAndGet();
this.isInitialized.set(true);
}
Expand Down

0 comments on commit 4bcd877

Please sign in to comment.