Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on "Refresh Druid Metadata" #529

Closed
LAlbertalli opened this issue May 27, 2016 · 4 comments
Closed

Error on "Refresh Druid Metadata" #529

LAlbertalli opened this issue May 27, 2016 · 4 comments

Comments

@LAlbertalli
Copy link
Contributor

Attempting to refresh the Metadata for a Druid Cluster returns the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/caravel-0.9.0-py2.7.egg/caravel/views.py", line 1009, in refresh_datasources
    cluster, str(e)),
  File "/usr/lib/python2.7/site-packages/caravel-0.9.0-py2.7.egg/caravel/models.py", line 919, in __repr__
    return self.cluster_name
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 237, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 578, in get
    value = state._load_expired(state, passive)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/state.py", line 474, in _load_expired
    self.manager.deferred_scalar_loader(self, toload)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/loading.py", line 664, in load_scalar_attributes
    only_load_props=attribute_names)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/loading.py", line 219, in load_on_ident
    return q.one()
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2718, in one
    ret = list(self)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2761, in __iter__
    return self._execute_and_instances(context)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2774, in _execute_and_instances
    close_with_result=True)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2765, in _connection_from_session
    **kw)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 893, in connection
    execution_options=execution_options)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 898, in _connection_for_bind
    engine, execution_options)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 313, in _connection_for_bind
    self._assert_active()
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 214, in _assert_active
    % self._rollback_exception
InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (_mysql_exceptions.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`caravel`.`columns`, CONSTRAINT `columns_ibfk_1` FOREIGN KEY (`column_name`) REFERENCES `datasources` (`datasource_name`))') [SQL: u'INSERT INTO `columns` (created_on, changed_on, datasource_name, column_name, is_active, type, groupby, count_distinct, sum, max, min, filterable, description, changed_by_fk, created_by_fk) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'] [parameters: (datetime.datetime(2016, 5, 27, 18, 41, 53, 340220), datetime.datetime(2016, 5, 27, 18, 41, 53, 340250), 'client_logs_v2', 'num_recommended_unsent', 1, 'STRING', 1, 0, 0, 0, 0, 1, None, 1L, 1L)]

The problem happens with both Caravel 0.9.0 and the latest Master. The backend is MySQL.
There are actually two issues:

  • The exception handling try to access the cluster object to print the error. But SQLAlchemy has invalidated the object trying to write it. Since there has been an exception, the transaction has been rolled back and the db connection is dirty.
  • There's a wrong constraint on the columns table
    I'm testing a fix for both bugs and I'll issue a Pull request for both of them when it is ready.
@sid88in
Copy link
Contributor

sid88in commented May 31, 2016

I am facing the EXACT same error while refreshing druid metadata. Are we pushing this fix to prod?

@x4base
Copy link
Contributor

x4base commented May 31, 2016

The constraint issue is mentioned here: #466 , but I can't get any response

mistercrunch pushed a commit that referenced this issue Jun 2, 2016
* Created migration to fix the bug

* Working also on MySQL

