rajarshisarkar commented on a change in pull request #3175:
URL: https://github.com/apache/iceberg/pull/3175#discussion_r717587514
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -328,6 +330,15 @@ private static InputStream uncheckedInputStream(File file)
{
}
}
+ private void createStagingDirectoryIfNotExists() throws SecurityException {
+ if (!stagingDirectory.exists()) {
+ boolean createdStagingDirectory = stagingDirectory.mkdirs();
+ if (createdStagingDirectory) {
+ LOG.info("Successfully created staging directory: {}",
stagingDirectory.getAbsolutePath());
+ }
Review comment:
Agreed, I have made the changes accordingly.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -328,6 +330,15 @@ private static InputStream uncheckedInputStream(File file)
{
}
}
+ private void createStagingDirectoryIfNotExists() throws SecurityException {
+ if (!stagingDirectory.exists()) {
Review comment:
Added the logger.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -170,11 +171,12 @@ public void write(byte[] b, int off, int len) throws
IOException {
}
}
- private void newStream() throws IOException {
+ private void newStream() throws IOException, SecurityException {
Review comment:
Removed the special handling for `SecurityException`.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputFile.java
##########
@@ -62,6 +63,9 @@ public PositionOutputStream createOrOverwrite() {
return new S3OutputStream(client(), uri(), awsProperties());
} catch (IOException e) {
throw new UncheckedIOException("Failed to create output stream for
location: " + uri(), e);
+ } catch (SecurityException e) {
Review comment:
Removed the special handling for `SecurityException`.
##########
File path: api/src/main/java/org/apache/iceberg/io/OutputFile.java
##########
@@ -48,6 +49,7 @@
*
* @return an output stream that can report its position
* @throws RuntimeIOException If the implementation throws an {@link
IOException}
+ * @throws AccessControlException If the implementation throws an {@link
SecurityException}
Review comment:
I have made the changes accordingly.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -328,6 +330,26 @@ private static InputStream uncheckedInputStream(File file)
{
}
}
+ private void createStagingDirectoryIfNotExists() throws IOException,
SecurityException {
+ if (!stagingDirectory.exists()) {
+ LOG.info("Staging directory: {} does not exist, trying to create one",
+ stagingDirectory.getAbsolutePath());
+ boolean createdStagingDirectory = stagingDirectory.mkdirs();
+ if (createdStagingDirectory) {
+ LOG.info("Successfully created staging directory: {}",
stagingDirectory.getAbsolutePath());
+ } else {
+ if (stagingDirectory.exists()) {
+ LOG.info("Staging directory: {} is created by another process",
Review comment:
Made the change.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -328,6 +330,26 @@ private static InputStream uncheckedInputStream(File file)
{
}
}
+ private void createStagingDirectoryIfNotExists() throws IOException,
SecurityException {
+ if (!stagingDirectory.exists()) {
+ LOG.info("Staging directory: {} does not exist, trying to create one",
+ stagingDirectory.getAbsolutePath());
+ boolean createdStagingDirectory = stagingDirectory.mkdirs();
+ if (createdStagingDirectory) {
+ LOG.info("Successfully created staging directory: {}",
stagingDirectory.getAbsolutePath());
+ } else {
+ if (stagingDirectory.exists()) {
+ LOG.info("Staging directory: {} is created by another process",
+ stagingDirectory.getAbsolutePath());
+ } else {
+ throw new IOException(String
+ .format("Staging directory: %s creation failed due to some
unknown reason",
Review comment:
Made the change.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -86,7 +86,8 @@
private boolean closed = false;
@SuppressWarnings("StaticAssignmentInConstructor")
- S3OutputStream(S3Client s3, S3URI location, AwsProperties awsProperties)
throws IOException {
+ S3OutputStream(S3Client s3, S3URI location, AwsProperties awsProperties)
+ throws IOException, SecurityException {
Review comment:
Removed it.
##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
##########
@@ -170,11 +171,12 @@ public void write(byte[] b, int off, int len) throws
IOException {
}
}
- private void newStream() throws IOException {
+ private void newStream() throws IOException, SecurityException {
Review comment:
Yeah, need not to throw explicitly. Removed it.
--
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]