szetszwo commented on code in PR #4512:
URL: https://github.com/apache/ozone/pull/4512#discussion_r1156806990
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/CapableOzoneFSOutputStream.java:
##########
@@ -38,12 +38,18 @@
*/
public class CapableOzoneFSOutputStream extends OzoneFSOutputStream
implements StreamCapabilities {
- public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream) {
+ private final boolean isEnabled;
+ public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream,
+ boolean enabled) {
super(outputStream.getWrappedOutputStream());
+ this.isEnabled = enabled;
}
@Override
public boolean hasCapability(String capability) {
+ if (!isEnabled) {
+ return false;
+ }
Review Comment:
It will be easier to understand if it changes only the HFLUSH and HSYNC
cases.
```java
+++
b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/CapableOzoneFSOutputStream.java
@@ -38,8 +38,11 @@
*/
public class CapableOzoneFSOutputStream extends OzoneFSOutputStream
implements StreamCapabilities {
- public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream) {
+ private final boolean isHsyncEnabled;
+ public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream,
+ boolean isHsyncEnabled) {
super(outputStream.getWrappedOutputStream());
+ this.isHsyncEnabled = isHsyncEnabled;
}
@Override
@@ -53,7 +56,7 @@ public boolean hasCapability(String capability) {
return hasWrappedCapability(os, capability);
}
- private static boolean hasWrappedCapability(OutputStream os,
+ private boolean hasWrappedCapability(OutputStream os,
String capability) {
if (os instanceof ECKeyOutputStream) {
return false;
@@ -61,7 +64,7 @@ private static boolean hasWrappedCapability(OutputStream
os,
switch (StringUtils.toLowerCase(capability)) {
case StreamCapabilities.HFLUSH:
case StreamCapabilities.HSYNC:
- return true;
+ return isHsyncEnabled;
default:
return false;
}
```
##########
hadoop-ozone/ozonefs-hadoop3/src/main/java/org/apache/hadoop/fs/ozone/OzoneFileSystem.java:
##########
@@ -48,6 +48,7 @@ public class OzoneFileSystem extends BasicOzoneFileSystem
private OzoneFSStorageStatistics storageStatistics;
+
Review Comment:
Please revert this empty line change.
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/CapableOzoneFSOutputStream.java:
##########
@@ -38,12 +38,18 @@
*/
public class CapableOzoneFSOutputStream extends OzoneFSOutputStream
implements StreamCapabilities {
- public CapableOzoneFSOutputStream(OzoneFSOutputStream outputStream) {
+ private final boolean isEnabled;
Review Comment:
How about calling it `isHsyncEnabled`? `isEnabled` sounds like
enabling/disabling everything.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]