•  » Engine
  •  » user cache refresh and concurrency issues

#1 2011-12-16 15:02:27

Piwigo Team
Nantes, France, Europe

user cache refresh and concurrency issues

Hi Piwigo dev team,

Today a user has reported a problem of number of photos in an album, see [Forum, topic 18523] [Resolved] Move User Uploaded Pics into another Album. The problem was due to a change made in Batch Manager to avoid concurrency error on user cache refresh when generating 3 thumbnails at once in AJAX. The fix was good but introduced a small bug (only for the admin user, not really a big problem).

The real problem is the concurrency on user cache refresh. The algorithm to rewrite cache is a simple delete+insert, but if the page is opened twice by the same user (which can be "guest"), we may have this:

1) user A performs delete, works fine
2) user B performs delete, works fine
3) user A performs insert, works fine
4) user B performs insert, fails for "duplicate key"

[Bugtracker, ticket 2534, fixed] incorrect number of photos for an album (user cache related issue)

I have coded a stronger "fix" for this concurrency issue. Considering we have MySQL+MyISAM, we can't rely on InnoDB transactions. So I considered that "ignoring" insert error was fine.

For this specific query, Piwigo performs an "INSERT IGNORE" instead of just "INSERT" => fails silently. This should not generate any problem for gallery visitors.

Latest blog post (November 9th 2018) Why Flickr could not remain free for ever


  •  » Engine
  •  » user cache refresh and concurrency issues

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate © 2002-2019 · Contact