Gargi-jais11 commented on code in PR #10930:
URL: https://github.com/apache/ozone/pull/10930#discussion_r3709439861
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -810,6 +812,23 @@ protected static CheckedRunnable<IOException>
validateContentLength(
};
}
+ /**
+ * Reject directory keys accessed without a trailing slash when FSO
directory creation is enabled.
+ *
+ * <p>Necessary for directories in buckets with FSO layout. Intended for
apps which use Hadoop S3A
+ * (e.g. Trino through the Hive connector).
+ */
+ protected void isFile(String keyPath, OzoneKey key) throws OMException {
+ boolean isFsoDirCreationEnabled = getOzoneConfiguration()
+ .getBoolean(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED,
+ OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED_DEFAULT);
+ if (isFsoDirCreationEnabled &&
+ !key.isFile() &&
+ !keyPath.endsWith("/")) {
Review Comment:
Thanks for pointing that out. I simply moved this function was earlier
existing in
`hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java`
file to a common place.
Will change the function name.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -810,6 +812,23 @@ protected static CheckedRunnable<IOException>
validateContentLength(
};
}
+ /**
+ * Reject directory keys accessed without a trailing slash when FSO
directory creation is enabled.
+ *
+ * <p>Necessary for directories in buckets with FSO layout. Intended for
apps which use Hadoop S3A
+ * (e.g. Trino through the Hive connector).
+ */
+ protected void isFile(String keyPath, OzoneKey key) throws OMException {
+ boolean isFsoDirCreationEnabled = getOzoneConfiguration()
+ .getBoolean(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED,
+ OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED_DEFAULT);
+ if (isFsoDirCreationEnabled &&
+ !key.isFile() &&
+ !keyPath.endsWith("/")) {
Review Comment:
Thanks for pointing that out. I simply moved this function was earlier
existing in
`hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java`
file to a common place.
Will change the function name.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -810,6 +812,23 @@ protected static CheckedRunnable<IOException>
validateContentLength(
};
}
+ /**
+ * Reject directory keys accessed without a trailing slash when FSO
directory creation is enabled.
+ *
+ * <p>Necessary for directories in buckets with FSO layout. Intended for
apps which use Hadoop S3A
+ * (e.g. Trino through the Hive connector).
+ */
+ protected void isFile(String keyPath, OzoneKey key) throws OMException {
Review Comment:
Thanks for pointing that out. I simply moved this function was earlier
existing in
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java
file to a common place.
Will change the function name.
--
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]