Hi there,
I’m not sure if this is the correct place to post this problem, but I thought I’d try here before creating an issue on Github.
I’m currently running Sentry 8.16.1 and attempted the upgrade to 8.17.0. Updating with pip worked fine, but when I run the “sentry upgrade” command I get an SQL error.
The full output from the upgrade is below:
(sentry) [root@sentryprod ~]# SENTRY_CONF=/etc/sentry sentry upgrade
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Synced:
> django.contrib.admin
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.messages
> django.contrib.sessions
> django.contrib.sites
> django.contrib.staticfiles
> crispy_forms
> debug_toolbar
> raven.contrib.django.raven_compat
> rest_framework
> sentry.plugins.sentry_interface_types
> sentry.plugins.sentry_mail
> sentry.plugins.sentry_urls
> sentry.plugins.sentry_useragents
> sentry.plugins.sentry_webhooks
> sudo
> south
> sentry_jira
> sentry_hipchat
Not synced (use migrations):
- sentry
- sentry.nodestore
- sentry.search
- social_auth
(use ./manage.py migrate to migrate these)
Running migrations for sentry:
- Migrating forwards to 0326_auto__add_field_groupsnooze_count__add_field_groupsnooze_window__add_f.
> sentry:0316_auto__del_field_grouptagvalue_project__del_field_grouptagvalue_group__
> sentry:0317_drop_grouptagvalue_constraints
> sentry:0318_auto__add_field_deploy_notified
> sentry:0319_auto__add_index_deploy_notified
> sentry:0320_auto__add_index_eventtag_date_added
> sentry:0321_auto__add_field_projectkey_rate_limit_count__add_field_projectkey_rate
> sentry:0321_auto__add_unique_environment_organization_id_name
FATAL ERROR - The following SQL query failed: CREATE UNIQUE INDEX CONCURRENTLY sentry_environment_organization_id_6c9098a3d53d6a9a ON sentry_environment (organization_id, name)
The error was: IntegrityError('could not create unique index "sentry_environment_organization_id_6c9098a3d53d6a9a"\nDETAIL: Key (organization_id, name)=(1, ) is duplicated.\n',)
SQL: CREATE UNIQUE INDEX CONCURRENTLY sentry_environment_organization_id_6c9098a3d53d6a9a ON sentry_environment (organization_id, name)
Traceback (most recent call last):
File "/www/sentry/bin/sentry", line 11, in <module>
sys.exit(main())
File "/www/sentry/local/lib/python2.7/dist-packages/sentry/runner/__init__.py", line 160, in main
cli(prog_name=get_prog(), obj={}, max_content_width=100)
File "/www/sentry/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/www/sentry/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/www/sentry/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/www/sentry/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/www/sentry/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/www/sentry/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/www/sentry/local/lib/python2.7/dist-packages/sentry/runner/decorators.py", line 36, in inner
return ctx.invoke(f, *args, **kwargs)
File "/www/sentry/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/www/sentry/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/www/sentry/local/lib/python2.7/dist-packages/sentry/runner/commands/upgrade.py", line 60, in upgrade
_upgrade(not noinput, traceback, verbosity, not no_repair)
File "/www/sentry/local/lib/python2.7/dist-packages/sentry/runner/commands/upgrade.py", line 29, in _upgrade
verbosity=verbosity,
File "/www/sentry/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/www/sentry/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/www/sentry/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/www/sentry/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/www/sentry/local/lib/python2.7/site-packages/south/migration/migrators.py", line 256, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/www/sentry/local/lib/python2.7/site-packages/south/migration/migrators.py", line 331, in migrate_many
result = self.migrate(migration, database)
File "/www/sentry/local/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
result = self.run(migration, database)
File "/www/sentry/local/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
return self.run_migration(migration, database)
File "/www/sentry/local/lib/python2.7/site-packages/south/migration/migrators.py", line 91, in run_migration
south.db.db.rollback_transaction()
File "/www/sentry/local/lib/python2.7/site-packages/south/db/generic.py", line 1000, in rollback_transaction
transaction.leave_transaction_management(using=self.db_alias)
File "/www/sentry/local/lib/python2.7/site-packages/django/db/transaction.py", line 78, in leave_transaction_management
get_connection(using).leave_transaction_management()
File "/www/sentry/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 310, in leave_transaction_management
"This code isn't under transaction management")
django.db.transaction.TransactionManagementError: This code isn't under transaction management
For some background if relevant, I installed Sentry when it was version 8.9.0 or therabouts, and previous upgrades have all worked without a problem. The OS is Amazon Linux and it’s fully updated.
I’m not sure what should be done to solve this, any help would be greatly appreciated. Also, if this query is better off as a Github issue then please let me know and I’ll create one.