From 39cc830ae57d98988db826fc5b5c0f5ebed8d564 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 3 Apr 2025 14:31:49 +0000 Subject: [PATCH] upgrade: Remove tsearch_extras cleanup code. This code was originally added in 382261dc729a in Zulip Server 3.0; since we can only directly upgrade from 5.0 or later, this code is guaranteed to have run already. Remove it. --- scripts/lib/upgrade-zulip-stage-3 | 10 ---------- scripts/lib/zulip_tools.py | 9 --------- 2 files changed, 19 deletions(-) diff --git a/scripts/lib/upgrade-zulip-stage-3 b/scripts/lib/upgrade-zulip-stage-3 index c50751607c..095bd48383 100755 --- a/scripts/lib/upgrade-zulip-stage-3 +++ b/scripts/lib/upgrade-zulip-stage-3 @@ -5,7 +5,6 @@ # always run from the new version of Zulip, so any bug fixes take # effect on the very next upgrade. import argparse -import glob import hashlib import logging import os @@ -29,7 +28,6 @@ from scripts.lib.zulip_tools import ( get_config, get_config_file, parse_version_from, - run_psql_as_postgres, start_arg_parser, su_to_zulip, ) @@ -149,14 +147,6 @@ def shutdown_server(fill_caches: bool = True) -> None: IS_SERVER_UP = False -if glob.glob("/usr/share/postgresql/*/extension/tsearch_extras.control"): - # Remove legacy tsearch_extras package references - run_psql_as_postgres( - config_file=config_file, - sql_query="DROP EXTENSION IF EXISTS tsearch_extras;", - ) - subprocess.check_call(["apt-get", "remove", "-y", "postgresql-*-tsearch-extras"]) - if not (args.skip_restart or args.skip_puppet): # We need to temporarily hold pgroonga, if installed -- upgrading # it without running the appropriate upgrade SQL can cause diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py index 28c5d8ce7b..292eaa4c2e 100755 --- a/scripts/lib/zulip_tools.py +++ b/scripts/lib/zulip_tools.py @@ -626,15 +626,6 @@ def get_deploy_options(config_file: configparser.RawConfigParser) -> list[str]: return shlex.split(get_config(config_file, "deployment", "deploy_options", "")) -def run_psql_as_postgres( - config_file: configparser.RawConfigParser, - sql_query: str, -) -> None: - dbname = get_config(config_file, "postgresql", "database_name", "zulip") - subcmd = shlex.join(["psql", "-v", "ON_ERROR_STOP=1", "-d", dbname, "-c", sql_query]) - subprocess.check_call(["su", "postgres", "-c", subcmd]) - - def get_tornado_ports(config_file: configparser.RawConfigParser) -> list[int]: ports = [] if config_file.has_section("tornado_sharding"):