Auto Increment

Hi,
a couple of weeks ago I have asked about the auto-increment here:
http://www.zenphoto.org/support/topic.php?id=24081

I was wrong that I suspected the sitemap plugin - but there is a question mark left for me.
To make things clear, this is not a bug report - I just like to unterstand how things work.

Here is the scenario:
My galerie holds 1181 images. They have been uploaded per ftp on several days.
The images database table shows:
1181 rows and a auto-increment value of 1182 which makes sense, because I never deleted images.

Yesterday I have uploaded 4 new images - a control of the database shows me for the images table:
1185 rows and a auto-increment value of 1186
Again: No question marks until yet. Zenphoto has recognized the new added images.

Then I have visited the gallery and viewed one of the new images in detail view.
From this time the database table shows:
1185 rows and a auto-incremet value of 1191.

I am just wondering what has caused the auto-increment value to change from 1186 to 1191.

Because the table already showed 1185 before visiting I see no reason why the auto-increment value changed to a new value.

Again: I just want to understand what happens here :-)

Ralf

Comments

  • acrylian Administrator, Developer
    If auto increment is used as we do it always starts with the greatest value present if adding new elements.

    So if you have values from 1 to 2000 and delete entry value 1999, the next will still get 2001 as a value. "Free" values inbetween are not re-assigned.

    That means if you have numbers missing you probably have deleted images or albums sometime in the past.

    http://stackoverflow.com/questions/4562479/how-does-mysql-auto-increment-work
    http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
  • Hi Acrylian,

    and this is exactly what makes me wonder. I have not deleted albums or pictures.

    So I see no reason why the auto-increment value has changed.

    Cheers
    ralf
  • acrylian Administrator, Developer
    Then I have no idea actually.
  • Does not matter :-)
  • Ralf Member
    Hi,

    I still can reproduce it with the following steps:

    1. Fresh install of Zenphoto - Sitemap extended not enabled yet
    2. Create some albums
    3. FTP upload of some images to the different albums
    4. Enable the sitemap extended plugin and created the sitemap data

    Before step 4 the images table looks like:
    Rows: 1642
    Auto Increment: 1643

    After performing the sitemap creation in step 4 it looks like:
    Rows: 1642
    Auto Increment: 3247

    Beneath the auto increment value in the images table, the auto increment value also changes in the obj_to_tag table.

    ---------
    I have no idea what happens here, it seems to be template independant because I could reproduce it also with the standard templates.

    The only thing I can imagine:
    The creation of the sitemap was done a few minutes after the ftp upload has finished. Maybe the caching of the images was not complete?

    Would be great if someone can give me a hint.

    Cheers
    Ralf
  • If the database has all the image records in it when you check, it has discovered the images. Caching really has nothing to do with this and occurs only when a specific image size is requested that is not already in the cache.

    The behavior you describe suggests that Zenphoto thinks the images are "new" when they are looked at. (The old records would go away if Zenphoto discovers the images not there.) Exactly how that might happen is beyond my imagination.

    But some things that you can check:

    For the same image are do the "before" and "after" records contain exactly the same data. If not, what is different.

    Check your table structure's indexes. You should have two indexes for images, the id and filename+albumid. If those are not there it would be possible to get duplicate records which might later be purged.

    See what happens if you wait to do the sitemap until after you have "used" the site for a while. See if the ids have increased.
  • Ralf Member
    Hi sbillard,

    thanks for your explanation.

    I have already checkd if there are differences - there are none.

    Next time i create the sitemap after I the site is used for a while.
    The only other thing (I have to guess here) is that the naming of the files 'confuse' zenphoto.
    My files are named like this:
    date_filename_number
    e.G.:
    20130530_Wildlife_023

    Cheers
    Ralf
  • Ralf Member
    Here is what I found out:

    Based on the example above with the image named:
    20130530_Wildlife_023

    This will become:
    20130530_wildlife_023

    So my guess is that after the sitemap runs zenphoto thinks that it is a new image because of the small w instead of the W.

    At the moment I start from scratch renaming the images to 'small letters'.

    I ran a test with 100 images, created the sitemap and the id numbers remain the same. So I think this was the problem.

    Cheers
    Ralf
  • It would indeed be a new image, but I do not know where that change of case would be happening. Unless you are running the seo_cleanup plugin. But even that plugin should have done the rename "properly" so that Zenphoto would know it was the same image.
  • Ralf Member
    Hi sbillard,

    my favorite guess:
    It must have been the naming of the files:
    BurgersZoo for example

    Converted the filename to:
    burgerszoo
    and anything is fine yet.

    All images are online now (1641) at:
    http://www.pixel-wonders.de

    I ran the seo-cleanup and the sitemap generation several times.
    No auto-increment until yet.

    Looks good :-)

    Cheers
    Ralf
  • acrylian Administrator, Developer
    Since servers do make a difference in the case which most normal systems (like Mac OS) don't, BurgersZoo.jpg and burgerszoo.jpg would be different files.
  • Ralf Member
    Hi,

    just want to let you know that it was indeed the filenaming which caused problems all the time.

    Since I have renamed them all to 'small letters' anything is fine.

    And yes i am happy that I got my gallery running :-)

    Cheers
    Ralf
Sign In or Register to comment.