Hive
  1. Hive
  2. HIVE-584

Clean up global and ThreadLocal variables in Hive

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.3.0
    • Fix Version/s: 0.5.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      HIVE-584. Clean up global and ThreadLocal variables in Hive. (Yonqqiang He via zshao)

      Description

      Currently in Hive code there are several global and ThreadLocal variables that need to be cleaned.

      Specifically, the following classes are involved:
      1. HiveConf: contains hive configurations (and a classloader)
      2. Hive class: contains a static member Hive db. Hive class contains a member HiveConf conf, as well as a ThreadLocal storage of IMetaStoreClient.
      3. SessionState: contains a static ThreadLocal storage of SessionState. SessionState class contains a Hive db, a HiveConf conf, a history logger, and a bunch of standard input/output streams
      4. CliSessionState: SessionState plus some command options and the command file name.
      5. All classes that try to get Hive db or HiveConf from global static Hive db, or SessionState.

      There are several problems with the current design. To name a few:
      1. SessionState instances are ThreadLocal, but SessionState contains Hive db which also contains ThreadLocal storage. Not sure a db can be shared across different threads or not? What is the global static Hive db?
      2. We pass HiveConf and Hive db in two ways to classes like Task: Sometimes through initialize(), sometimes through SessionState. This complicates the code a lot. It's hard to know which HiveConf and which db we should use.

      We need to think about a better way to do it.

      1. hive-584-2009-9-11.patch
        6 kB
        He Yongqiang
      2. hive-584-2009-9-10.patch
        6 kB
        He Yongqiang

        Issue Links

          Activity

          Zheng Shao created issue -
          Zheng Shao made changes -
          Field Original Value New Value
          Link This issue is blocked by HIVE-574 [ HIVE-574 ]
          Ning Zhang made changes -
          Assignee Ning Zhang [ nzhang ]
          Ning Zhang made changes -
          Assignee Ning Zhang [ nzhang ]
          Zheng Shao made changes -
          Link This issue blocks HIVE-80 [ HIVE-80 ]
          Zheng Shao made changes -
          Link This issue blocks HIVE-675 [ HIVE-675 ]
          Zheng Shao made changes -
          Link This issue blocks HIVE-805 [ HIVE-805 ]
          Zheng Shao made changes -
          Link This issue relates to HIVE-210 [ HIVE-210 ]
          He Yongqiang made changes -
          Attachment hive-584-2009-9-10.patch [ 12419155 ]
          He Yongqiang made changes -
          Attachment hive-584-2009-9-11.patch [ 12419243 ]
          Zheng Shao made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Hadoop Flags [Reviewed]
          Release Note HIVE-584. Clean up global and ThreadLocal variables in Hive. (Yonqqiang He via zshao)
          Fix Version/s 0.5.0 [ 12314156 ]
          Resolution Fixed [ 1 ]
          Carl Steinbach made changes -
          Affects Version/s 0.3.1 [ 12313845 ]
          Carl Steinbach made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Zheng Shao
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development