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

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

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