The table post_search_data is damaged. I tried to repair it on different ways:
-
using rake search:reindex:
Output:root@xxx:/var/www/discourse# rake search:reindex
Reindexing ‘default’Posts:
rake aborted!
PG::InternalError: ERROR: missing chunk number 0 for toast value 69779 in pg_toast_16766
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:50:inexec' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:50:in
exec’
/var/www/discourse/lib/freedom_patches/active_record_base.rb:7:inexec_sql' /var/www/discourse/lib/tasks/search.rake:9:in
reindex_search’
/var/www/discourse/lib/tasks/search.rake:52:inblock in reindex_search_all_sites' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rails_multisite-1.0.6/lib/rails_multisite/connection_management.rb:126:in
block in each_connection’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rails_multisite-1.0.6/lib/rails_multisite/connection_management.rb:124:ineach' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rails_multisite-1.0.6/lib/rails_multisite/connection_management.rb:124:in
each_connection’
/var/www/discourse/lib/tasks/search.rake:51:inreindex_search_all_sites' /var/www/discourse/lib/tasks/search.rake:2:in
block in <top (required)>’
/usr/local/bin/bundle:23:inload' /usr/local/bin/bundle:23:in
’
Tasks: TOP => search:reindex
(See full trace by running task with --trace) -
Reindex in the Postgres database:
REINDEX table post_search_data;
ERROR: missing chunk number 0 for toast value 69852 in pg_toast_17881 -
Removing the table post_search_data, excluding it of the last working dump, restoring it in the discourse database and executing the reindex:
-> same like above
-
Trying to remove damaged entries with:
for ((i=0; i<13467; i++ )); do psql discourse -c “SELECT * FROM post_search_data LIMIT 1 offset $i” >/dev/null || echo $i; done
select post_id from post_search_data limit 1 offset 5971;
delete from post_search_data where post_id in (5981,6949,6944,6925,6918,6901,6900);
VACUUM FULL post_search_data;
At first the database is saying it would be removed. But they exist after a short time of waiting.
What can we do that we can get new backups of the complete database?