Merge lp:~wgrant/launchpad/no-tsearch2-residue into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18663
Proposed branch: lp:~wgrant/launchpad/no-tsearch2-residue
Merge into: lp:launchpad
Prerequisite: lp:~wgrant/launchpad/no-tsearch2
Diff against target: 126 lines (+4/-54)
5 files modified
database/replication/Makefile (+1/-1)
database/schema/Makefile (+2/-16)
lib/lp/services/database/doc/textsearching.txt (+1/-27)
test_on_merge.py (+0/-8)
utilities/launchpad-database-setup (+0/-2)
To merge this branch: bzr merge lp:~wgrant/launchpad/no-tsearch2-residue
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+345521@code.launchpad.net

Commit message

Drop search_path and ts2 reside. All our stuff is now in public.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/replication/Makefile'
2--- database/replication/Makefile 2017-11-16 03:18:49 +0000
3+++ database/replication/Makefile 2018-05-14 13:14:29 +0000
4@@ -59,7 +59,7 @@
5 # XXX wgrant 2017-11-16: Exclude tsearch2 bits that are
6 # erreonously being dumped now.
7 pg_restore --list ${STAGING_DUMP} | grep -v 'TRIGGER public _sl_' \
8- | grep -v 'OPERATOR FAMILY ts2' > ${DUMPLIST}
9+ > ${DUMPLIST}
10
11 # Deny new connections to the main DBs and kill any leftovers.
12 ${STAGING_PGBOUNCER} -c 'DISABLE launchpad_staging'
13
14=== modified file 'database/schema/Makefile'
15--- database/schema/Makefile 2012-11-21 17:43:58 +0000
16+++ database/schema/Makefile 2018-05-14 13:14:29 +0000
17@@ -135,23 +135,9 @@
18
19 # Confirm that launchpad-XX-00-0.sql hasn't been messed with - this file
20 # is our baseline telling us what was installed into production
21-check: search_path
22+check:
23 @if [ "`md5sum ${BASELINE}`" != "${MD5SUM}" ]; then echo "* ${BASELINE} is corrupt or has been modified"; exit 1; else echo "* Using ${BASELINE} as baseline"; fi
24
25-search_path:
26- @psql -d template1 -q -A -t -c 'show search_path'
27- @if [ `psql -d template1 -q -A -t -c 'show search_path'` != '$$user,public,ts2' ] && [ `psql -d template1 -q -A -t -c 'show search_path'` != '"$$user",public,ts2' ]; then \
28- echo "* It appears your search path is unconfigured."; \
29- echo " Have you read <https://launchpad.canonical.com/DatabaseSetup>?"; \
30- echo; \
31- echo "* Add the following to /etc/postgresql/X.X/main/postgresql.conf"; \
32- echo " (where X.X is the version of the PostgreSQL DB you're connecting to):"; \
33- echo " search_path='\$$user,public,ts2'"; \
34- echo "* Then reload PostgreSQL:"; \
35- echo " sudo /etc/init.d/postgresql reload"; \
36- exit 1; \
37- fi
38-
39
40 all: dev test
41 @ echo "* All done"
42@@ -172,5 +158,5 @@
43 $(call build_new_sampledata,${TEMPLATE_WITH_TEST_SAMPLEDATA},${LINTDATA})
44 $(call build_new_sampledata,${TEMPLATE_WITH_DEV_SAMPLEDATA},${LINTDATA_DEV})
45
46-.PHONY: default test dev create check search_path all doc diagram newsampledata_test newsampledata_dev newsampledata lintdata
47+.PHONY: default test dev create check all doc diagram newsampledata_test newsampledata_dev newsampledata lintdata
48
49
50=== modified file 'lib/lp/services/database/doc/textsearching.txt'
51--- lib/lp/services/database/doc/textsearching.txt 2018-05-14 09:25:45 +0000
52+++ lib/lp/services/database/doc/textsearching.txt 2018-05-14 13:14:29 +0000
53@@ -3,8 +3,7 @@
54
55 Introduction
56 ------------
57-We are currently using tsearch2 to provide full text searching
58-capabilities inside the PostgreSQL database.
59+We are currently using PostgreSQL's built-in full text search capabilities.
60
61 Although in a lot of cases simple substring searches using LIKE would be
62 fine or even preferred, the disadvantage of using LIKE is that PostgreSQL
63@@ -12,31 +11,6 @@
64 when we need to search tens of thousands of entries (packages) or hundreds
65 of thousands of entries (people) or millions of entries (translations).
66
67-Installation
68-------------
69-tsearch2 is part of the `postgresql-contrib` package. This is installed
70-into the launchpad database using the script `database/schema/fti.py`,
71-which is run automatically during database creation.
72-
73-This script does the following:
74-
75- * Hooks `tsearch2` into the launchpad database, installing it into
76- the ts2 schema.
77-
78- * Creates all the full text indexes. These are in the form of a new
79- column called `fti` on a number of tables. Which tables and
80- which columns are indexed is defined inside the fti.py script.
81-
82- * Creates the `ftq(text)` stored procedure. This procedure makes
83- queries against the indexes simpler and consistant throughout
84- our applications.
85-
86-It is the Database Administrator's responsibility to rerun `fti.py` as
87-part of the production rollouts if this script has been modified. It does
88-not need to be rerun if the script has not changed. Rebuilding the indexes
89-currently takes several minutes on production, during which time the
90-production database is unavailable.
91-
92 Querying
93 --------
94
95
96=== modified file 'test_on_merge.py'
97--- test_on_merge.py 2014-01-15 10:46:59 +0000
98+++ test_on_merge.py 2018-05-14 13:14:29 +0000
99@@ -120,14 +120,6 @@
100 # bedrock is crumbling.
101 con = psycopg2.connect('dbname=launchpad_ftest_template')
102 cur = con.cursor()
103- cur.execute('show search_path')
104- search_path = cur.fetchone()[0]
105- if search_path != '$user,public,ts2':
106- print 'Search path incorrect.'
107- print 'Add the following line to /etc/postgresql/postgresql.conf:'
108- print " search_path = '$user,public,ts2'"
109- print "and tell postgresql to reload its configuration file."
110- return 1
111 cur.execute("""
112 select pg_encoding_to_char(encoding) as encoding from pg_database
113 where datname='launchpad_ftest_template'
114
115=== modified file 'utilities/launchpad-database-setup'
116--- utilities/launchpad-database-setup 2018-05-13 10:29:01 +0000
117+++ utilities/launchpad-database-setup 2018-05-14 13:14:29 +0000
118@@ -83,8 +83,6 @@
119 ##
120 ## Launchpad configuration
121 ##
122-# Enable launchpad full text searching in database
123-search_path='$user,public,ts2'
124 # Per Bug #90809, standard_conforming_strings should be 'on'
125 standard_conforming_strings=off
126 escape_string_warning=off