* Added support for Vertica Grains (#515)

* Fix #529 1 "This Session's transaction has been rolled back" (#530)

* Fixing the specific issue

* Added an additional fix for a similar error in #529

Background:
- When an object is modified by SQLAlchemy, it is invalidated so need to be fetched again from the DB
- If there's an exception during a transaction, SQLAlchemy performs a rollback and mark the connection as dirty.

Bug:
- When handling exceptions, the exception handler tries to access the name of the cluster in the main object. Since the name has been invalidated due to a write, SQLAlchemy tries to fetch it on a 'dirty' connection and spits out an error. Solution:
- Fetch the information for handling the exception before starting the process.

* Modified the migration function to to automatically detect the the foreign keys based on the signature.
It supports also sqlite using batch migrations

* i18n: Fix typo in Druid cluster broker port label (#512)

* Update models.py (#541)

removing duplicated `user_id` def
@joshwalters
Copy link
Contributor

I am also seeing the exact same issue.

@LAlbertalli
Copy link
Contributor Author

This fix on the underlying two issues ( #530 and #531 ) has been accepted and merged into master.
Check out the current master and they should be fixed.

Luca

zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
* feat(plugin-chart-choropleth-map): scaffold and load map (apache#527)

* feat: add package

* feat: storybook working

* feat: load usa and world map

* refactor: clean up

* fix: remove test data

* refactor: utilize dynamic import

* build: remove unused dependencies

* fix: address pr comments

* fix: comment

* feat(plugin-chart-choropleth-map): add more country maps (apache#529)

* feat(plugin-chart-choropleth-map): add zooming (apache#528)

* feat: add zooming

* feat: can zoom in and out

* feat: add zoom controls

* refactor: extract controls

* fix: address comments

* feat(plugin-chart-choropleth-map): add encoding (apache#541)

* feat: add encoder

* feat: add encoding

* docs: add categorical

* fix: any

* docs: update storybook

* feat(plugin-chart-choropleth-map): add tooltip (apache#548)

* feat: support tooltip

* feat: support tooltip fields

* fix: default projection

* build: bump dependency

* build: update dependency

* build: mark private
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
* feat(plugin-chart-choropleth-map): scaffold and load map (apache#527)

* feat: add package

* feat: storybook working

* feat: load usa and world map

* refactor: clean up

* fix: remove test data

* refactor: utilize dynamic import

* build: remove unused dependencies

* fix: address pr comments

* fix: comment

* feat(plugin-chart-choropleth-map): add more country maps (apache#529)

* feat(plugin-chart-choropleth-map): add zooming (apache#528)

* feat: add zooming

* feat: can zoom in and out

* feat: add zoom controls

* refactor: extract controls

* fix: address comments

* feat(plugin-chart-choropleth-map): add encoding (apache#541)

* feat: add encoder

* feat: add encoding

* docs: add categorical

* fix: any

* docs: update storybook

* feat(plugin-chart-choropleth-map): add tooltip (apache#548)

* feat: support tooltip

* feat: support tooltip fields

* fix: default projection

* build: bump dependency

* build: update dependency

* build: mark private
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
* feat(plugin-chart-choropleth-map): scaffold and load map (apache#527)

* feat: add package

* feat: storybook working

* feat: load usa and world map

* refactor: clean up

* fix: remove test data

* refactor: utilize dynamic import

* build: remove unused dependencies

* fix: address pr comments

* fix: comment

* feat(plugin-chart-choropleth-map): add more country maps (apache#529)

* feat(plugin-chart-choropleth-map): add zooming (apache#528)

* feat: add zooming

* feat: can zoom in and out

* feat: add zoom controls

* refactor: extract controls

* fix: address comments

* feat(plugin-chart-choropleth-map): add encoding (apache#541)

* feat: add encoder

* feat: add encoding

* docs: add categorical

* fix: any

* docs: update storybook

* feat(plugin-chart-choropleth-map): add tooltip (apache#548)

* feat: support tooltip

* feat: support tooltip fields

* fix: default projection

* build: bump dependency

* build: update dependency

* build: mark private
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
* feat(plugin-chart-choropleth-map): scaffold and load map (apache#527)

* feat: add package

* feat: storybook working

* feat: load usa and world map

* refactor: clean up

* fix: remove test data

* refactor: utilize dynamic import

* build: remove unused dependencies

* fix: address pr comments

* fix: comment

* feat(plugin-chart-choropleth-map): add more country maps (apache#529)

* feat(plugin-chart-choropleth-map): add zooming (apache#528)

* feat: add zooming

* feat: can zoom in and out

* feat: add zoom controls

* refactor: extract controls

* fix: address comments

* feat(plugin-chart-choropleth-map): add encoding (apache#541)

* feat: add encoder

* feat: add encoding

* docs: add categorical

* fix: any

* docs: update storybook

* feat(plugin-chart-choropleth-map): add tooltip (apache#548)

* feat: support tooltip

* feat: support tooltip fields

* fix: default projection

* build: bump dependency

* build: update dependency

* build: mark private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants