Upgrade self host redash 0.12.0.b2449 to latest is stuck on "Running migrations"


#1

Issue Summary

OS: Ubuntu 12.04.5

Hi,
I’m trying to upgrade 0.12.0.b2449 to latest version.
The upgrade is stuck on step “Running migrations (if needed)…”

Is there any upgrade log / debug mode where I can see what’s being done and what’s the problem?

When I finally press ctrl+c I get this python traceback:

File “./upgrade”, line 242, in
deploy_release(args.channel)
File “./upgrade”, line 228, in deploy_release
apply_migrations(release)
File “./upgrade”, line 142, in apply_migrations
run(“sudo -u redash bin/run ./manage.py db upgrade”, cwd=version_path(release.version_name))
File “./upgrade”, line 26, in run
return subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=subprocess.STDOUT)
File “/usr/lib/python2.7/subprocess.py”, line 538, in check_output
output, unused_err = process.communicate()
File “/usr/lib/python2.7/subprocess.py”, line 746, in communicate
stdout = _eintr_retry_call(self.stdout.read)
File “/usr/lib/python2.7/subprocess.py”, line 478, in _eintr_retry_call
return func(*args)


#2

Make sure that there are no Redash processes running.


#3

There weren’t before running ./upgrade.

I see these while process is still stuck:

root 9775 9739 0 13:35 pts/2 00:00:00 /bin/sh -c sudo -u redash bin/run ./manage.py db upgrade
root 9776 9775 0 13:35 pts/2 00:00:00 sudo -u redash bin/run ./manage.py db upgrade
redash 9777 9776 0 13:35 pts/2 00:00:01 python /opt/redash/redash.4.0.1.b4038/manage.py db upgrade
postgres 9793 16038 0 13:35 ? 00:00:00 postgres: redash redash [local] idle in transaction
postgres 9794 16038 0 13:35 ? 00:00:00 postgres: redash redash [local] SELECT waiting


#4

I am facing the exact same issue. As suggested i stopped all redash processes (except redis). However the result is still the same. The upgrade script is stuck at the same point.

I tried running the command directly as follows:

bin/run ./manage.py db upgrade

It throws the following output:

[2018-06-14 01:06:38,727][PID:12153][INFO][alembic.runtime.migration] Context impl PostgresqlImpl.
[2018-06-14 01:06:38,731][PID:12153][INFO][alembic.runtime.migration] Will assume transactional DDL.
[2018-06-14 01:06:38,793][PID:12153][INFO][alembic.runtime.migration] Running upgrade -> 65fc9ede4746, Add is_draft status to queries and dashboards
[2018-06-14 01:06:38,824][PID:12153][INFO][alembic.runtime.migration] Running upgrade 65fc9ede4746 -> d1eae8b9893e, add Query.schedule_failures
[2018-06-14 01:06:38,857][PID:12153][INFO][alembic.runtime.migration] Running upgrade d1eae8b9893e -> 7671dca4e604, empty message
[2018-06-14 01:06:38,861][PID:12153][INFO][alembic.runtime.migration] Running upgrade 7671dca4e604 -> 5ec5c84ba61e, Add Query.search_vector field for full text search.
[2018-06-14 01:06:39,068][PID:12153][INFO][alembic.runtime.migration] Running upgrade 5ec5c84ba61e -> 6b5be7e0a0ef, Re-index Query.search_vector with existing queries.
[2018-06-14 01:06:39,274][PID:12153][INFO][alembic.runtime.migration] Running upgrade 6b5be7e0a0ef -> 969126bd800f, Update widget’s position data based on dashboard layout.
Updating dashboards position data:


#5

At this point following queries are running on the pg server

redash=> select query from pg_stat_activity;

                     query                                                                                            





UPDATE alembic_version SET version_num=‘6b5be7e0a0ef’ WHERE alembic_version.version_num = ‘5ec5c84ba61e’
SELECT dashboards.updated_at AS dashboards_updated_at, dashboards.created_at AS dashboards_created_at, dashboards.id AS d
ashboards_id, dashboards.version AS dashboards_version, dashboards.org_id AS dashboards_org_id, dashboards.slug AS dashboa
rds_slug, dashboards.name AS dashboards_name, dashboards.user_id AS dashboards_user_id, dashboards.layout AS dashboards_la
yout, dashboards.dashboard_filters_enabled AS dashboards_dashboard_filters_enabled, dashboards.is_archived AS dashboards_i
s_archived, dashboards.is_draft AS dashboards_is_draft
FROM dashboards
select query from pg_stat_activity;
(3 rows)


#6

I am also having this issue where postgres is stuck on the following during upgrade of the same versions.

redash=# select * from pg_stat_activity;
-[ RECORD 1 ]----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
datid            | 16385
datname          | redash
pid              | 2566
usesysid         | 16384
usename          | redash
application_name |
client_addr      |
client_hostname  |
client_port      | -1
backend_start    | 2018-06-24 14:23:34.048971+00
xact_start       | 2018-06-24 14:23:34.05454+00
query_start      | 2018-06-24 14:23:34.496578+00
state_change     | 2018-06-24 14:23:34.496726+00
waiting          | f
state            | idle in transaction
query            | UPDATE alembic_version SET version_num='6b5be7e0a0ef' WHERE alembic_version.version_num = '5ec5c84ba61e'
-[ RECORD 2 ]----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
datid            | 16385
datname          | redash
pid              | 2567
usesysid         | 16384
usename          | redash
application_name |
client_addr      |
client_hostname  |
client_port      | -1
backend_start    | 2018-06-24 14:23:34.499889+00
xact_start       | 2018-06-24 14:23:34.504084+00
query_start      | 2018-06-24 14:23:34.505023+00
state_change     | 2018-06-24 14:23:34.505025+00
waiting          | t
state            | active
query            | SELECT dashboards.updated_at AS dashboards_updated_at, dashboards.created_at AS dashboards_created_at, dashboards.id AS dashboards_id, dashboards.version AS dashboards_version, dashboards.org_id AS dashboards_org_id, dashboards.slug AS dashboards_slug, dashboards.name AS dashboards_name, dashboards.user_id AS dashboards_user_id, dashboards.layout AS dashboards_layout, dashboards.dashboard_filters_enabled AS dashboards_dashboard_filters_enabled, dashboards.is_archived AS dashboards_is_archived, dashboards.is_draft AS dashboards_is_draft +
                 | FROM dashboards

I have tried stopping all redash services, has any headway been made on this?


#7

Was anyone able to find a solution to this?


#8

Upgrade to 3.0 is working fine. For now that is what i have done.


#9

How do I specify ver 3.0?


#10

I figured out how to modify the upgrade script to grab an older version of the package. I was able to upgrade to 3 and then 4. Or at least the DB now is on version 4


#11

I just upgrade an installation from 0.12.0 to 5.0.1.

Upgrade script was getting stalled. So what I did is, modified it and made it to upgrade to v2.0, then to v4, then to the latest.

https://version.redash.io/api/releases?channel=stable is the url upgarde script checks by default, as you can see, the oldest version listed there is v4. So, to update to v2, you need to use beta channel, which check on https://version.redash.io/api/releases?channel=beta url.
Go to this url and find the index to which you want to upgrade to for eg: currently, v"2.0.0" is in 3rd index.

Open upgrade script and search for get_release function. inside that, change response.json()[0] to the index you want. eg: response.json()[3]. Now run the script with beta as channel
sudo ./upgrade --channel beta.

This will upgrade your installation to v2. You need to make similar changes (no need to pass beta channel parameter if you want to upgrade to v4 or later) to manually upgrade to each version, and to finally arrive at the latest.