upgrade: Add management command to fix FTS indexes.

Upgrading the base OS's dictionary files can corrupt our FTS
indexes. We add a command for fixing them.

Fixes #14982.
This commit is contained in:
Mateusz Mandera
2020-07-05 14:57:52 +02:00
committed by Tim Abbott
parent 23fe58f5be
commit c231d88d9f
3 changed files with 33 additions and 5 deletions

View File

@@ -81,6 +81,8 @@ parser.add_argument("--ignore-static-assets", dest="ignore_static_assets", actio
help="Do not attempt to copy/manage static assets.")
parser.add_argument("--skip-purge-old-deployments", dest="skip_purge_old_deployments",
action="store_true", help="Skip purging old deployments.")
parser.add_argument("--audit-fts-indexes", dest="audit_fts_indexes",
action="store_true", help="Audit and fix full text search indexes.")
args = parser.parse_args()
deploy_path = args.deploy_path
@@ -268,6 +270,11 @@ logging.info("Restarting Zulip...")
subprocess.check_output(["./scripts/restart-server", "--fill-cache"], preexec_fn=su_to_zulip)
logging.info("Upgrade complete!")
if args.audit_fts_indexes:
logging.info("Correcting full-text search indexes for updated dictionary files")
logging.info("This may take a while but the server should work while it runs.")
subprocess.check_call(["./manage.py", "audit_fts_indexes"], preexec_fn=su_to_zulip)
if not args.skip_purge_old_deployments:
logging.info("Purging old deployments...")
subprocess.check_call(["./scripts/purge-old-deployments"])