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
=== modified file 'database/replication/Makefile'
--- database/replication/Makefile 2017-11-16 03:18:49 +0000
+++ database/replication/Makefile 2018-05-14 13:14:29 +0000
@@ -59,7 +59,7 @@
59 # XXX wgrant 2017-11-16: Exclude tsearch2 bits that are59 # XXX wgrant 2017-11-16: Exclude tsearch2 bits that are
60 # erreonously being dumped now.60 # erreonously being dumped now.
61 pg_restore --list ${STAGING_DUMP} | grep -v 'TRIGGER public _sl_' \61 pg_restore --list ${STAGING_DUMP} | grep -v 'TRIGGER public _sl_' \
62 | grep -v 'OPERATOR FAMILY ts2' > ${DUMPLIST}62 > ${DUMPLIST}
6363
64 # Deny new connections to the main DBs and kill any leftovers.64 # Deny new connections to the main DBs and kill any leftovers.
65 ${STAGING_PGBOUNCER} -c 'DISABLE launchpad_staging'65 ${STAGING_PGBOUNCER} -c 'DISABLE launchpad_staging'
6666
=== modified file 'database/schema/Makefile'
--- database/schema/Makefile 2012-11-21 17:43:58 +0000
+++ database/schema/Makefile 2018-05-14 13:14:29 +0000
@@ -135,23 +135,9 @@
135135
136# Confirm that launchpad-XX-00-0.sql hasn't been messed with - this file136# Confirm that launchpad-XX-00-0.sql hasn't been messed with - this file
137# is our baseline telling us what was installed into production137# is our baseline telling us what was installed into production
138check: search_path138check:
139 @if [ "`md5sum ${BASELINE}`" != "${MD5SUM}" ]; then echo "* ${BASELINE} is corrupt or has been modified"; exit 1; else echo "* Using ${BASELINE} as baseline"; fi139 @if [ "`md5sum ${BASELINE}`" != "${MD5SUM}" ]; then echo "* ${BASELINE} is corrupt or has been modified"; exit 1; else echo "* Using ${BASELINE} as baseline"; fi
140140
141search_path:
142 @psql -d template1 -q -A -t -c 'show search_path'
143 @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 \
144 echo "* It appears your search path is unconfigured."; \
145 echo " Have you read <https://launchpad.canonical.com/DatabaseSetup>?"; \
146 echo; \
147 echo "* Add the following to /etc/postgresql/X.X/main/postgresql.conf"; \
148 echo " (where X.X is the version of the PostgreSQL DB you're connecting to):"; \
149 echo " search_path='\$$user,public,ts2'"; \
150 echo "* Then reload PostgreSQL:"; \
151 echo " sudo /etc/init.d/postgresql reload"; \
152 exit 1; \
153 fi
154
155141
156all: dev test142all: dev test
157 @ echo "* All done"143 @ echo "* All done"
@@ -172,5 +158,5 @@
172 $(call build_new_sampledata,${TEMPLATE_WITH_TEST_SAMPLEDATA},${LINTDATA})158 $(call build_new_sampledata,${TEMPLATE_WITH_TEST_SAMPLEDATA},${LINTDATA})
173 $(call build_new_sampledata,${TEMPLATE_WITH_DEV_SAMPLEDATA},${LINTDATA_DEV})159 $(call build_new_sampledata,${TEMPLATE_WITH_DEV_SAMPLEDATA},${LINTDATA_DEV})
174160
175.PHONY: default test dev create check search_path all doc diagram newsampledata_test newsampledata_dev newsampledata lintdata161.PHONY: default test dev create check all doc diagram newsampledata_test newsampledata_dev newsampledata lintdata
176162
177163
=== modified file 'lib/lp/services/database/doc/textsearching.txt'
--- lib/lp/services/database/doc/textsearching.txt 2018-05-14 09:25:45 +0000
+++ lib/lp/services/database/doc/textsearching.txt 2018-05-14 13:14:29 +0000
@@ -3,8 +3,7 @@
33
4Introduction4Introduction
5------------5------------
6We are currently using tsearch2 to provide full text searching6We are currently using PostgreSQL's built-in full text search capabilities.
7capabilities inside the PostgreSQL database.
87
9Although in a lot of cases simple substring searches using LIKE would be8Although in a lot of cases simple substring searches using LIKE would be
10fine or even preferred, the disadvantage of using LIKE is that PostgreSQL9fine or even preferred, the disadvantage of using LIKE is that PostgreSQL
@@ -12,31 +11,6 @@
12when we need to search tens of thousands of entries (packages) or hundreds11when we need to search tens of thousands of entries (packages) or hundreds
13of thousands of entries (people) or millions of entries (translations).12of thousands of entries (people) or millions of entries (translations).
1413
15Installation
16------------
17tsearch2 is part of the `postgresql-contrib` package. This is installed
18into the launchpad database using the script `database/schema/fti.py`,
19which is run automatically during database creation.
20
21This script does the following:
22
23 * Hooks `tsearch2` into the launchpad database, installing it into
24 the ts2 schema.
25
26 * Creates all the full text indexes. These are in the form of a new
27 column called `fti` on a number of tables. Which tables and
28 which columns are indexed is defined inside the fti.py script.
29
30 * Creates the `ftq(text)` stored procedure. This procedure makes
31 queries against the indexes simpler and consistant throughout
32 our applications.
33
34It is the Database Administrator's responsibility to rerun `fti.py` as
35part of the production rollouts if this script has been modified. It does
36not need to be rerun if the script has not changed. Rebuilding the indexes
37currently takes several minutes on production, during which time the
38production database is unavailable.
39
40Querying14Querying
41--------15--------
4216
4317
=== modified file 'test_on_merge.py'
--- test_on_merge.py 2014-01-15 10:46:59 +0000
+++ test_on_merge.py 2018-05-14 13:14:29 +0000
@@ -120,14 +120,6 @@
120 # bedrock is crumbling.120 # bedrock is crumbling.
121 con = psycopg2.connect('dbname=launchpad_ftest_template')121 con = psycopg2.connect('dbname=launchpad_ftest_template')
122 cur = con.cursor()122 cur = con.cursor()
123 cur.execute('show search_path')
124 search_path = cur.fetchone()[0]
125 if search_path != '$user,public,ts2':
126 print 'Search path incorrect.'
127 print 'Add the following line to /etc/postgresql/postgresql.conf:'
128 print " search_path = '$user,public,ts2'"
129 print "and tell postgresql to reload its configuration file."
130 return 1
131 cur.execute("""123 cur.execute("""
132 select pg_encoding_to_char(encoding) as encoding from pg_database124 select pg_encoding_to_char(encoding) as encoding from pg_database
133 where datname='launchpad_ftest_template'125 where datname='launchpad_ftest_template'
134126
=== modified file 'utilities/launchpad-database-setup'
--- utilities/launchpad-database-setup 2018-05-13 10:29:01 +0000
+++ utilities/launchpad-database-setup 2018-05-14 13:14:29 +0000
@@ -83,8 +83,6 @@
83##83##
84## Launchpad configuration84## Launchpad configuration
85##85##
86# Enable launchpad full text searching in database
87search_path='$user,public,ts2'
88# Per Bug #90809, standard_conforming_strings should be 'on'86# Per Bug #90809, standard_conforming_strings should be 'on'
89standard_conforming_strings=off87standard_conforming_strings=off
90escape_string_warning=off88escape_string_warning=off