DBRepair development

Thanks. Greatly appreciate you getting that so quickly.

How’s Oz ? Cold enough? It’s blistering hot here. We even had two tornados in south central Pa (of all places).

My car got 1" of water in it. Spent a week at the dealership getting dried out.
Almost $2000 later, It’s back to its normal self. No electrical damage other than one wet connector.

They gutted it to the metal, interior + sunroofs completely removed – everything cleaned.

@StephenH

I just looked at the code (couldn’t wait).

Found the problem.

It’s a false positive.
VERY minor oversight on my part. Don’t know why it didn’t fault for me.
( I’ll figure that out too)

  1. I didn’t correctly discern between FTS and spellfix tables
  2. CheckFTS looked at it and said “NOPE!” (the false positive).

I will fix this in the morning and post v0.1999.03 after I’ve confirmed with your DB. This warrants an immediate release bump.

Ok, link to my DB coming soon …

Edit: PM Sent …

All,

  1. Stephen’s issue fixed. It was exactly as I thought.
  2. Spotted edge case with getting Plex data directory in windows - fixed.

I will publish 0.1999.03 as soon as I can confirm everything is fixed with Stephen’s DB (or anyone else’s which demonstrates the same FTS -vs- spellfix table issue.)
( It was a false-positive thinking there was an error which wasn’t )

ALL:

Having conferred with @StephenH’s test DB, the correction looks good.

I offer v0.1999.03 for your consideration.

Corrections:

  • Improved handling of FTS vs Shadow tables for older databases
    ( Stephen’s is several years old. I had not completely accounted for that)

  • Fixed an issue on Windows:
    I did not properly detect If the LocalAppDataPath is added after PMS is installed, It would continue to use the InstallPath instead of the new location.

Package ZIPs

Please don’t hesitate to reach out if issues , comments, suggestions, …

Enjoy,
C.

Looking good @ChuckPA, and REALLY fast!

Last login: Sun Jul 19 13:54:39 on ttys000
/Users/Shared/PlexDBRepair/DBRepair\ v0.1999.03/DBRepair ; exit;
stephenh@MacStudio ~ % /Users/Shared/PlexDBRepair/DBRepair\ v0.1999.03/DBRepair ; exit;



            Database Repair Utility for Plex Media Server  (macOS 15.7.7 (Sequoia))
                       Version 0.1999.03 (Jul 19 2026)


Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : stop
 
Stopping PMS. (60 second max delay)
Stopped PMS.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : check
 
Checking the PMS databases...
Database is damaged: row 1138 missing from index index_title_sort_icu
  PMS main database is damaged.
  PMS blobs database is OK.

Checking the PMS databases... complete.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : repair
 
--- Processing Main DB ---
Rebuilding and Verifying Main DB structure...
Rebuilding indexes from source schema...
Rebuilding FTS Virtual Tables for Main...

--- Processing Blobs DB ---
Rebuilding and Verifying Blobs DB structure...
Rebuilding indexes from source schema...
Rebuilding FTS Virtual Tables for Blobs...

Making DB(s) active
Swap complete. Live databases updated.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : check\
 
Checking the PMS databases...
  PMS main database is OK.
  PMS blobs database is OK.

Checking the PMS databases... complete.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : start
 
Starting PMS.
Started PMS.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) :

and

