[GitHub] [spark] cloud-fan commented on a change in pull request #28651: [SPARK-31833][SQL][test-hive1.2] Set HiveThriftServer2 with actual port while configured 0
cloud-fan commented on a change in pull request #28651: URL: https://github.com/apache/spark/pull/28651#discussion_r431076020 ## File path: sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SharedThriftServer.scala ## @@ -73,11 +68,19 @@ trait SharedThriftServer extends SharedSparkSession { } } - private def startThriftServer(port: Int, attempt: Int): Unit = { -logInfo(s"Trying to start HiveThriftServer2: port=$port, attempt=$attempt") + private def startThriftServer(attempt: Int): Unit = { +logInfo(s"Trying to start HiveThriftServer2:, attempt=$attempt") val sqlContext = spark.newSession().sqlContext -sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, port.toString) +// Set the HIVE_SERVER2_THRIFT_PORT to 0, so it could randomly pick any free port to use. +// It's much more robust than set a random port generated by ourselves ahead +sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, 0.toString) hiveServer2 = HiveThriftServer2.startWithContext(sqlContext) +hiveServer2.getServices.asScala.foreach { + case t: ThriftCLIService if t.getPortNumber != 0 => +serverPort = t.getPortNumber +logInfo(s"Started HiveThriftServer2: port=$serverPort, attempt=$attempt") + case _ => Review comment: oh i see, it's fine. 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: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28651: [SPARK-31833][SQL][test-hive1.2] Set HiveThriftServer2 with actual port while configured 0
cloud-fan commented on a change in pull request #28651: URL: https://github.com/apache/spark/pull/28651#discussion_r431014001 ## File path: sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SharedThriftServer.scala ## @@ -73,11 +68,19 @@ trait SharedThriftServer extends SharedSparkSession { } } - private def startThriftServer(port: Int, attempt: Int): Unit = { -logInfo(s"Trying to start HiveThriftServer2: port=$port, attempt=$attempt") + private def startThriftServer(attempt: Int): Unit = { +logInfo(s"Trying to start HiveThriftServer2:, attempt=$attempt") val sqlContext = spark.newSession().sqlContext -sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, port.toString) +// Set the HIVE_SERVER2_THRIFT_PORT to 0, so it could randomly pick any free port to use. +// It's much more robust than set a random port generated by ourselves ahead +sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, 0.toString) hiveServer2 = HiveThriftServer2.startWithContext(sqlContext) +hiveServer2.getServices.asScala.foreach { + case t: ThriftCLIService if t.getPortNumber != 0 => +serverPort = t.getPortNumber +logInfo(s"Started HiveThriftServer2: port=$serverPort, attempt=$attempt") + case _ => Review comment: or fail here? 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: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28651: [SPARK-31833][SQL][test-hive1.2] Set HiveThriftServer2 with actual port while configured 0
cloud-fan commented on a change in pull request #28651: URL: https://github.com/apache/spark/pull/28651#discussion_r431013801 ## File path: sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SharedThriftServer.scala ## @@ -73,11 +68,19 @@ trait SharedThriftServer extends SharedSparkSession { } } - private def startThriftServer(port: Int, attempt: Int): Unit = { -logInfo(s"Trying to start HiveThriftServer2: port=$port, attempt=$attempt") + private def startThriftServer(attempt: Int): Unit = { +logInfo(s"Trying to start HiveThriftServer2:, attempt=$attempt") val sqlContext = spark.newSession().sqlContext -sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, port.toString) +// Set the HIVE_SERVER2_THRIFT_PORT to 0, so it could randomly pick any free port to use. +// It's much more robust than set a random port generated by ourselves ahead +sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, 0.toString) hiveServer2 = HiveThriftServer2.startWithContext(sqlContext) +hiveServer2.getServices.asScala.foreach { + case t: ThriftCLIService if t.getPortNumber != 0 => +serverPort = t.getPortNumber +logInfo(s"Started HiveThriftServer2: port=$serverPort, attempt=$attempt") + case _ => Review comment: shall we log something if we fail to bind the port? 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: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28651: [SPARK-31833][SQL][test-hive1.2] Set HiveThriftServer2 with actual port while configured 0
cloud-fan commented on a change in pull request #28651: URL: https://github.com/apache/spark/pull/28651#discussion_r430954437 ## File path: sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SharedThriftServer.scala ## @@ -73,11 +68,17 @@ trait SharedThriftServer extends SharedSparkSession { } } - private def startThriftServer(port: Int, attempt: Int): Unit = { -logInfo(s"Trying to start HiveThriftServer2: port=$port, attempt=$attempt") + private def startThriftServer(attempt: Int): Unit = { +logInfo(s"Trying to start HiveThriftServer2:, attempt=$attempt") val sqlContext = spark.newSession().sqlContext -sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, port.toString) +sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, 0.toString) Review comment: can we add a code comment here to mention 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28651: [SPARK-31833][SQL][test-hive1.2] Set HiveThriftServer2 with actual port while configured 0
cloud-fan commented on a change in pull request #28651: URL: https://github.com/apache/spark/pull/28651#discussion_r430949663 ## File path: sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SharedThriftServer.scala ## @@ -73,11 +68,17 @@ trait SharedThriftServer extends SharedSparkSession { } } - private def startThriftServer(port: Int, attempt: Int): Unit = { -logInfo(s"Trying to start HiveThriftServer2: port=$port, attempt=$attempt") + private def startThriftServer(attempt: Int): Unit = { +logInfo(s"Trying to start HiveThriftServer2:, attempt=$attempt") val sqlContext = spark.newSession().sqlContext -sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, port.toString) +sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, 0.toString) Review comment: so the hive library will pick a valid port by itself if we set port as 0? 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: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28651: [SPARK-31833][SQL][test-hive1.2] Set HiveThriftServer2 with actual port while configured 0
cloud-fan commented on a change in pull request #28651: URL: https://github.com/apache/spark/pull/28651#discussion_r430948972 ## File path: sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SharedThriftServer.scala ## @@ -73,11 +68,17 @@ trait SharedThriftServer extends SharedSparkSession { } } - private def startThriftServer(port: Int, attempt: Int): Unit = { -logInfo(s"Trying to start HiveThriftServer2: port=$port, attempt=$attempt") + private def startThriftServer(attempt: Int): Unit = { +logInfo(s"Trying to start HiveThriftServer2:, attempt=$attempt") val sqlContext = spark.newSession().sqlContext -sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, port.toString) +sqlContext.setConf(ConfVars.HIVE_SERVER2_THRIFT_PORT.varname, 0.toString) Review comment: shall we respect this config if set by users? 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: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org