2008/11/23 Luke Macken <span dir="ltr">&lt;<a href="mailto:lmacken@redhat.com">lmacken@redhat.com</a>&gt;</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 &#39;FEDORA-2008-10000&#39;. &nbsp;This is is due to a flaw in the<br>
way bodhi&#39;s PackageUpdate.assign_id() method finds the current update with the<br>
highest id. &nbsp;Presently, it does a PackageUpdate.select(...,<br>
orderBy=PackageUpdate.q.updateid). &nbsp;Since PackageUpdate.updateid is a unicode<br>
column, and due to the fact that u&#39;FEDORA-2008-10000&#39; &lt; u&#39;FEDORA-2008-9999&#39;,<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. &nbsp;However, it<br>
seems that SQLObject completely ignore milliseconds:<br>
<br>
 &nbsp; &nbsp;if datetime:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;def DateTimeConverter(value, db):<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return &quot;&#39;%04d-%02d-%02d %02d:%02d:%02d&#39;&quot; % (<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;value.year, value.month, value.day,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;value.hour, value.minute,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;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 &quot;proper&quot; way to fix this is at the model level, and probably to use an<br>
integer for the updateid column. &nbsp;I&#39;m in the process of finishing up the<br>
SQLAlchemy port, which will properly solve this problem. &nbsp;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>
 &nbsp; &nbsp;[lmacken@x300 bodhi]$ nosetests<br>
 &nbsp; &nbsp;bodhi/tests/test_model.py:TestPackageUpdate.test_id<br>
 &nbsp; &nbsp;.<br>
 &nbsp; &nbsp;----------------------------------------------------------------------<br>
 &nbsp; &nbsp; Ran 1 test in 0.084s<br>
<br>
 &nbsp; &nbsp; 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&#39;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>