2026-07-20 08.56.29 - Session start. Mon Jul 20 08:56:29 2026
2026-07-20 08.56.29 - ============================================================
2026-07-20 08.56.40 - RunSysCmd executing: 'TMPDIR=/tmp osascript -e 'tell app "Plex Media Server" to quit''
2026-07-20 08.56.40 - RunSysCmd: Command exited with status 0
2026-07-20 08.56.46 - Stop - PASS
2026-07-20 08.56.52 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
2026-07-20 08.56.52 - CheckDB - FAIL - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db: row 1138 missing from index index_title_sort_icu
2026-07-20 08.56.52 - CheckDB - Checking Indexes and FTS tables - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
2026-07-20 08.56.52 - CheckDB - Full check complete - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
2026-07-20 08.56.52 - Check   - Check /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db DB - FAIL
2026-07-20 08.56.52 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db
2026-07-20 08.56.52 - CheckDB - Checking Indexes and FTS tables - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db
2026-07-20 08.56.52 - CheckDB - Full check complete - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db
2026-07-20 08.56.52 - Check   - Check Blobs DB - PASS
2026-07-20 08.56.52 - Check   - FAIL
2026-07-20 08.56.52 - Check   - CheckFTS Main DB - START
2026-07-20 08.56.52 - Check   - FTS Check: spellfix_metadata_titles - PASS
2026-07-20 08.56.52 - Check   - FTS Check: spellfix_tag_titles - PASS
2026-07-20 08.56.52 - Check   - FTS Check: fts4_metadata_titles - PASS
2026-07-20 08.56.52 - Check   - FTS Check: fts4_tag_titles - PASS
2026-07-20 08.56.53 - Check   - FTS Check: fts4_metadata_titles_icu - PASS
2026-07-20 08.56.53 - Check   - FTS Check: fts4_tag_titles_icu - PASS
2026-07-20 08.56.53 - Check   - CheckFTS Blobs DB - START
2026-07-20 08.56.53 - Check   - FTS Check: spellfix_metadata_titles - PASS
2026-07-20 08.56.53 - Check   - FTS Check: spellfix_tag_titles - PASS
2026-07-20 08.56.53 - Check   - FTS Check: fts4_metadata_titles - PASS
2026-07-20 08.56.53 - Check   - FTS Check: fts4_tag_titles - PASS
2026-07-20 08.56.53 - Check   - FTS Check: fts4_metadata_titles_icu - PASS
2026-07-20 08.56.53 - Check   - FTS Check: fts4_tag_titles_icu - PASS
2026-07-20 08.57.13 - Repair  - START
2026-07-20 08.57.13 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/dbtmp/com.plexapp.plugins.library-DBREPAIR-2026-07-20_08-57-13-129.db
2026-07-20 08.57.13 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/dbtmp/com.plexapp.plugins.library-DBREPAIR-2026-07-20_08-57-13-129.db
2026-07-20 08.57.13 - FTSRebuild - Rebuilt fts4_metadata_titles
2026-07-20 08.57.13 - FTSRebuild - Rebuilt fts4_tag_titles
2026-07-20 08.57.13 - FTSRebuild - Rebuilt fts4_metadata_titles_icu
2026-07-20 08.57.14 - FTSRebuild - Rebuilt fts4_tag_titles_icu
2026-07-20 08.57.14 - Repair  - SUCCESS - Main DB Pipeline Complete
2026-07-20 08.57.14 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/dbtmp/com.plexapp.plugins.library.blobs-DBREPAIR-2026-07-20_08-57-13-129.db
2026-07-20 08.57.14 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/dbtmp/com.plexapp.plugins.library.blobs-DBREPAIR-2026-07-20_08-57-13-129.db
2026-07-20 08.57.14 - FTSRebuild - Rebuilt fts4_metadata_titles
2026-07-20 08.57.14 - FTSRebuild - Rebuilt fts4_tag_titles
2026-07-20 08.57.14 - FTSRebuild - Rebuilt fts4_metadata_titles_icu
2026-07-20 08.57.14 - FTSRebuild - Rebuilt fts4_tag_titles_icu
2026-07-20 08.57.14 - Repair  - SUCCESS - Blobs DB Pipeline Complete
2026-07-20 08.57.14 - Repair  - PUSH - Saved state to stack (Timestamp: 2026-07-20_08-57-13-129)
2026-07-20 08.57.14 - Repair  - MakeActive - Main DB updated to live (Timestamp: 2026-07-20_08-57-13-129)
2026-07-20 08.57.14 - Repair  - MakeActive - Blobs DB updated to live (Timestamp: 2026-07-20_08-57-13-129)
2026-07-20 08.57.14 - Repair  - Databases active: (Active Timestamp: 2026-07-20_08-57-13-129)
2026-07-20 08.57.25 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
2026-07-20 08.57.26 - CheckDB - Checking Indexes and FTS tables - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
2026-07-20 08.57.26 - CheckDB - Full check complete - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
2026-07-20 08.57.26 - Check   - Check Main DB - PASS
2026-07-20 08.57.26 - CheckDB - Checking basic integrity - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db
2026-07-20 08.57.26 - CheckDB - Checking Indexes and FTS tables - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db
2026-07-20 08.57.26 - CheckDB - Full check complete - /Users/stephenh/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db
2026-07-20 08.57.26 - Check   - Check Blobs DB - PASS
2026-07-20 08.57.26 - Check   - PASS
2026-07-20 08.57.26 - Check   - CheckFTS Main DB - START
2026-07-20 08.57.26 - Check   - FTS Check: spellfix_metadata_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: spellfix_tag_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_metadata_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_tag_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_metadata_titles_icu - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_tag_titles_icu - PASS
2026-07-20 08.57.26 - Check   - CheckFTS Blobs DB - START
2026-07-20 08.57.26 - Check   - FTS Check: spellfix_metadata_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: spellfix_tag_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_metadata_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_tag_titles - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_metadata_titles_icu - PASS
2026-07-20 08.57.26 - Check   - FTS Check: fts4_tag_titles_icu - PASS
2026-07-20 08.57.39 - RunSysCmd executing: 'TMPDIR=/tmp osascript -e 'tell app "Plex Media Server" to launch''
2026-07-20 08.57.39 - RunSysCmd: Command exited with status 0
2026-07-20 08.57.39 - Start - PASS

