You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "aokolnychyi (via GitHub)" <gi...@apache.org> on 2023/09/29 20:49:14 UTC

[GitHub] [iceberg] aokolnychyi opened a new pull request, #8685: Spark: Clean up FileIO instances on executors

aokolnychyi opened a new pull request, #8685:
URL: https://github.com/apache/iceberg/pull/8685

   This PR implements `AutoCloseable` in `SerializableTableWithSize` to make sure resources used by copies of the table on executors are released correctly.
   
   See `freeMemoryEntry` in `MemoryStore`.
   
   ```
   def freeMemoryEntry[T <: MemoryEntry[_]](entry: T): Unit = {
     entry match {
       case SerializedMemoryEntry(buffer, _, _) => buffer.dispose()
       case e: DeserializedMemoryEntry[_] => e.value.foreach {
         case o: AutoCloseable =>
           try {
             o.close()
           } catch {
             case NonFatal(e) =>
               logWarning("Fail to close a memory entry", e)
           }
         case _ =>
       }
     }
   }
   ```


-- 
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@iceberg.apache.org

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


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


[GitHub] [iceberg] aokolnychyi commented on a diff in pull request #8685: Spark: Clean up FileIO instances on executors

Posted by "aokolnychyi (via GitHub)" <gi...@apache.org>.
aokolnychyi commented on code in PR #8685:
URL: https://github.com/apache/iceberg/pull/8685#discussion_r1342153777


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SerializableTableWithSize.java:
##########
@@ -49,6 +61,14 @@ public static Table copyOf(Table table) {
     }
   }
 
+  @Override
+  public void close() throws Exception {
+    if (serializationMarker == null) {
+      LOG.info("Releasing resources");
+      io().close();
+    }
+  }
+
   public static class SerializableMetadataTableWithSize extends SerializableMetadataTable

Review Comment:
   Good catch, I overlooked it does not extend the main class.



-- 
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@iceberg.apache.org

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


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


[GitHub] [iceberg] ConeyLiu commented on a diff in pull request #8685: Spark: Clean up FileIO instances on executors

Posted by "ConeyLiu (via GitHub)" <gi...@apache.org>.
ConeyLiu commented on code in PR #8685:
URL: https://github.com/apache/iceberg/pull/8685#discussion_r1342096724


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SerializableTableWithSize.java:
##########
@@ -49,6 +61,14 @@ public static Table copyOf(Table table) {
     }
   }
 
+  @Override
+  public void close() throws Exception {
+    if (serializationMarker == null) {
+      LOG.info("Releasing resources");
+      io().close();
+    }
+  }
+
   public static class SerializableMetadataTableWithSize extends SerializableMetadataTable

Review Comment:
   Why not do the same cleanup for `MetadataaTable` as well?



-- 
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@iceberg.apache.org

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


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


Re: [PR] Spark: Clean up FileIO instances on executors [iceberg]

Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on PR #8685:
URL: https://github.com/apache/iceberg/pull/8685#issuecomment-1751409600

   Thanks for fixing this, @aokolnychyi! Good to have this cleaned up.


-- 
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@iceberg.apache.org

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


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


Re: [PR] Spark: Clean up FileIO instances on executors [iceberg]

Posted by "bryanck (via GitHub)" <gi...@apache.org>.
bryanck commented on PR #8685:
URL: https://github.com/apache/iceberg/pull/8685#issuecomment-1751417119

   Just to mention it, auto close caused an issue related to broadcasts that was fixed in this PR - https://github.com/apache/iceberg/pull/7263


-- 
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@iceberg.apache.org

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


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


Re: [PR] Spark: Clean up FileIO instances on executors [iceberg]

Posted by "bryanck (via GitHub)" <gi...@apache.org>.
bryanck commented on PR #8685:
URL: https://github.com/apache/iceberg/pull/8685#issuecomment-1751438110

   After looking through the code, I see https://github.com/apache/iceberg/pull/7263 shouldn't be an issue bc the FileIO isn't closed on the driver.


-- 
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@iceberg.apache.org

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


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


Re: [PR] Spark: Clean up FileIO instances on executors [iceberg]

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


-- 
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@iceberg.apache.org

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


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