You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by javadba <gi...@git.apache.org> on 2014/08/05 21:51:43 UTC

[GitHub] spark pull request: Fix tiny bug (likely copy and paste error) in ...

GitHub user javadba opened a pull request:

    https://github.com/apache/spark/pull/1792

    Fix tiny bug (likely copy and paste error) in closing jdbc connection

    I inquired on  dev mailing list about the motivation for checking the jdbc statement instead of the connection in the close() logic of JdbcRDD. Ted Yu believes there essentially is none-  it is a simple cut and paste issue. So here is the tiny fix to patch it. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/javadba/spark closejdbc

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/1792.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1792
    
----
commit 095b2c9127b161437013476d48d855714716449f
Author: Stephen Boesch <javadba>
Date:   2014-08-05T19:46:55Z

    Fix tiny bug (likely copy and paste error) in closing jdbc connection

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1792#issuecomment-51279053
  
    QA tests have started for PR 1792. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17961/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/1792#issuecomment-51282959
  
    Thanks. Merging this in master & branch-1.0 and branch-1.1.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Potential leak of Jdbc Connection...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1792#discussion_r15840899
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala ---
    @@ -70,20 +70,30 @@ class JdbcRDD[T: ClassTag](
       override def compute(thePart: Partition, context: TaskContext) = new NextIterator[T] {
         context.addOnCompleteCallback{ () => closeIfNeeded() }
         val part = thePart.asInstanceOf[JdbcPartition]
    -    val conn = getConnection()
    -    val stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
    +    var conn : Connection = _
    +    var stmt : PreparedStatement = _
    +    try {
    --- End diff --
    
    Actually as I look at this again, I think the try is not necessary. Basically the first line in the constructor adds "closeIfNeeded" callback to the complete callback list. Then if any exception is thrown, even during the constructor, I think closeIfNeeded is called to close connections.
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by javadba <gi...@git.apache.org>.
Github user javadba commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1792#discussion_r15849947
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala ---
    @@ -106,7 +106,7 @@ class JdbcRDD[T: ClassTag](
             case e: Exception => logWarning("Exception closing statement", e)
           }
           try {
    -        if (null != conn && ! stmt.isClosed()) conn.close()
    +        if (null != conn && ! conn.isClosed()) conn.close()
    --- End diff --
    
    sure - done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/1792


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1792#discussion_r15843358
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala ---
    @@ -106,7 +106,7 @@ class JdbcRDD[T: ClassTag](
             case e: Exception => logWarning("Exception closing statement", e)
           }
           try {
    -        if (null != conn && ! stmt.isClosed()) conn.close()
    +        if (null != conn && ! conn.isClosed()) conn.close()
    --- End diff --
    
    while you are at it, do you mind adding curly braces for the close()? The spark coding style requires curly braces even for one-liner ifs. It's an oversight that we didn't do this for the ifs in this file.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/1792#issuecomment-51267354
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1792#issuecomment-51282759
  
    QA results for PR 1792:<br>- This patch PASSES unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17961/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: SPARK-2869 - Fix tiny bug in JdbcRdd for closi...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/1792#issuecomment-51277474
  
    Jenkins, test this please.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org