You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jojochuang (via GitHub)" <gi...@apache.org> on 2023/02/25 14:33:33 UTC

[GitHub] [ozone] jojochuang opened a new pull request, #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

jojochuang opened a new pull request, #4316:
URL: https://github.com/apache/ozone/pull/4316

   
   ## What changes were proposed in this pull request?
   StreamCapabilities.hasCapability(HSYNC) does not return true for encrypted buckets.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-8029
   
   ## How was this patch tested?
   
   Unit test + Manually tested on a HBase cluster


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] kerneltime commented on pull request #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on PR #4316:
URL: https://github.com/apache/ozone/pull/4316#issuecomment-1446707507

   cc @swamirishi please take a look


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] jojochuang commented on a diff in pull request #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on code in PR #4316:
URL: https://github.com/apache/ozone/pull/4316#discussion_r1123164902


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java:
##########
@@ -248,5 +260,34 @@ public void testECStreamCapability() throws Exception {
       assertFalse(os.hasCapability(StreamCapabilities.HSYNC),
           "ECKeyOutputStream should not support hsync()!");
     }
+    testEncryptedStreamCapabilities(true);
+  }
+
+  private void testEncryptedStreamCapabilities(boolean isEC) throws IOException,
+      GeneralSecurityException {
+    KeyOutputStream kos;
+    if (isEC) {
+      kos = mock(KeyOutputStream.class);
+    } else {
+      kos = mock(ECKeyOutputStream.class);
+    }

Review Comment:
   omg thanks for catching the typo.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] jojochuang commented on pull request #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on PR #4316:
URL: https://github.com/apache/ozone/pull/4316#issuecomment-1454003406

   Test passed and review comments addressed. Thanks all for the review!


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] jojochuang merged pull request #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang merged PR #4316:
URL: https://github.com/apache/ozone/pull/4316


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] adoroszlai commented on a diff in pull request #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #4316:
URL: https://github.com/apache/ozone/pull/4316#discussion_r1119257067


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java:
##########
@@ -248,5 +260,34 @@ public void testECStreamCapability() throws Exception {
       assertFalse(os.hasCapability(StreamCapabilities.HSYNC),
           "ECKeyOutputStream should not support hsync()!");
     }
+    testEncryptedStreamCapabilities(true);
+  }
+
+  private void testEncryptedStreamCapabilities(boolean isEC) throws IOException,
+      GeneralSecurityException {
+    KeyOutputStream kos;
+    if (isEC) {
+      kos = mock(KeyOutputStream.class);
+    } else {
+      kos = mock(ECKeyOutputStream.class);
+    }

Review Comment:
   Nit: the name and meaning of `isEC` are inverse (i.e. it tests EC when `isEC=false`).  But the end result is the same, both cases are covered.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [ozone] swamirishi commented on a diff in pull request #4316: HDDS-8029. [hsync] Outputstream in encrypted buckets do not return the correct stream capabilities.

Posted by "swamirishi (via GitHub)" <gi...@apache.org>.
swamirishi commented on code in PR #4316:
URL: https://github.com/apache/ozone/pull/4316#discussion_r1119431517


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/CapableOzoneFSOutputStream.java:
##########
@@ -44,6 +45,15 @@ public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream) {
   @Override
   public boolean hasCapability(String capability) {
     OutputStream os = getWrappedOutputStream().getOutputStream();
+
+    if (os instanceof CryptoOutputStream) {
+      OutputStream wrapped = ((CryptoOutputStream) os).getWrappedStream();
+      return hasWrappedCapability(wrapped, capability);
+    }
+    return hasWrappedCapability(os, capability);
+  }
+
+  private boolean hasWrappedCapability(OutputStream os, String capability) {

Review Comment:
   Wouldn't it be better to have this method as static.



##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/CapableOzoneFSOutputStream.java:
##########
@@ -44,6 +45,15 @@ public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream) {
   @Override
   public boolean hasCapability(String capability) {
     OutputStream os = getWrappedOutputStream().getOutputStream();
+
+    if (os instanceof CryptoOutputStream) {
+      OutputStream wrapped = ((CryptoOutputStream) os).getWrappedStream();
+      return hasWrappedCapability(wrapped, capability);
+    }
+    return hasWrappedCapability(os, capability);
+  }
+
+  private boolean hasWrappedCapability(OutputStream os, String capability) {

Review Comment:
   Nit: Wouldn't it be better to have this method as static?



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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