Jackie-Jiang commented on a change in pull request #4418: Fix potential 
resource leak in the way we close a collection of closeables
URL: https://github.com/apache/incubator-pinot/pull/4418#discussion_r303636827
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/io/writer/impl/FixedByteSingleValueMultiColWriter.java
 ##########
 @@ -99,9 +100,12 @@ public void setBytes(int row, int col, byte[] bytes) {
     indexDataBuffer.readFrom(offset, bytes);
   }
 
+  @Override
   public void close()
       throws IOException {
-    this.indexDataBuffer.close();
-    this.indexDataBuffer = null;
+    if (this.indexDataBuffer != null) {
 
 Review comment:
   This should not happen because we keep reference count on the segments. 
While it is true that if our code has bug then this could potentially cause JVM 
crash, so it is clean + fail fast model vs. try to survive failure model. I'm 
okay both way, but in FixedByteValueReaderWriter we are taking the first way, 
so I prefer keeping them consistent.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to