[ 
https://issues.apache.org/jira/browse/HADOOP-16906?focusedWorklogId=548597&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-548597
 ]

ASF GitHub Bot logged work on HADOOP-16906:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Feb/21 11:45
            Start Date: 05/Feb/21 11:45
    Worklog Time Spent: 10m 
      Work Description: mukund-thakur commented on a change in pull request 
#2667:
URL: https://github.com/apache/hadoop/pull/2667#discussion_r570770903



##########
File path: 
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java
##########
@@ -541,6 +542,10 @@ public boolean hasCapability(String capability) {
     case StreamCapabilities.IOSTATISTICS:
       return true;
 
+      // S3A supports abort.
+    case StreamCapabilities.ABORTABLE:

Review comment:
       We can merge both case statements

##########
File path: 
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABlockOutputArray.java
##########
@@ -155,4 +156,22 @@ public void testMarkReset() throws Throwable {
     markAndResetDatablock(createFactory(getFileSystem()));
   }
 
+  @Test
+  public void testAbortAfterWrite() throws Throwable {
+    Path dest = path("testAbortAfterWrite");

Review comment:
       use getMethodName()

##########
File path: 
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java
##########
@@ -551,6 +556,24 @@ public IOStatistics getIOStatistics() {
     return iostatistics;
   }
 
+  @Override
+  public void abort() {
+    if (closed.getAndSet(true)) {
+      // already closed
+      LOG.debug("Ignoring abort() as stream is already closed");
+      return;
+    }
+
+    S3ADataBlocks.DataBlock block = getActiveBlock();
+    try {
+      if (multiPartUpload != null) {

Review comment:
       Got it,we are closing the stream before only. 

##########
File path: 
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java
##########
@@ -551,6 +556,24 @@ public IOStatistics getIOStatistics() {
     return iostatistics;
   }
 
+  @Override
+  public void abort() {
+    if (closed.getAndSet(true)) {
+      // already closed
+      LOG.debug("Ignoring abort() as stream is already closed");
+      return;
+    }
+
+    S3ADataBlocks.DataBlock block = getActiveBlock();
+    try {
+      if (multiPartUpload != null) {

Review comment:
       Wondering what happens in case of non multipart upload

##########
File path: 
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABlockOutputArray.java
##########
@@ -155,4 +156,22 @@ public void testMarkReset() throws Throwable {
     markAndResetDatablock(createFactory(getFileSystem()));
   }
 
+  @Test
+  public void testAbortAfterWrite() throws Throwable {
+    Path dest = path("testAbortAfterWrite");
+    describe(" testAbortAfterWrite");

Review comment:
       nit: A bit more explanatory.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 548597)
    Time Spent: 2h 20m  (was: 2h 10m)

> Add some Abortable.abort() interface for streams etc which can be terminated
> ----------------------------------------------------------------------------
>
>                 Key: HADOOP-16906
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16906
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs, fs/azure, fs/s3
>    Affects Versions: 3.3.0
>            Reporter: Steve Loughran
>            Assignee: Jungtaek Lim
>            Priority: Blocker
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Some IO we want to be able to abort rather than close cleanly, especially if 
> the inner stream is an HTTP connection which itself supports some abort() 
> method. For example: uploads to an object where we want to cancel the upload 
> without close() making an incomplete write visible.
> Proposed: Add a generic interface which things like streams can implement
> {code}
> AbortableIO {
>   public void abortIO() throws IOE;
> }
> {code}
> +do for s3a output stream. I wouldn't do this a passthrough on 
> FSDataOutputStream because we need to consider what expectations callers have 
> of an operation being "aborted"



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to