May have spoken too soon @ChuckPA, still seeing this with subsequent runs of v0.1999.03.

Seems it can’t fix this error?

[2026-07-20 09.14.02] Database is damaged: malformed inverted index for FTS4 table main.fts4_metadata_titles_icu

Full log from 2 runs of “repair” …

Last login: Mon Jul 20 09:12:33 on ttys000
stephenh@MacStudio ~ % /Users/Shared/PlexDBRepair/DBRepair\ v0.1999.03/DBRepair stop repair start



            Database Repair Utility for Plex Media Server  (macOS 15.7.7 (Sequoia))
                       Version 0.1999.03 (Jul 19 2026)

[2026-07-20 09.13.37]  
[2026-07-20 09.13.37] Stopping PMS. (60 second max delay)
[2026-07-20 09.13.43] Stopped PMS.
[2026-07-20 09.13.43]  
[2026-07-20 09.13.43] --- Processing Main DB ---
[2026-07-20 09.13.43] Performing initial integrity check on Main DB...
[2026-07-20 09.13.43] Database is damaged: malformed inverted index for FTS4 table main.fts4_metadata_titles_icu
[2026-07-20 09.13.44] Rebuilding and Verifying Main DB structure...
[2026-07-20 09.13.44] Rebuilding indexes from source schema...
[2026-07-20 09.13.44] Rebuilding FTS Virtual Tables for Main...

[2026-07-20 09.13.44] --- Processing Blobs DB ---
[2026-07-20 09.13.44] Performing initial integrity check on Blobs DB...
[2026-07-20 09.13.45] Rebuilding and Verifying Blobs DB structure...
[2026-07-20 09.13.45] Rebuilding indexes from source schema...
[2026-07-20 09.13.45] Rebuilding FTS Virtual Tables for Blobs...

[2026-07-20 09.13.45] Making DB(s) active
[2026-07-20 09.13.45] Swap complete. Live databases updated.
[2026-07-20 09.13.45]  
[2026-07-20 09.13.45] Starting PMS.
[2026-07-20 09.13.45] Started PMS.
[2026-07-20 09.13.45]  
[2026-07-20 09.13.45] Deleting temporary work files.
stephenh@MacStudio ~ % /Users/Shared/PlexDBRepair/DBRepair\ v0.1999.03/DBRepair stop repair start



            Database Repair Utility for Plex Media Server  (macOS 15.7.7 (Sequoia))
                       Version 0.1999.03 (Jul 19 2026)

[2026-07-20 09.13.55]  
[2026-07-20 09.13.55] Stopping PMS. (60 second max delay)
[2026-07-20 09.14.01] Stopped PMS.
[2026-07-20 09.14.01]  
[2026-07-20 09.14.01] --- Processing Main DB ---
[2026-07-20 09.14.01] Performing initial integrity check on Main DB...
[2026-07-20 09.14.02] Database is damaged: malformed inverted index for FTS4 table main.fts4_metadata_titles_icu
[2026-07-20 09.14.02] Rebuilding and Verifying Main DB structure...
[2026-07-20 09.14.02] Rebuilding indexes from source schema...
[2026-07-20 09.14.02] Rebuilding FTS Virtual Tables for Main...

[2026-07-20 09.14.03] --- Processing Blobs DB ---
[2026-07-20 09.14.03] Performing initial integrity check on Blobs DB...
[2026-07-20 09.14.03] Rebuilding and Verifying Blobs DB structure...
[2026-07-20 09.14.03] Rebuilding indexes from source schema...
[2026-07-20 09.14.03] Rebuilding FTS Virtual Tables for Blobs...

[2026-07-20 09.14.03] Making DB(s) active
[2026-07-20 09.14.03] Swap complete. Live databases updated.
[2026-07-20 09.14.03]  
[2026-07-20 09.14.03] Starting PMS.
[2026-07-20 09.14.03] Started PMS.
[2026-07-20 09.14.03]  
[2026-07-20 09.14.03] Deleting temporary work files.
stephenh@MacStudio ~ % 

@StephenH

Didn’t it make 2 passes and fix it both times?

Which PMS version?

PMS Version 1.43.3.10828

Shouldn’t it “fix” it the first time and show no errors the next time?

Or am I missing something as usual?

:smiley:

Yes. it should not show any errors.

Here’s the kicker.

I ran against your database and didn’t get any FTS errors on the 2nd or 3rd attempts

Any scan of a PMS library in between scans will invalidate the FTS4 tables.

@pshanew

which scan of which please ? :slight_smile:

PMS was “stopped” between those two “repairs”, they were only seconds apart, so I don’t see how it could be that …

Edit: actually that’s not true I just realised … as I did a:

