[MediaWiki-l] [Cargo] Duplicate Cargo Rows

Ed edward.hoo at gmail.com
Sun Dec 13 21:14:15 UTC 2015


Hi,

I went over the code and noticed that DB_SLAVE was being used in read-only
queries that are part of update processes.  I do not know if this is what
generated the issues I'm experiencing (I'm not running replication).
However, it could generate race conditions in a replicated environment as
the slave would not always have the most current information.  Therefore I
updated the calls to DB_MASTER for the functions that seemed to be called
as part of an update/delete/insert sequence.  That left only one or two
instances using DB_SLAVE.  So I updated all calls to DB_MASTER for good
measure -- in case I had missed something.

I will run it like this for a while and see if we get more duplicate
entries in the cargo tables.

Thoughts?


On Sun, Dec 13, 2015 at 8:39 AM, Yaron Koren <yaron at wikiworks.com> wrote:

> Yes, it probably is due to a race condition.
>
> Hopefully, there's a better solution than using unbuffered queries - if
> that is a solution.
>
> -Yaron
>
> On Sun, Dec 13, 2015 at 12:51 AM, Ed <edward.hoo at gmail.com> wrote:
>
> > Hi,
> >
> > The duplicate rows seem to happen as a result of a race condition when
> the
> > new record has been queued and somewhere in the process we reedit or
> > regenerate and queue a second one.
> >
> > I'm not sure if it is buffering, using multiple connections, something
> > else.
> >
> > I was going to mess around with the DBO_NOBUFFER setting but the comments
> > in "includes/db/Database.php" are a bit ominous:
> >
> >          * Unbuffered queries are very troublesome in MySQL:
> >          *
> >          *   - If another query is executed while the first query is
> being
> > read
> >          *     out, the first query is killed. This means you can't call
> > normal
> >          *     MediaWiki functions while you are reading an unbuffered
> > query result
> >          *     from a normal wfGetDB() connection.
> >          *
> >          *   - Unbuffered queries cause the MySQL server to use large
> > amounts of
> >          *     memory and to hold broad locks which block other queries.
> >
> > Thoughts?
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


More information about the MediaWiki-l mailing list