First time here? Check out the FAQ!
0

Upgrade error: canceling statement due to statement timeout

I tried to upgrade askbot from 0.7.43 to 0.7.48. But got the following errors: 1) In migrate process:

 - Migrating forwards to 0161_add_field__user_languages.
 > askbot:0158_add_title_search_indices_for_postgresql_and_mysql
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/management/commands/migrate.py", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/__init__.py", line 191, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 221, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 292, in migrate_many
    result = self.migrate(migration, database)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 125, in migrate
    result = self.run(migration)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 99, in run
    return self.run_migration(migration)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/home/alekcac/webapps/askbot_webapp_7_48/myaskbot/askbot/migrations/0158_add_title_search_indices_for_postgresql_and_mysql.py", line 33, in forwards
    postgresql.setup_full_text_search(script_path)
  File "/home/alekcac/webapps/askbot_webapp_7_48/myaskbot/askbot/search/postgresql/__init__.py", line 21, in setup_full_text_search
    cursor.execute(fts_init_query)
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: canceling statement due to statement timeout
CONTEXT:  PL/pgSQL function "get_thread_question_tsv" line 9 at RETURN
PL/pgSQL function "thread_update_trigger" line 3 at assignment
SQL statement "UPDATE askbot_thread SET id=new.thread_id WHERE id=new.thread_id"
PL/pgSQL function "post_trigger" line 12 at SQL statement
SQL statement "UPDATE askbot_post SET text_search_vector=NULL"
PL/pgSQL function "add_tsvector_column" line 11 at EXECUTE statement

2) When I tried to open any question I get:

column askbot_thread.language_code does not exist
LINE 1: ...ivity_at", "askbot_thread"."last_activity_by_id", "askbot_th...

Could you give any advice about it?

alekcac's avatar
11
alekcac
asked 2013-01-31 18:23:39 -0500
Evgeny's avatar
13.2k
Evgeny
updated 2013-02-02 16:54:18 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

i have the same issues. 3 days to upgrade from 0.7.43 to 0.7.48 (Sqlite3) with no results.

#file corupted of encrypted #disk img error #Database error

My site is working fine with 0.7.43.

iam asking the admins of askbot to make a small script to make this migration possible !!!

nightmare migration :(

coldsystem's avatar
31
coldsystem
answered 2013-02-01 03:20:04 -0500
edit flag offensive 0 remove flag delete link

Comments

sqlite is different though.

Evgeny's avatar Evgeny (2013-02-02 16:35:34 -0500) edit
add a comment see more comments
0

To work around this specific issue, you might try temporarily change the statement_timeout parameter in your database.

Find the file postgresql.conf, change the value there, restart the database, then run the migrations. Default value for the statement timeout is 0, which means the timeout is turned off.

The second issue is due to incomplete migrations. Any time you see something like "column X does not exist" it means the database is not in sync with the code and most likely means that some migrations were not run.

edit: if you can't change the postgres.conf file, then you can try running the postgres scripts used in the failing migration manually like so:

PGOPTIONS="-c statement_timeout=60000" psql -U dbuser dbname < the_script.sql

Then fake-apply the corresponding migration.

Also: not verified, but it's possible that the statement timeout in the postgresql backend can be configured in django via options to the DATABASES setting, please investigate.

Evgeny's avatar
13.2k
Evgeny
answered 2013-02-02 16:52:46 -0500, updated 2013-03-08 11:38:24 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments