diff options
author | mkanat%bugzilla.org <> | 2008-12-24 04:43:36 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-12-24 04:43:36 +0100 |
commit | 8a3d4469cc85108a194a78ac95f2a6780d2971eb (patch) | |
tree | c89a2d8abb28b792bcdcf04ea76291842dd91d59 /Bugzilla/DB | |
parent | 570ca770d29d7800f79d6789c2b1142e383a348a (diff) | |
download | bugzilla-8a3d4469cc85108a194a78ac95f2a6780d2971eb.tar.gz bugzilla-8a3d4469cc85108a194a78ac95f2a6780d2971eb.tar.xz |
Bug 284184: Allow Bugzilla to use an asynchronous job queue for sending mail.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> and Mark Smith <mark@plogs.net> r=glob, a=mkanat
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 5 | ||||
-rw-r--r-- | Bugzilla/DB/Oracle.pm | 4 | ||||
-rw-r--r-- | Bugzilla/DB/Pg.pm | 4 | ||||
-rw-r--r-- | Bugzilla/DB/Schema.pm | 87 |
4 files changed, 97 insertions, 3 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 889b1f0da..f85bd31f1 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -63,7 +63,7 @@ sub new { my ($class, $user, $pass, $host, $dbname, $port, $sock) = @_; # construct the DSN from the parameters we got - my $dsn = "DBI:mysql:host=$host;database=$dbname"; + my $dsn = "dbi:mysql:host=$host;database=$dbname"; $dsn .= ";port=$port" if $port; $dsn .= ";mysql_socket=$sock" if $sock; @@ -79,6 +79,9 @@ sub new { # a prefix 'private_'. See DBI documentation. $self->{private_bz_tables_locked} = ""; + # Needed by TheSchwartz + $self->{private_bz_dsn} = $dsn; + bless ($self, $class); # Bug 321645 - disable MySQL strict mode, if set diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 833fce635..4153751fd 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -65,13 +65,15 @@ sub new { $ENV{'NLS_LANG'} = '.AL32UTF8' if Bugzilla->params->{'utf8'}; # construct the DSN from the parameters we got - my $dsn = "DBI:Oracle:host=$host;sid=$dbname"; + my $dsn = "dbi:Oracle:host=$host;sid=$dbname"; $dsn .= ";port=$port" if $port; my $attrs = { FetchHashKeyName => 'NAME_lc', LongReadLen => ( Bugzilla->params->{'maxattachmentsize'} || 1000 ) * 1024, }; my $self = $class->db_new($dsn, $user, $pass, $attrs); + # Needed by TheSchwartz + $self->{private_bz_dsn} = $dsn; bless ($self, $class); diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index 66ad4b1ec..18f9abf88 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -60,7 +60,7 @@ sub new { $dbname ||= 'template1'; # construct the DSN from the parameters we got - my $dsn = "DBI:Pg:dbname=$dbname"; + my $dsn = "dbi:Pg:dbname=$dbname"; $dsn .= ";host=$host" if $host; $dsn .= ";port=$port" if $port; @@ -75,6 +75,8 @@ sub new { # all class local variables stored in DBI derived class needs to have # a prefix 'private_'. See DBI documentation. $self->{private_bz_tables_locked} = ""; + # Needed by TheSchwartz + $self->{private_bz_dsn} = $dsn; bless ($self, $class); diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index ed1245d98..f11c86e75 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1388,6 +1388,93 @@ use constant ABSTRACT_SCHEMA => { ], }, + # THESCHWARTZ TABLES + # ------------------ + # Note: In the standard TheSchwartz schema, most integers are unsigned, + # but we didn't implement unsigned ints for Bugzilla schemas, so we + # just create signed ints, which should be fine. + + ts_funcmap => { + FIELDS => [ + funcid => {TYPE => 'INTSERIAL', PRIMARYKEY => 1, NOTNULL => 1}, + funcname => {TYPE => 'varchar(255)', NOTNULL => 1}, + ], + INDEXES => [ + ts_funcmap_funcname_idx => {FIELDS => ['funcname'], + TYPE => 'UNIQUE'}, + ], + }, + + ts_job => { + FIELDS => [ + # In a standard TheSchwartz schema, this is a BIGINT, but we + # don't have those and I didn't want to add them just for this. + jobid => {TYPE => 'INTSERIAL', PRIMARYKEY => 1, + NOTNULL => 1}, + funcid => {TYPE => 'INT4', NOTNULL => 1}, + # In standard TheSchwartz, this is a MEDIUMBLOB. + arg => {TYPE => 'LONGBLOB'}, + uniqkey => {TYPE => 'varchar(255)'}, + insert_time => {TYPE => 'INT4'}, + run_after => {TYPE => 'INT4', NOTNULL => 1}, + grabbed_until => {TYPE => 'INT4', NOTNULL => 1}, + priority => {TYPE => 'INT2'}, + coalesce => {TYPE => 'varchar(255)'}, + ], + INDEXES => [ + ts_job_funcid_idx => {FIELDS => [qw(funcid uniqkey)], + TYPE => 'UNIQUE'}, + # In a standard TheSchewartz schema, these both go in the other + # direction, but there's no reason to have three indexes that + # all start with the same column, and our naming scheme doesn't + # allow it anyhow. + ts_job_run_after_idx => [qw(run_after funcid)], + ts_job_coalesce_idx => [qw(coalesce funcid)], + ], + }, + + ts_note => { + FIELDS => [ + # This is a BIGINT in standard TheSchwartz schemas. + jobid => {TYPE => 'INT4', NOTNULL => 1}, + notekey => {TYPE => 'varchar(255)'}, + value => {TYPE => 'LONGBLOB'}, + ], + INDEXES => [ + ts_note_jobid_idx => {FIELDS => [qw(jobid notekey)], + TYPE => 'UNIQUE'}, + ], + }, + + ts_error => { + FIELDS => [ + error_time => {TYPE => 'INT4', NOTNULL => 1}, + jobid => {TYPE => 'INT4', NOTNULL => 1}, + message => {TYPE => 'varchar(255)', NOTNULL => 1}, + funcid => {TYPE => 'INT4', NOTNULL => 1, DEFAULT => 0}, + ], + INDEXES => [ + ts_error_funcid_idx => [qw(funcid error_time)], + ts_error_error_time_idx => ['error_time'], + ts_error_jobid_idx => ['jobid'], + ], + }, + + ts_exitstatus => { + FIELDS => [ + jobid => {TYPE => 'INTSERIAL', PRIMARYKEY => 1, + NOTNULL => 1}, + funcid => {TYPE => 'INT4', NOTNULL => 1, DEFAULT => 0}, + status => {TYPE => 'INT2'}, + completion_time => {TYPE => 'INT4'}, + delete_after => {TYPE => 'INT4'}, + ], + INDEXES => [ + ts_exitstatus_funcid_idx => ['funcid'], + ts_exitstatus_delete_after_idx => ['delete_after'], + ], + }, + # SCHEMA STORAGE # -------------- |