[LNT] r318231 - In the event some index creations fail, don't explode the migrate

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 16:01:03 PST 2017


Author: cmatthews
Date: Tue Nov 14 16:01:03 2017
New Revision: 318231

URL: http://llvm.org/viewvc/llvm-project?rev=318231&view=rev
Log:
In the event some index creations fail, don't explode the migrate

Seems like I was ignoring errors, but that would kill the transaction
so later index creations would fail. Use a new one for each.

Modified:
    lnt/trunk/lnt/server/db/migrations/upgrade_15_to_16.py

Modified: lnt/trunk/lnt/server/db/migrations/upgrade_15_to_16.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/upgrade_15_to_16.py?rev=318231&r1=318230&r2=318231&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/upgrade_15_to_16.py (original)
+++ lnt/trunk/lnt/server/db/migrations/upgrade_15_to_16.py Tue Nov 14 16:01:03 2017
@@ -23,9 +23,12 @@ def _mk_index_on(engine, ts_name):
 def upgrade(engine):
     """Add an index to FieldChangeV2 for each fo the test-suites.
     """
+
+    test_suite = introspect_table(engine, 'TestSuite')
+
     with engine.begin() as trans:
-        test_suite = introspect_table(engine, 'TestSuite')
+        db_keys = list(trans.execute(select([test_suite])))
 
-        db_keys = trans.execute(select([test_suite]))
-        for suite in db_keys:
+    for suite in db_keys:
+        with engine.begin() as trans:
             _mk_index_on(trans, suite[2])




More information about the llvm-commits mailing list