[PATCH] D68799: [LNT] Fix sql index name collision

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 08:50:08 PDT 2019


thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
Herald added a subscriber: arphaman.
thopre added a parent revision: D68798: [LNT] Python 3 support: fix printing of exceptions.
thopre added a child revision: D68800: [LNT] Python 3 support: adapt csv reader open.

As revealed by the exception printing failure prior to the previous
commit, sqllite throws an error when creating the index for the
RegressionID field for the NT and link testsuite schemas since they have
the same name. This commit adds the testsuite schema to the index name
to avoid this collision.


https://reviews.llvm.org/D68799

Files:
  lnt/server/db/migrations/upgrade_15_to_16.py
  lnt/server/db/migrations/upgrade_16_to_17.py


Index: lnt/server/db/migrations/upgrade_16_to_17.py
===================================================================
--- lnt/server/db/migrations/upgrade_16_to_17.py
+++ lnt/server/db/migrations/upgrade_16_to_17.py
@@ -11,7 +11,7 @@
 def _mk_index_on(engine, ts_name):
     fc_table = introspect_table(engine, "{}_RegressionIndicator".format(ts_name))
 
-    fast_fc_lookup = Index('idx_fast_ri_lookup', fc_table.c.RegressionID)
+    fast_fc_lookup = Index('{}_idx_fast_ri_lookup'.format(ts_name), fc_table.c.RegressionID)
     try:
         fast_fc_lookup.create(engine)
     except (sqlalchemy.exc.OperationalError, sqlalchemy.exc.ProgrammingError) as e:
Index: lnt/server/db/migrations/upgrade_15_to_16.py
===================================================================
--- lnt/server/db/migrations/upgrade_15_to_16.py
+++ lnt/server/db/migrations/upgrade_15_to_16.py
@@ -11,7 +11,7 @@
 def _mk_index_on(engine, ts_name):
     fc_table = introspect_table(engine, "{}_FieldChangeV2".format(ts_name))
 
-    fast_fc_lookup = Index('idx_fast_fieldchange_lookup', fc_table.c.StartOrderID)
+    fast_fc_lookup = Index('{}_idx_fast_fieldchange_lookup'.format(ts_name), fc_table.c.StartOrderID)
     try:
         fast_fc_lookup.create(engine)
     except (sqlalchemy.exc.OperationalError, sqlalchemy.exc.ProgrammingError) as e:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68799.224365.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191010/21be80cc/attachment.bin>


More information about the llvm-commits mailing list