[llvm-commits] [zorg] r147161 - /zorg/trunk/lnt/lnt/server/db/testsuitedb.py

Daniel Dunbar daniel at zuster.org
Thu Dec 22 11:24:11 PST 2011


Author: ddunbar
Date: Thu Dec 22 13:24:11 2011
New Revision: 147161

URL: http://llvm.org/viewvc/llvm-project?rev=147161&view=rev
Log:
[lnt/v0.4]: lnt.server.db.testsuitedb: Fix a bug in reassignment of Order ordinals.
 - We could end up presenting non-unique ordinal values to the DB because of how SA flushing works.
 - The current solution for this problem is really horrible, but I'd rather figure out how to fix it once I have good test cases for the (performance) problem.

Modified:
    zorg/trunk/lnt/lnt/server/db/testsuitedb.py

Modified: zorg/trunk/lnt/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/testsuitedb.py?rev=147161&r1=147160&r2=147161&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Thu Dec 22 13:24:11 2011
@@ -392,11 +392,23 @@
             orders.sort()
 
             # Assign ordinals.
-            for i,o in enumerate(orders):
+            #
+            # We iterate in reverse order to guarantee that we do not create
+            # unique conflicts.
+            for i in range(len(orders)-1,-1,-1):
                 # FIXME: Figure out whether or not SA checks modified status on
                 # write or on value change.
+                o = orders[i]
                 if o.ordinal != i:
                     o.ordinal = i
+                    # We have to flush now in order to assure that SA will not
+                    # present non-unique values to the database.
+                    #
+                    # FIXME: This is really horrible from a performance point of
+                    # view. If we can't figure out how to get SA to do a batch
+                    # update then we should write the SQL query to do the update
+                    # directly.
+                    self.v4db.session.flush()
 
             # Finally, add the new order.
             self.add(order)





More information about the llvm-commits mailing list