In the testharness, I clicked DeleteAllItems and waited for some time. Then I clicked it again (without waiting for the first click to complete) and it gave this error (of course, I expected problems):
Test: core :: DeleteAllItems [1 iteration(s)]
Timing: 2.1332 elapsed, 0.4688 per second
Error: Error (ERROR_MISSING_OBJECT)
* in modules/core/classes/GalleryStorage/DatabaseStorage.class at line 1703
* in modules/core/classes/GalleryStorage/DatabaseStorage.class at line 289
* in modules/core/classes/Gallery.class at line 283
* in modules/core/classes/Gallery.class at line 320
* in modules/core/test/TestCase/DeleteAllItems.class at line 43
* in setup/test/TestCase.class at line 18
* in setup/test/index.php at line 212
But what happens if my gallery holds many many items and I click DeleteAllItems?
PHP will probably cancel the operation due to 30 seconds limitation for a script to run.
I expect this will corrupt the gallery.
Is there anything to prevent this? using transactions for database operations?
Maintaining some kind journal while doing things so Gallery can see what actions have been unfinished next time it runs?
Just some ideas..
Cheers,
Kees
Posts: 7994
G2 uses a locking mechanism that prevents it from getting corrupted. What you witnessed below wouldn't lead to corruption, it's just that one of the DeleteAllItems tasks deleted something that the second one was waiting for.
Nope. G2 will make sure that it extends the time limit so that it has enough time
for the operation to run. This won't cause corruption, either.
I do intend to add support for transactions, though many MySQL installs won't
support them. It will become a parameter to the storage subsystem in config.php.
That'll come a bit later, though.