2008/11/23 Luke Macken <span dir="ltr"><<a href="mailto:lmacken@redhat.com">lmacken@redhat.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
As some of you may have noticed, the last batch of updates contained 209<br>
updates with the ID of 'FEDORA-2008-10000'. This is is due to a flaw in the<br>
way bodhi's PackageUpdate.assign_id() method finds the current update with the<br>
highest id. Presently, it does a PackageUpdate.select(...,<br>
orderBy=PackageUpdate.q.updateid). Since PackageUpdate.updateid is a unicode<br>
column, and due to the fact that u'FEDORA-2008-10000' < u'FEDORA-2008-9999',<br>
this started to fail miserably.<br>
<br>
Attached is a patch that has the assign_id method order the query by the<br>
date_pushed DateTimeCol in order to find the highest updateid. However, it<br>
seems that SQLObject completely ignore milliseconds:<br>
<br>
if datetime:<br>
def DateTimeConverter(value, db):<br>
return "'%04d-%02d-%02d %02d:%02d:%02d'" % (<br>
value.year, value.month, value.day,<br>
value.hour, value.minute,<br>
value.second)<br>
<br>
The problem with this is that we must now take into account multiple updates<br>
that were pushed at the same second.<br>
<br>
The "proper" way to fix this is at the model level, and probably to use an<br>
integer for the updateid column. I'm in the process of finishing up the<br>
SQLAlchemy port, which will properly solve this problem. In the mean time,<br>
this hack will not require any database changes.<br>
<br>
This patch also includes a test case for this 10k bug.<br>
<br>
[lmacken@x300 bodhi]$ nosetests<br>
bodhi/tests/test_model.py:TestPackageUpdate.test_id<br>
.<br>
----------------------------------------------------------------------<br>
Ran 1 test in 0.084s<br>
<br>
OK<br>
<br>
Once approved and applied, I will push out a fixed package (to releng2 only),<br>
fix the existing updates from the last push, and send out an errata containing<br>
the new update IDs.<br>
<br>
+1's ?<br>
<font color="#888888"><br>
luke<br>
</font><br>_______________________________________________<br>
Fedora-infrastructure-list mailing list<br>
<a href="mailto:Fedora-infrastructure-list@redhat.com">Fedora-infrastructure-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-infrastructure-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-infrastructure-list</a><br>
<br></blockquote></div><br>+1<br>
<br>
--sg<br>