[TYPO3-core] RFC: Bug 4581: Duplicate entry on cache_pagesection on reloading twice

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Jan 24 20:52:56 CET 2007


Oliver Hader wrote: on 23.01.2007 16:22:
> This is a SVN patch request.
> 
> Situation:
> When more visitory come to a page in Frontend at nearly the same time
> and caching is disabled (config.no_cache=1) SQL errors occur. As single
> user it can be reproduced on fast reloading the same page.
> 
> Problem:
> SQL error "duplicate entry" for query "INSERT INTO cache_pagesection".
> First an UPDATE query is sent to the database in hope that a
> corresponding record exists. Afterwards mysql_affected_rows is used to
> determine if the previous query was successful. If the UPDATE failed, a
> INSERT query is sent.
> mysql_affected_rows [1] also fails (returns zero) if the records exists
> but wasn't updated because old values were equal to new values. And then
> also an INSERT is sent. And this produces the "duplicate entry" error.
> 
> Solution:
> Replace mysql_affected_rows by mysql_info [2] which returns some more
> information and can tell, what happened on database.
> 
> Comments:
> mysql_info is available since PHP 4.3.0 what shouln't be a problem for
> 4.1.x - as the recent decision shows.

I +1 this for trunk.

The problem about not having locking/transactions is not so dramatic in
this case, as I already explained.

Depending on mysql_info is ok for me.

What is the minimum required mysql version for 4.1, btw?

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list