Merge lp:~stub/launchpad/pending-db-changes into lp:launchpad/db-devel
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 9445 | ||||
| Proposed branch: | lp:~stub/launchpad/pending-db-changes | ||||
| Merge into: | lp:launchpad/db-devel | ||||
| Diff against target: |
127 lines (+35/-17) 4 files modified
database/replication/helpers.py (+10/-4) database/schema/fti.py (+10/-13) database/schema/patch-2207-62-0.sql (+14/-0) database/schema/security.cfg (+1/-0) |
||||
| To merge this branch: | bzr merge lp:~stub/launchpad/pending-db-changes | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Nelson (community) | code | 2010-06-10 | Approve on 2010-06-10 |
|
Review via email:
|
|||
Commit Message
SourcePackageRe
Description of the Change
Collection of minor DB tweaks.
We have stopped replicating the OAuthNonce table, and tweaks to our replication maintenance scripts to stop it being added back.
fti.py was spitting a deprecation warning under Python 2.6 - fix that.
The Bug #49717 DB patch I though had been landed had not been landed. Extend this with a tweak for the OAuthNonce table, so things still cope now it is no longer replicated.
A DB permission for our nagios checks.
| Stuart Bishop (stub) wrote : | # |
On Thu, Jun 10, 2010 at 8:53 PM, Michael Nelson
<email address hidden> wrote:
>> === modified file 'database/
>> --- database/
>> +++ database/
>> @@ -420,7 +424,8 @@
>> """ % sqlvalues(
>> for namespace, tablename in cur.fetchall():
>> key = (namespace, tablename)
>> - if key not in tables and key not in pending_tables:
>> + if (key not in tables and key not in pending_tables
>> + and '%s.%s' % (namespace, tablename) not in IGNORED_TABLES):
>> pending_
>
> Just out of interest, this kind of change (or these helpers) *could* be tested couldn't they?
Bits could. I tend to consider staging the test environment for most
of this though, and haven't worried about the few bits that are
testable. Its all a bit ugly, but now we know it is all working I
guess we can start cleaning things up.
>> # Generate the set of sequences that are linked to any of our set of
>> @@ -441,8 +446,9 @@
>> ) AS whatever
>> WHERE seq IS NOT NULL;
>> """ % sqlvalues(
>> - for row in cur.fetchall():
>> - sequences.
>> + for sequence, in cur.fetchall():
>
> Nice, but would it be clearer to do:
>
> for sequence, whateverelse in cur.fetchall():
>
> using something appropriate?
That would give an index exception, as there is only a single column
being returned.
>> + p = subprocess.Popen(
>> + cmd.split(' '), stdin=subproces
>> + stdout=
>> + out, err = p.communicate(
>> + "SET client_
>> + + open(tsearch2_
>> + if p.returncode != 0:
>> log.fatal('Error executing %s:', cmd)
>> - log.debug(
>> + log.debug(out)
>
> Is err not useful here?
No. It is None because I specified stderr=
stdout and stderr together.
> I think you added a missing index to BuildFarmJob.status last Friday too. Although it may not have helped the direct issue there, I think it should still be included. Do you?
That has already landed as patch-2207-
patch as it has already been applied to production.
--
Stuart Bishop <email address hidden>
http://

Hi Stuart,
Just a few notes below. The main one I'm interested in is whether we should include the BuildFarmJob.status index in the db patch.
Thanks!
> === modified file 'database/ replication/ helpers. py' replication/ helpers. py 2010-04-29 12:38:05 +0000 replication/ helpers. py 2010-06-10 13:40:07 +0000 namespace, tablename)) tables. add(key)
> --- database/
> +++ database/
> @@ -420,7 +424,8 @@
> """ % sqlvalues(
> for namespace, tablename in cur.fetchall():
> key = (namespace, tablename)
> - if key not in tables and key not in pending_tables:
> + if (key not in tables and key not in pending_tables
> + and '%s.%s' % (namespace, tablename) not in IGNORED_TABLES):
> pending_
Just out of interest, this kind of change (or these helpers) *could* be tested couldn't they?
> fqn(namespace, tablename), namespace, tablename)) add(row[ 0])
> # Generate the set of sequences that are linked to any of our set of
> @@ -441,8 +446,9 @@
> ) AS whatever
> WHERE seq IS NOT NULL;
> """ % sqlvalues(
> - for row in cur.fetchall():
> - sequences.
> + for sequence, in cur.fetchall():
Nice, but would it be clearer to do:
for sequence, whateverelse in cur.fetchall():
using something appropriate?
? add(sequence) schema/ fti.py' schema/ fti.py 2010-05-19 18:07:56 +0000 schema/ fti.py 2010-06-10 13:40:07 +0000 min_messages= ERROR;" sql_path) .read() .replace( s.PIPE, subprocess. PIPE, stderr= subprocess. STDOUT) min_messages= ERROR; CREATE SCHEMA ts2;" sql_path) .read() .replace( 'public; ','ts2, public;')) p.fromchild. read())
> + if sequence not in IGNORED_SEQUENCES:
> + sequences.
>
> # We can't easily convert the sequence name to (namespace, name) tuples,
> # so we might as well convert the tables to dot notation for consistancy.
>
> === modified file 'database/
> --- database/
> +++ database/
> @@ -319,18 +319,15 @@
> cmd += ' -h %s' % lp.dbhost
> if options.dbuser:
> cmd += ' -U %s' % options.dbuser
> - p = popen2.Popen4(cmd)
> - c = p.tochild
> - print >> c, "SET client_
> - print >> c, "CREATE SCHEMA ts2;"
> - print >> c, open(tsearch2_
> - 'public;','ts2, public;'
> - )
> - p.tochild.close()
> - rv = p.wait()
> - if rv != 0:
> + p = subprocess.Popen(
> + cmd.split(' '), stdin=subproces
> + stdout=
> + out, err = p.communicate(
> + "SET client_
> + + open(tsearch2_
> + if p.returncode != 0:
> log.fatal('Error executing %s:', cmd)
> - log.debug(
> + log.debug(out)
Is err not useful here?
> sys.exit(rv) schema/ patch-2207- 62-0.sql' schema/ patch-2207- 62-0.sql 1970-01-01 00:00:00 +0000 schema/ patch-2207- 62-0.sql 2010-06-10 13:40:07 +0000 min_messages= ERROR; le...
>
> # Create ftq helper and its sibling _ftq.
>
> === added file 'database/
> --- database/
> +++ database/
> @@ -0,0 +1,14 @@
> +SET client_
> +
> +-- Bug #49717
> +ALTER TABLE SourcePackageRe