Re: Insert Query Executed Twice

Re: Insert Query Executed Twice

am 02.05.2003 14:47:33 von Peter Zaitsev

On Fri, 2003-05-02 at 17:28, Colin Nelson wrote:
> Scenario:-
> PHP script launches sequence of MySQL queries recording results in a log. Receives
> a parameter to identify report to be generated.
> 2 sessions started which launch PHP script to generate 2 reports simultaneously.
>
>
> I will call these First and Second Report to differentiate. They are started
> within a fraction of a second of each other but take about 20 seconds to execute.
> There are around 140 queries in the script.

Colin,

Can you create the repeatable bug report ? For example structure of
tables + example PHP (Perl) script we can run ? Do not forget to include
MySQL version you were using.

But before this I would recommend you to enable full logging on MySQL
server (--log option) and examine the log. It is very possible this
query is just sent to MySQL server twice for some reason.




--
Are you MySQL certified?, http://www.mysql.com/certification/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Peter Zaitsev
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Moscow, Russia
<___/ www.mysql.com


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Insert Query Executed Twice

am 02.05.2003 15:28:14 von Colin Nelson

Scenario:-
PHP script launches sequence of MySQL queries recording results in a log. Receives
a parameter to identify report to be generated.
2 sessions started which launch PHP script to generate 2 reports simultaneously.


I will call these First and Second Report to differentiate. They are started
within a fraction of a second of each other but take about 20 seconds to execute.
There are around 140 queries in the script.

Result:-
Tables show the results of the same Insert query for the First Report, then
the Second Report, then the First Report again. Data in these tables is generated
using INSERT...FROM followed by a SELECT statement. Field values generated
by SUM function for the second set of results are double the value of the first
set. Log indicates PHP requested query once only in First Report, so query
was not re-sent by PHP, nor was PHP script run twice, as both scenarios would
have been recorded in the log.

Hypothesis:-
MySQL processes an INSERT query for First Report when it receives the same query
for Second Report. Something makes it think that the First Report query has
not been run and re-runs it, creating duplicate records.

Action Taken:-
LOW_PRIORITY clause inserted into INSERT query. This did not resolve the problem.

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org