yaooqinn opened a new pull request #28651:
URL: https://github.com/apache/spark/pull/28651


   
   ### What changes were proposed in this pull request?
   
   When I was developing some stuff based on the `DeveloperAPI ` 
`org.apache.spark.sql.hive.thriftserver.HiveThriftServer2#startWithContext`, I 
need to use thrift port randomly to avoid race on ports. But the 
`org.apache.hive.service.cli.thrift.ThriftCLIService#getPortNumber` do not 
respond to me with the actual bound port but always 0.
   
   And the server log is not right too.
   ```
   INFO ThriftCLIService: Starting ThriftBinaryCLIService on port 0 with 
5...500 worker threads
   ``` 
   
   In the PR, when the port is configured 0, the `portNum` will be set to the 
real used port during the start process.
   
   Also use 0 in thrift related tests to avoid potential flakiness.
   
   ### Why are the changes needed?
   
   1 fix API bug
   2 reduce test flakiness
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as 
the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes 
- provide the console output, description and/or an example to show the 
behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to 
the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   yes, `org.apache.hive.service.cli.thrift.ThriftCLIService#getPortNumber` 
will always give you the actual port when it is configured 0.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some 
test cases that check the changes thoroughly including negative and positive 
cases if possible.
   If it was tested in a way different from regular unit tests, please clarify 
how you tested step by step, ideally copy and paste-able, so that other 
reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why 
it was difficult to add.
   -->
   
   modified unit tests
   


----------------------------------------------------------------
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

Reply via email to