Comment 6 for bug 1454891

Revision history for this message
Menno Finlay-Smits (menno.smits) wrote :

There are 4953 txns in the "preparing" state, 2 txns in the "prepared" and 1 (stuck?) in the "applying" state. They are all leadership update attempts for the "ubuntu" charm.

The code that generates these txns looks potentially problematic to me:

    ops := []txn.Op{
        // First remove anything that's there.
 {
            C: p.collectionName,
            Id: id,
            Remove: true,
        },
        // Then insert the token.
        {
            Assert: txn.DocMissing,
            C: p.collectionName,
            Id: id,
            Insert: entity,
        },
    }

Removing and inserting the same id in the one txn could be triggering a problem in mgo/txn.

Could a simulated upsert be used instead?
http://stackoverflow.com/questions/24455478/simulating-an-upsert-with-mgo-txn