diff --git a/pom.xml b/pom.xml
index 71b40611..b81e7b74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.qcloud.cos
hadoop-cos
- 8.2.0
+ 8.2.1
jar
Apache Hadoop Tencent Cloud COS Support
diff --git a/src/main/java/org/apache/hadoop/fs/cosn/LocalRandomAccessMappedBufferPool.java b/src/main/java/org/apache/hadoop/fs/cosn/LocalRandomAccessMappedBufferPool.java
index eceecb7c..bb4196c2 100644
--- a/src/main/java/org/apache/hadoop/fs/cosn/LocalRandomAccessMappedBufferPool.java
+++ b/src/main/java/org/apache/hadoop/fs/cosn/LocalRandomAccessMappedBufferPool.java
@@ -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,
@@ -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);
}