[Buildbot-devel] IntegrityError on postgresql, "claimed_at" violates not-null constraint

Benoît Allard benoit at aeteurope.nl
Mon Sep 24 10:23:35 UTC 2012

> -----Original Message-----
> From: djmitche at gmail.com [mailto:djmitche at gmail.com] On Behalf Of Dustin J.
> Mitchell
> Sent: Saturday, September 22, 2012 3:56 PM
> To: Benoît Allard
> Cc: BuildBot Devel (buildbot-devel at lists.sourceforge.net)
> Subject: Re: [Buildbot-devel] IntegrityError on postgresql, "claimed_at"
> violates not-null constraint
> On Fri, Sep 21, 2012 at 10:37 AM, Benoît Allard <benoit at aeteurope.nl> wrote:

> > I imagine querying before inserting (to check if the request is not already
> claimed) is not an option, right ? What if we do that inside a transaction ?
> Oh wait, the transaction is already there ... What's the problem then ?
> Transactions don't assure read-before-write atomicity in any of the
> databases we support.  That would be "serializable" isolation
> http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
> which basically means that if any of the data returned by a SELECT
> during the transaction has changed when the transaction is committed,
> then the commit fails.
> I think postgres *can* support this, but SQLite can't, and MySQL can't, AFAIK.

Please forgive my database ignorance, SQLAlchemy is great at that that it make you believe you master a field, where you don't know anything of the underlying architecture ...

> From re-reading the docs, it looks like conn.execute should take each
> dict as a positional argument, rather than a list, e.g.,
> 113                 conn.execute(q, *[ dict(brid=id,
> objectid=_master_objectid,
> 114                                     claimed_at=claimed_at)
> 115                                   for id in brids ])
> can you try that and see if it works better?  What version of
> sqlalchemy are you running?

Thanks a lot for this prompt debugging ! I modified the line, I will report further evolutions in time.

So, this bug happen every time there is more than one buildrequest pending on one builder ? That can match the trouble I had ... Good point is, looks like a testcase would not be too difficult to bake ! I'll have a look at that tonight ...

I'm running SQLAlchemy 0.7.6 (from a virtualenv so it's pretty easy to upgrade ...).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6467 bytes
Desc: not available
URL: <http://buildbot.net/pipermail/devel/attachments/20120924/27c4ce0d/attachment.bin>

More information about the devel mailing list