You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/10/20 15:56:00 UTC

[jira] [Work logged] (HADOOP-17308) WASB : PageBlobOutputStream succeeding hflush even when underlying flush to storage failed

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

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

                Author: ASF GitHub Bot
            Created on: 20/Oct/20 15:55
            Start Date: 20/Oct/20 15:55
    Worklog Time Spent: 10m 
      Work Description: steveloughran commented on a change in pull request #2392:
URL: https://github.com/apache/hadoop/pull/2392#discussion_r508639118



##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/ITestPageBlobOutputStream.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.fs.azure;
+
+import java.io.IOException;
+import java.util.EnumSet;
+
+import org.junit.Test;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.test.LambdaTestUtils;
+
+public class ITestPageBlobOutputStream extends AbstractWasbTestBase {
+
+  private static final Path TEST_FILE_PATH = new Path(
+      "TestPageBlobOutputStream.txt");
+
+  @Override
+  protected AzureBlobStorageTestAccount createTestAccount() throws Exception {
+    Configuration conf = new Configuration();
+    // Configure the page blob directories key so every file created is a page
+    // blob.
+    conf.set(AzureNativeFileSystemStore.KEY_PAGE_BLOB_DIRECTORIES, "/");
+    return AzureBlobStorageTestAccount.create("testpagebloboutputstream",
+        EnumSet.of(AzureBlobStorageTestAccount.CreateOptions.CreateContainer),
+        conf, true);
+  }
+
+  @Test
+  public void testHFlush() throws Exception {
+    Path path = this.fs.makeQualified(TEST_FILE_PATH);

Review comment:
       drop all the `this.` prefixes

##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/ITestPageBlobOutputStream.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.fs.azure;
+
+import java.io.IOException;
+import java.util.EnumSet;
+
+import org.junit.Test;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.test.LambdaTestUtils;
+
+public class ITestPageBlobOutputStream extends AbstractWasbTestBase {
+
+  private static final Path TEST_FILE_PATH = new Path(
+      "TestPageBlobOutputStream.txt");
+
+  @Override
+  protected AzureBlobStorageTestAccount createTestAccount() throws Exception {
+    Configuration conf = new Configuration();
+    // Configure the page blob directories key so every file created is a page
+    // blob.
+    conf.set(AzureNativeFileSystemStore.KEY_PAGE_BLOB_DIRECTORIES, "/");
+    return AzureBlobStorageTestAccount.create("testpagebloboutputstream",
+        EnumSet.of(AzureBlobStorageTestAccount.CreateOptions.CreateContainer),
+        conf, true);
+  }
+
+  @Test
+  public void testHFlush() throws Exception {
+    Path path = this.fs.makeQualified(TEST_FILE_PATH);
+    FSDataOutputStream os = this.fs.create(path);

Review comment:
       can you close this afterwards? Be interesting to see what happens




----------------------------------------------------------------
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:
users@infra.apache.org


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

    Worklog Id:     (was: 502756)
    Time Spent: 0.5h  (was: 20m)

> WASB : PageBlobOutputStream succeeding hflush even when underlying flush to storage failed 
> -------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-17308
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17308
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.7.0
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>            Priority: Critical
>              Labels: HBASE, pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In PageBlobOutputStream, write()  APIs will fill the buffer and hflush/hsync/flush call will flush the buffer to underlying storage. Here the Azure calls are handled in another thread 
> {code}
> private synchronized void flushIOBuffers()  {
>     ...
>     lastQueuedTask = new WriteRequest(outBuffer.toByteArray());
>     ioThreadPool.execute(lastQueuedTask);
>   ....
>  }
> private class WriteRequest implements Runnable {
>     private final byte[] dataPayload;
>     private final CountDownLatch doneSignal = new CountDownLatch(1);
>     public WriteRequest(byte[] dataPayload) {
>       this.dataPayload = dataPayload;
>     }
>     public void waitTillDone() throws InterruptedException {
>       doneSignal.await();
>     }
>     @Override
>     public void run() {
>       try {
>         LOG.debug("before runInternal()");
>         runInternal();
>         LOG.debug("after runInternal()");
>       } finally {
>         doneSignal.countDown();
>       }
>     }
>     private void runInternal() {
>       ......
>       writePayloadToServer(rawPayload);
>       ...........
>     }
>     private void writePayloadToServer(byte[] rawPayload) {
>       ......
>       try {
>         blob.uploadPages(wrapperStream, currentBlobOffset, rawPayload.length,
>             withMD5Checking(), PageBlobOutputStream.this.opContext);
>       } catch (IOException ex) {
>         lastError = ex;
>       } catch (StorageException ex) {
>         lastError = new IOException(ex);
>       }
>       if (lastError != null) {
>         LOG.debug("Caught error in PageBlobOutputStream#writePayloadToServer()");
>       }
>     }
>   }
> {code}
> The flushing thread will wait for the other thread to complete the Runnable WriteRequest. Thats fine. But when some exception happened while blob.uploadPages, we just set that to lastError state variable.  This variable is been checked for all subsequent ops like write, flush etc.  But what about the current flush call? that is silently being succeeded.!!  
> In standard Azure backed HBase clusters WAL is on page blob. This issue causes a serious issue in HBase and causes data loss! HBase think a WAL write was hflushed and make row write successful. In fact the row was never gone to storage.
> Checking the lastError variable at the end of flush op will solve the issue. Then we will throw IOE from this flush() itself.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org