Skip to content

Commit 4bcd877

Browse files
committed
fix: create the posix_extension directory automatically
1 parent 08cf862 commit 4bcd877

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qcloud.cos</groupId>
88
<artifactId>hadoop-cos</artifactId>
9-
<version>8.2.0</version>
9+
<version>8.2.1</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Apache Hadoop Tencent Cloud COS Support</name>

src/main/java/org/apache/hadoop/fs/cosn/LocalRandomAccessMappedBufferPool.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ public synchronized void initialize(Configuration configuration) throws IOExcept
5050
// 获取用户配置的 POSIX extension 特性目录
5151
String cacheDirPath = configuration.get(
5252
CosNConfigKeys.COSN_POSIX_EXTENSION_TMP_DIR, CosNConfigKeys.DEFAULT_POSIX_EXTENSION_TMP_DIR);
53-
this.cacheDir = new File(cacheDirPath);
53+
// 正式构建 MappedFactory 用于后续创建本地缓存文件
54+
boolean deleteOnExit = configuration.getBoolean(
55+
CosNConfigKeys.COSN_MAPDISK_DELETEONEXIT_ENABLED, CosNConfigKeys.DEFAULT_COSN_MAPDISK_DELETEONEXIT_ENABLED);
56+
this.mappedBufferFactory = new CosNRandomAccessMappedBufferFactory(cacheDirPath, deleteOnExit);
5457

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

78-
// 正式构建 MappedFactory 用于后续创建本地缓存文件
79-
boolean deleteOnExit = configuration.getBoolean(
80-
CosNConfigKeys.COSN_MAPDISK_DELETEONEXIT_ENABLED, CosNConfigKeys.DEFAULT_COSN_MAPDISK_DELETEONEXIT_ENABLED);
81-
this.mappedBufferFactory = new CosNRandomAccessMappedBufferFactory(cacheDirPath, deleteOnExit);
82-
8382
this.referCount.incrementAndGet();
8483
this.isInitialized.set(true);
8584
}

0 commit comments

Comments
 (0)