summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2013-06-07 17:23:04 -0500
committerBrant Knudson <bknudson@us.ibm.com>2013-06-07 17:23:04 -0500
commit67157406ea2e15bea3322b64c67680db184554ef (patch)
tree6bafc034396477d06a052515fe8410ee7f748350
parent8398d2f430510bd9d3492b886611a8f022d6aa6d (diff)
Commit transaction in migration
Some databases (e.g., DB2) would deadlock on migration 16 because a lock was held on the domain table for an uncommitted alter and then SQLAlchemy queried the domain table info in a separate transaction. The fix is to commit the ALTER statements to release the lock so that the domain table schema query will not block. I've run this with sqlite, mysql, and postgresql and they all worked. Part of fix for bug 1188785 Change-Id: Ic540a6cb09a0c525df7aaea55b64af96f0dd87c7
-rw-r--r--keystone/common/sql/migrate_repo/versions/016_normalize_domain_ids.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/keystone/common/sql/migrate_repo/versions/016_normalize_domain_ids.py b/keystone/common/sql/migrate_repo/versions/016_normalize_domain_ids.py
index cfab79d4..f8e46591 100644
--- a/keystone/common/sql/migrate_repo/versions/016_normalize_domain_ids.py
+++ b/keystone/common/sql/migrate_repo/versions/016_normalize_domain_ids.py
@@ -347,6 +347,8 @@ def upgrade_user_table_with_col_create(meta, migrate_engine, session):
session.execute('ALTER TABLE "user" ADD CONSTRAINT user_dom_name_unique '
'UNIQUE (domain_id, name);')
+ session.commit()
+
def upgrade_project_table_with_col_create(meta, migrate_engine, session):
# Create the domain_id column. We want this to be not nullable