Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-24805

HBaseTestingUtility.getConnection should be threadsafe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha-1, 1.7.0, 2.4.0
    • test
    • None
    • Incompatible change
    • Hide
      <!-- markdown -->
      Users of `HBaseTestingUtility` can now safely call the `getConnection` method from multiple threads.

      As a consequence of refactoring to improve the thread safety of the HBase testing classes, the protected `conf` member of the `HBaseCommonTestingUtility` class has been marked final. Downstream users who extend from the class hierarchy rooted at this class will need to pass the Configuration instance they want used to their super constructor rather than overwriting the instance variable.
      Show
      <!-- markdown --> Users of `HBaseTestingUtility` can now safely call the `getConnection` method from multiple threads. As a consequence of refactoring to improve the thread safety of the HBase testing classes, the protected `conf` member of the `HBaseCommonTestingUtility` class has been marked final. Downstream users who extend from the class hierarchy rooted at this class will need to pass the Configuration instance they want used to their super constructor rather than overwriting the instance variable.

    Description

      the current javadoc for getConnection carries a thread safety warning:

      /**
          * Get a Connection to the cluster. Not thread-safe (This class needs a lot of work to make it
          * thread-safe).
          * @return A Connection that can be shared. Don't close. Will be closed on shutdown of cluster.
          */
         public Connection getConnection() throws IOException {
      

      We then ignore that warning across our test base. We should make the method threadsafe since the intention is to share a single Connection across all users of the HTU instance.

      Attachments

        Activity

          People

            busbey Sean Busbey
            busbey Sean Busbey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: