]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Reorg table ml2_port_bindings when db migration
authorwangbo <wbwangbo@cn.ibm.com>
Mon, 12 May 2014 07:18:03 +0000 (15:18 +0800)
committerwangbo <wbwangbo@cn.ibm.com>
Sun, 18 May 2014 14:02:25 +0000 (22:02 +0800)
For DB2, there are restrictions on table access
after ALTER TABLE statements containing
REORG-recommended operations.
Table will be placed in "reorg pending" state
after some continuous alter table operations.
Need run reorg table to make the table available.
More info refer to:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp
?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Fc0023297.htm

Change-Id: I7fdd61bb4d636d7a3260c0b23152f1f3083cdcfd
Fixes: bug #1318498
neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py

index f89be7c11d05acf10a7e75071d152f4af1b6dcb8..4182eea1ac8bee4c49a72b50d41a1afbb3501445 100644 (file)
@@ -65,6 +65,8 @@ def upgrade(active_plugins=None, options=None):
             " vif_details = '{\"port_filter\": false}'"
             " WHERE cap_port_filter = false")
     op.drop_column('ml2_port_bindings', 'cap_port_filter')
+    if op.get_bind().engine.name == 'ibm_db_sa':
+        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
 
 
 def downgrade(active_plugins=None, options=None):
@@ -93,3 +95,5 @@ def downgrade(active_plugins=None, options=None):
             " cap_port_filter = true"
             " WHERE vif_details LIKE '%\"port_filter\": true%'")
     op.drop_column('ml2_port_bindings', 'vif_details')
+    if op.get_bind().engine.name == 'ibm_db_sa':
+        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")