Uploaded image for project: 'Hue'
  1. Hue
  2. HUE-5962

[hiveserver2] Update HiveServerClient user object when opening session

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.12.0
    • Fix Version/s: 4.0.0
    • Component/s: core.backend
    • Labels:
      None

      Description

      In the following scenario HiveServerClient tries to access the old user object which is leading to

      [27/Feb/2017 18:13:27 -0800] decorators   ERROR    Error running <function create_session at 0x10f5bf140>
      Traceback (most recent call last):
        File "/Users/krish/dev/github.mtv/hue/desktop/libs/notebook/src/notebook/decorators.py", line 82, in decorator
          return func(*args, **kwargs)
        File "/Users/krish/dev/github.mtv/hue/desktop/libs/notebook/src/notebook/api.py", line 81, in create_session
          response['session'] = get_api(request, session).create_session(lang=session['type'], properties=properties)
        File "/Users/krish/dev/github.mtv/hue/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py", line 79, in decorator
          return func(*args, **kwargs)
        File "/Users/krish/dev/github.mtv/hue/desktop/libs/notebook/src/notebook/connectors/hiveserver2.py", line 167, in create_session
          session = dbms.get(self.user, query_server=get_query_server_config(name=lang)).open_session(self.user)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/dbms.py", line 308, in open_session
          return self.client.open_session(user)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 1249, in open_session
          return self._client.open_session(user)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 616, in open_session
          session.properties = json.dumps(self.get_configuration())
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 1008, in get_configuration
          results = self.execute_query_statement(query, orientation=TFetchOrientation.FETCH_FIRST, max_rows=-1, close_operation=True)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 823, in execute_query_statement
          (results, schema), operation_handle = self.execute_statement(statement=statement, max_rows=max_rows, configuration=configuration, orientation=orientation)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 856, in execute_statement
          res = self.call(self._client.ExecuteStatement, req)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 624, in call
          (res, session) = self.call_return_result_and_session(fn, req, status, withMultipleSession)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 687, in call_return_result_and_session
          session = self.open_session(self.user)
        File "/Users/krish/dev/github.mtv/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py", line 612, in open_session
          properties=properties)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 157, in create
          return self.get_queryset().create(**kwargs)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 322, in create
          obj.save(force_insert=True, using=self.db)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/base.py", line 545, in save
          force_update=force_update, update_fields=update_fields)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/base.py", line 573, in save_base
          updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/base.py", line 654, in _save_table
          result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/base.py", line 687, in _do_insert
          using=using, raw=raw)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 232, in _insert
          return insert_query(self.model, objs, fields, **kwargs)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 1514, in insert_query
          return query.get_compiler(using=using).execute_sql(return_id)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/sql/compiler.py", line 903, in execute_sql
          cursor.execute(sql, params)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/util.py", line 53, in execute
          return self.cursor.execute(sql, params)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/utils.py", line 99, in __exit__
          six.reraise(dj_exc_type, dj_exc_value, traceback)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/util.py", line 53, in execute
          return self.cursor.execute(sql, params)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/mysql/base.py", line 124, in execute
          return self.cursor.execute(query, args)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-macosx-10.9-intel.egg/MySQLdb/cursors.py", line 205, in execute
          self.errorhandler(self, exc, value)
        File "/Users/krish/dev/github.mtv/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-macosx-10.9-intel.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
          raise errorclass, errorvalue
      IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`hue`.`beeswax_session`, CONSTRAINT `owner_id_refs_id_0417c1ac` FOREIGN KEY (`owner_id`) REFERENCES `auth_user` (`id`))')
      

      Steps to repro:
      1. Create new user
      2. Run queries
      3. Delete and re-add user.
      4. Open Hive editor and you see the error.

        Attachments

          Activity

            People

            • Assignee:
              krish Sai K Chirravuri
              Reporter:
              krish Sai K Chirravuri
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: