Upcoming fix in mgo/txn

Gustavo Niemeyer gustavo at niemeyer.net
Fri Aug 30 18:26:29 UTC 2013


Just a quick heads-up about an upcoming fix in mgo/txn which *should*
make no difference, but it's worth knowing about.

The application of multiple operations on the same document id in the
same transaction is currently not functioning properly. All but the
first transaction will fail to be applied.

So, for example, if a a transaction is doing Insert+Update *on the
same collection and id*, the Update is currently never applied,
whether the document exists or not. If the transaction is doing
Update+Insert, the Update is currently applied if the document exists,
and the Insert is never applied.

This is being fixed in the upcoming mgo release. Insert+Update will
work properly if the document exists or not (if it exists only the
Update will do something). Doing Update+Insert is a nice to way to say
"either update or insert", as only a single one of them can possibly
work depending on whether the document exists or not.

This change should not affect existent code, unless the code is buggy
and already not working properly.


gustavo @ http://niemeyer.net



More information about the Juju-dev mailing list