"DBRepair stop repair start"
twice in a row, so PMS did briefly run between my two repairs ...

Please ignore that. I was mis-remembering something else.

@StephenH, Can you please also send me your blobs DB ?

Will do …

But I just did another run manually, and error “disapeared” on 2nd run of “repair”.


But if I then do that sequence again, error comes back …

Last login: Mon Jul 20 09:36:19 on ttys000
/Users/Shared/PlexDBRepair/DBRepair\ v0.1999.03/DBRepair ; exit;                                                                                                
stephenh@MacStudio ~ % /Users/Shared/PlexDBRepair/DBRepair\ v0.1999.03/DBRepair ; exit;



            Database Repair Utility for Plex Media Server  (macOS 15.7.7 (Sequoia))
                       Version 0.1999.03 (Jul 19 2026)


Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : stop
 
Stopping PMS. (60 second max delay)
Stopped PMS.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : repair
 
--- Processing Main DB ---
Performing initial integrity check on Main DB...
Database is damaged: malformed inverted index for FTS4 table main.fts4_metadata_titles_icu
Rebuilding and Verifying Main DB structure...
Rebuilding indexes from source schema...
Rebuilding FTS Virtual Tables for Main...

--- Processing Blobs DB ---
Performing initial integrity check on Blobs DB...
Rebuilding and Verifying Blobs DB structure...
Rebuilding indexes from source schema...
Rebuilding FTS Virtual Tables for Blobs...

Making DB(s) active
Swap complete. Live databases updated.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : repair
 
--- Processing Main DB ---
Rebuilding and Verifying Main DB structure...
Rebuilding indexes from source schema...
Rebuilding FTS Virtual Tables for Main...

--- Processing Blobs DB ---
Rebuilding and Verifying Blobs DB structure...
Rebuilding indexes from source schema...
Rebuilding FTS Virtual Tables for Blobs...

Making DB(s) active
Swap complete. Live databases updated.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : start
 
Starting PMS.
Started PMS.

Select

  1 - 'stop'      - Stop PMS.
  3 - 'check'     - Perform integrity check of database and FTS indexes.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database indexes.
  7 - 'start'     - Start PMS

 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'history'   - Show command history of this session.
 13 - 'revert'    - Revert DBs to immediately before history index.

 21 - 'prune'     - Remove old image files from PhotoTranscoder cache & all temp files left by PMS.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 98 - 'quit'      - Quit immediately.  Keep all temporary files.
 99 - 'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : exit
 
Remove temporary databases/workfiles? (y/N): y
Deleting temporary work files.

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]


So is the “repair” not being written back to the DB maybe?

A few hours ago, I installed DBRepair 0.1999.02 on Unraid 7.3.2 (incidentally, just adjacent to DBRepair-1.16.00). Before using DBRepair, I worked out how to gracefully stop and start Plex Media Server using ./plex_service.sh.

I took DBRepair 0.1999.02 for a “bit of a spin”, running the ‘repair’ function twice. The first time trying ‘repair’ seemed to work okay, but the second time it reported errors. Not sure if I or DBRepair 0.1999.02 did something that damaged the database, but Plex Media Server then unable to complete the startup sequence… lots of unfamiliar events being added to the Plex Media Server log.

Late at night and tired (not ideal for testing and troubleshooting), I restored a backup database (a straightforward task) and successfully started Plex Media Server. The backup database restored fine. DBRepair-1.16.00 reports no problems with the restored database.

I think I discarded the damaged database (and Plex Media Sever logs). I don’t know why… it was late. I was tired. Anyways… all working okay.

I see DBRepair 0.1999.02 is now offered for testing. I’m looking forward to checking out DBRepair (the binary edition) when I have time.

DBRepair-1.16.00 is still working nicely and remains a highly valued tool in my home entertainment setup!

@SamVen

Thanks for trying it. There is already v0.1999.03

I do need to add more control (start/stop) for when running inside containers.

Which image are you using ?

@ChuckPa I now remember what I forgot. It wasn’t a library scan, it was a library metadata refresh.

From a clean database (after a repair), if you refresh all metadata for a library, it will cause at least some of the FTS4 tables to show as malformed. Some of us had a discussion about this previously; I thought it was in this thread, but I couldn’t find it.

I’ve confirmed that the behavior persists. I don’t believe it’s related to your utility however. It’s just related to the way PMS updates the FTS4 tables (or doesn’t, in this case). It’s not immediate. So they can seem out-of-sync with their source tables.

To reproduce, you should only need to:

  • Stop PMS.
  • Run DBrepair and check and repair.
  • Start PMS.
  • Refresh all metadata on a library. It may be possible to do this will a smaller set (just some items), but I’ve not tested that.
  • Run DBrepair and start PMS.
  • Run a check.

In my testing, this shows at least one FTS4 table as being damaged again.