There were a couple of things that I did. Usually....I did not have to do a full blown rebuild of Plex. I would have backup databases that I could fall back on. And I also found the information on how to rebuild the database without losing all of my plex data.
I have a shell script that does the following: (must be done with the docker image stopped, and you have to go to the location of the Plex database files on the file system)
cp com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original
sqlite3 com.plexapp.plugins.library.db "DROP index 'index_title_sort_naturalsort'"
sqlite3 com.plexapp.plugins.library.db "DELETE from schema_migrations where version='20180501000000'"
sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check"
sqlite3 com.plexapp.plugins.library.db .dump > dump.sql
sqlite3 com.plexapp.plugins.library.db < dump.sql
chown nobody com.plexapp.plugins.library.db
chgrp users com.plexapp.plugins.library.db
Occasionally when you have a database that really has issues, you will end up with a dump.sql file that has issues then also. I found that when you pull the dump.sql file back into an empty database, you will see errors, and then the db will have a zero byte file size. Those error messages will point to line numbers in the dump.sql file. You can go in with a text editor and delete those lines. And the last line in the file may be set to rollback. You have to change that also. But then you can re-import the file, and it gets your db back at least to a point where the Plex server can take over and get things back to normal.
There is also a database tool built into Plex. Its under SETTINGS, TROUBLESHOOTING. There is a button that says "Optimize Database"
When I was having the corruption, I would run that shell script (If i didn't have a backup to fall back on), bring Plex back up. I would let it catch up with any new TV shows or Movies that it found on the disk that might not have been in the database. And then I would run that Optimize action. Once it was done....I would stop Plex, and make a "known good" backup of the database (copying it a the shell level) so I had a place to start again if it failed.
The script would also work on Sonarr (or Radarr). It just has to be tweaked to run for it's database instead of Plex. You can lose the first three lines that are specific to the Plex DB schema.
Since I have been back on 6.6.7, and have a clean database....I have had ZERO corruption: no matter how busy my Plex and Sonarr get.
I know it is a hard thing to troubleshoot, and they are working to find it...but it is something to do with the later versions of Unraid, or the utilities that it contains. 6.6.7 is rock solid, not matter what version of Plex and Sonarr I am running.