Skip to content

Commit 4b3d184

Browse files
committed
refactor: Modify the internal abort interface to adapt the hadoop-3.3.4+, fixes #97
1 parent 4bcd877 commit 4b3d184

7 files changed

+13
-13
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.1</version>
9+
<version>8.2.2</version>
1010
<packaging>jar</packaging>
1111

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

src/main/java/org/apache/hadoop/fs/CosNExtendedFSDataOutputStream.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private void resumeForWrite() throws IOException {
117117
}
118118
} catch (Exception e) {
119119
LOG.error("Failed to resume for writing. Abort it.", e);
120-
super.abort();
120+
super.doAbort();
121121
throw new IOException(e);
122122
}
123123
}

src/main/java/org/apache/hadoop/fs/CosNFSDataOutputStream.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public synchronized void close() throws IOException {
238238
}
239239

240240
@Override
241-
public synchronized void abort() throws IOException {
241+
public synchronized void doAbort() throws IOException {
242242
if (this.closed) {
243243
return;
244244
}
@@ -652,7 +652,7 @@ protected void complete() throws IOException {
652652
PartETagList = this.partETags;
653653
}
654654
if (null == PartETagList) {
655-
throw new IOException("failed to multipart upload to cos, abort it.");
655+
throw new IOException("failed to multipart upload to cos, doAbort it.");
656656
}
657657

658658
// notice sometimes complete result may be null
@@ -673,7 +673,7 @@ protected void complete() throws IOException {
673673
protected void abort() throws IOException {
674674
LOG.info("Aborting the MPU [{}].", this.getUploadId());
675675
if (this.isCompleted() || this.isAborted()) {
676-
throw new IOException(String.format("fail to abort the MPU [%s]. "
676+
throw new IOException(String.format("fail to doAbort the MPU [%s]. "
677677
+ "It has been completed or aborted.", this.getUploadId()));
678678
}
679679
nativeStore.abortMultipartUpload(cosKey, this.uploadId);

src/main/java/org/apache/hadoop/fs/CosNSeekableFSDataOutputStream.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public boolean seekToNewSource(long pos) throws IOException {
4949
}
5050

5151
@Override
52-
public void abort() {
53-
this.seekableOutputStream.abort();
52+
public void doAbort() {
53+
this.seekableOutputStream.doAbort();
5454
}
5555

5656
@Override
@@ -170,9 +170,9 @@ public synchronized boolean seekToNewSource(long l) throws IOException {
170170
}
171171

172172
@Override
173-
public synchronized void abort() {
173+
public synchronized void doAbort() {
174174
if (this.closed) {
175-
// 已经关闭了,无需额外 abort
175+
// 已经关闭了,无需额外 doAbort
176176
return;
177177
}
178178

src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public PartETag uploadPartCopy(String uploadId, String srcKey, String destKey,
612612
}
613613

614614
public void abortMultipartUpload(String key, String uploadId) throws IOException {
615-
LOG.info("Ready to abort the multipart upload. cos key: {}, upload id: {}.", key, uploadId);
615+
LOG.info("Ready to doAbort the multipart upload. cos key: {}, upload id: {}.", key, uploadId);
616616

617617
try {
618618
AbortMultipartUploadRequest abortMultipartUploadRequest =

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
import java.io.IOException;
44

55
public interface Abortable {
6-
void abort() throws IOException;
6+
void doAbort() throws IOException;
77
}

src/main/java/org/apache/hadoop/fs/cosn/multipart/upload/MultipartManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,10 @@ private void releaseRemoteParts() {
550550
LOG.info("Begin to release remote parts for the cos key [{}]. upload id: {}.",
551551
cosKey, this.uploadId);
552552
try {
553-
// abort 掉远程块,就相当于清理掉云端的 parts 了。
553+
// doAbort 掉远程块,就相当于清理掉云端的 parts 了。
554554
nativeStore.abortMultipartUpload(cosKey, this.uploadId);
555555
} catch (IOException e) {
556-
// 如果 abort 发生异常,则原先的 partCopy 块就残留在云端了。不影响当前使用,只需要用户手动去存储桶清理一下即可。
556+
// 如果 doAbort 发生异常,则原先的 partCopy 块就残留在云端了。不影响当前使用,只需要用户手动去存储桶清理一下即可。
557557
LOG.warn("Abort the MPU [{}] for the cos key [{}].", this.uploadId, cosKey, e);
558558
}
559559
}

0 commit comments

Comments
 (0)