Author Topic: Re-indexing error  (Read 4186 times)

Offline Marv

  • Newcomer
  • *
  • Posts: 36
    • View Profile
Re-indexing error
« on: September 21, 2019, 03:19:42 PM »
While re-indexing with build 3719, I received the attached error message.
Is there any way to correct the error without creating a completely new catalog?

Thanks,
Marv

PM+ 6, build 3719
Mac OS X 10.4.3
Mac Mini 2018
32GB RAM

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Re-indexing error
« Reply #1 on: September 22, 2019, 12:58:28 PM »
Marv,

While re-indexing with build 3719, I received the attached error message.
Is there any way to correct the error without creating a completely new catalog?

Was that catalog working fine prior to the reindexing or was it already having problems?

-Kirk

Offline Marv

  • Newcomer
  • *
  • Posts: 36
    • View Profile
Re: Re-indexing error
« Reply #2 on: September 22, 2019, 07:30:16 PM »
Kirk,

Yes, it work working prior to re-indexing and not having any problems.  Currently I can still search the catalog.  I haven't tried adding anything new to it.

Thanks,
Marv

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Re-indexing error
« Reply #3 on: September 23, 2019, 11:00:40 AM »
Marv,

Let's try repairing your catalog database.  Be sure you have quit Photo Mechanic Plus before following the instructions below.

Repairing a corrupt database:

Launch the Terminal.app (in the Utilities folder inside the Applications folder) on your Mac.  Type the following and add a trailing 'space' character:

cd

Then from the Finder, find your Catalog folder and drag and drop it onto the Terminal window.  The path to the Catalog folder should autocomplete.
Switch back to the Terminal window and press 'return' on your keyboard.  Next type:

sqlite3 catalog.pmdb

The prompt should now display sqlite> to indicate you’re in the SQLite shell. To verify that you’re truly suffering from database corruption, type the following command into the shell:

sqlite> PRAGMA integrity_check;

Press 'return'.  Don't forget the semi-colon.  This may take a while if your database is large.  If the response is anything other than ok, the database needs to be repaired.

Doing the Repair:

We need to dump the data into an external file and re-create the database manually. Enter the following commands into the SQLite shell, pressing 'return' after each line:

sqlite> .mode insert
sqlite> .output dump_all.sql
sqlite> .dump
sqlite> .exit

Now that we have the dump, let’s import it. You should now be out of the SQLite shell and back to the Terminal prompt. Enter and execute the following statements:

mv catalog.pmdb catalog.orig.pmdb
sqlite3 catalog.pmdb < dump_all.sql
sqlite3 catalog.pmdb

The first line above will move the original database out of the way. The second line will create a new one in place, using the dump we just exported. The last line should take us back into the SQLite shell in order to check if everything’s okay.

Run the integrity check one more time and we should see ‘ok’ as the response this time:

sqlite3> PRAGMA integrity_check;
ok

Type the following and then you can quit the Terminal application:

sqlite3> .exit

If the recovery succeeded, then you should be able to use Photo Mechanic Plus again and attempt the catalog re-index.

HTH,

-Kirk

Offline Marv

  • Newcomer
  • *
  • Posts: 36
    • View Profile
Re: Re-indexing error
« Reply #4 on: September 23, 2019, 07:32:33 PM »
Hi Kirk,

All goes as expected until the line “sqlite3 catalog.pmdb < dump_all.sql.”  The resulting file (the new catalog.pmdb) is only 254KB in size.  The original  catalog was 7.33GB; the dump was 7.17 GB.  Running PRAGMA integrity_check on the new catalog returns “ok”, but PM6+ won’t open the catalog.  Catalog>Manage Catalog shows the red error message: “Failed to open catalog”.   Fortunately, I made a backup of the catalog before I started this process.  This is the largest of my catalogs with nearly 793,000 images.

I repeated this process and got the same results. 

If there is nothing else to try, I can rebuild him.  We have the technology. ;)

Thanks,
Marv

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: Re-indexing error
« Reply #5 on: September 23, 2019, 08:26:26 PM »
Marv,

Do you still have the 'dump_all.sql' file?  If so and you have the upload bandwidth, we'd sure like to have that file for research purposes, zipped up of course.  If you're willing and able, I'll get you the FTP server credentials.

You may as well recover from your backup, and if that fails and you have to rebuild the entire catalog, you can save some time by turning proxy generation off and then moving the current 'proxies' folder from your damaged catalog folder to your newly rebuilt catalog folder.

-Kirk

Offline Marv

  • Newcomer
  • *
  • Posts: 36
    • View Profile
Re: Re-indexing error
« Reply #6 on: September 24, 2019, 05:39:53 AM »
Hi Kirk,

Sure thing.  I’ll send the zipped dump file wherever you’d like.  The zipped file is only 437 MB.

Ah!  I didn’t realize I would be able to re-use the proxies.  That will indeed save considerable time. 

Thanks,
Marv