diff --git a/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java b/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java index 8e92e9ef..c7023677 100644 --- a/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java +++ b/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java @@ -229,7 +229,4 @@ public class CosNConfigKeys extends CommonConfigurationKeys { public static final String COSN_FILESTATUS_LIST_OP_ENABLED = "fs.cosn.filestatus.list.op.enabled"; public static final boolean DEFAULT_FILESTATUS_LIST_OP_ENABLED = true; - - public static final String COSN_PART_CONFLICT_CHECK_ENABLED = "fs.cosn.part.conflict.check.enabled"; - public static final boolean DEFAULT_COSN_PART_CONFLICT_CHECK_ENABLED = true; } diff --git a/src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java b/src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java index e9c42e35..49160866 100644 --- a/src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java +++ b/src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java @@ -221,8 +221,6 @@ private void initCOSClient(URI uri, Configuration conf) throws IOException { CosNConfigKeys.DEFAULT_CRC32C_CHECKSUM_ENABLED); this.completeMPUCheckEnabled = conf.getBoolean(CosNConfigKeys.COSN_COMPLETE_MPU_CHECK, CosNConfigKeys.DEFAULT_COSN_COMPLETE_MPU_CHECK_ENABLE); - this.partConflictCheckEnabled = conf.getBoolean(CosNConfigKeys.COSN_PART_CONFLICT_CHECK_ENABLED, - CosNConfigKeys.DEFAULT_COSN_PART_CONFLICT_CHECK_ENABLED); this.clientEncryptionEnabled = conf.getBoolean(CosNConfigKeys.COSN_CLIENT_SIDE_ENCRYPTION_ENABLED, CosNConfigKeys.DEFAULT_COSN_CLIENT_SIDE_ENCRYPTION_ENABLED); @@ -570,26 +568,22 @@ public PartETag uploadPart(InputStream inputStream, String key, String uploadId, String errMsg = String.format("The current thread:%d, " + "cos key: %s, upload id: %s, part num: %d, exception: %s", Thread.currentThread().getId(), key, uploadId, partNum, cse); - if (!this.partConflictCheckEnabled) { - handleException(new Exception(errMsg), key); - } else { - int statusCode = cse.getStatusCode(); - if (409 == statusCode) { - // conflict upload same upload part, because of nginx syn retry, - // sometimes 31s reconnect to cgi, but client side default 30s timeout, - // which may cause the retry request and previous request arrive at cgi at same time. - // so we for now use list parts to double-check this part whether exist. - CosNPartListing partListing = listParts(key, uploadId); - PartETag partETag = isPartExist(partListing, partNum, partSize); - if (null == partETag) { - handleException(new Exception(errMsg), key); - } - LOG.warn("Upload the file [{}] uploadId [{}], part [{}] concurrently." + - key, uploadId, partNum); - return partETag; - } else { + int statusCode = cse.getStatusCode(); + if (409 == statusCode) { + // conflict upload same upload part, because of nginx syn retry, + // sometimes 31s reconnect to cgi, but client side default 30s timeout, + // which may cause the retry request and previous request arrive at cgi at same time. + // so we for now use list parts to double-check this part whether exist. + CosNPartListing partListing = listParts(key, uploadId); + PartETag partETag = isPartExist(partListing, partNum, partSize); + if (null == partETag) { handleException(new Exception(errMsg), key); } + LOG.warn("Upload the file [{}] uploadId [{}], part [{}] concurrently." + + key, uploadId, partNum); + return partETag; + } else { + handleException(new Exception(errMsg), key); } } catch (Exception e) { String errMsg = String.format("The current thread:%d, "