Rt3.0.7_01 rt_setup_database fails w/postgres

sbin/rt-setup-database from 3.0.7_01 dies when I try to initialize a
postgresql database. From what I can tell, it’s choking on the
transaction “BEGIN” at the top of Pg.schema, but I didn’t dig into
rt-setup-database enough to be sure.

rt-setup-database output (args{debug} on):

[root@gimli rt-3-0-7_01]# make initialize-database
/usr/bin/perl //home/abe/apache_perl/rt/sbin/rt-setup-database --action
init --dba root --prompt-for-dba-password --debug
In order to create a new database and grant RT access to that database,
this script needs to connect to your Pg instance on localhost as root.
Please specify that user’s database password below. If the user has no
database
password, just press return.

Password: Now creating a database for RT.
Creating Pg database rt3.
Now populating database schema.
Creating database schema.
SQL:

BEGIN
Died at //home/abe/apache_perl/rt/sbin/rt-setup-database line 161.
make: *** [initialize-database] Error 2

Importing the schema into postgres by hand seems to work:

[root@gimli etc]# psql template1 -U root -W < schema.Pg
Password:
BEGIN
CREATE SEQUENCE
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
'attachments_pkey
’ for table ‘attachments’
CREATE TABLE
CREATE INDEX
CREATE INDEX
[snip snip snip]
CREATE INDEX
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
‘sessions_pkey’ f
or table ‘sessions’
CREATE TABLE
COMMIT

My platform/environment:
Redhat 9
Postgresql 7.3.4 (postgresql-server-7.3.4-3.rhl9)
perl-DBI version 1.38, DBD::Pg version 1.31

–Abe

Removing the BEGIN; at the head of schema.Pg and the COMMIT; at the end
of schema.Pg, and then adding Pg-conditional
$dbh->begin_work/$dbh->commit statements to rt-setup-database let me
work around this issue:

    if ($RT::DatabaseType eq "Pg") {
            $dbh->begin_work;
    }
    foreach my $statement (@schema) {
        if ($statement =~ /^\s*;$/) { $is_local = 1; next; }
        print STDERR "SQL: $statement\n" if defined $args{'debug'};
        my $sth = $dbh->prepare($statement) or die $dbh->errstr;
        unless ( $sth->execute or $is_local ) {
            die "Problem with statement:\n $statement\n" .

$sth->errstr;
}
}
if ($RT::DatabaseType eq “Pg”) {
$dbh->commit;
}

–AbeOn Wed, 2003-11-26 at 15:36, Abraham Ingersoll wrote:

sbin/rt-setup-database from 3.0.7_01 dies when I try to initialize a
postgresql database. From what I can tell, it’s choking on the
transaction “BEGIN” at the top of Pg.schema, but I didn’t dig into
rt-setup-database enough to be sure.

rt-setup-database output (args{debug} on):

[root@gimli rt-3-0-7_01]# make initialize-database
/usr/bin/perl //home/abe/apache_perl/rt/sbin/rt-setup-database --action
init --dba root --prompt-for-dba-password --debug
In order to create a new database and grant RT access to that database,
this script needs to connect to your Pg instance on localhost as root.
Please specify that user’s database password below. If the user has no
database
password, just press return.

Password: Now creating a database for RT.
Creating Pg database rt3.
Now populating database schema.
Creating database schema.
SQL:

BEGIN
Died at //home/abe/apache_perl/rt/sbin/rt-setup-database line 161.
make: *** [initialize-database] Error 2

Importing the schema into postgres by hand seems to work:

[root@gimli etc]# psql template1 -U root -W < schema.Pg
Password:
BEGIN
CREATE SEQUENCE
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
'attachments_pkey
’ for table ‘attachments’
CREATE TABLE
CREATE INDEX
CREATE INDEX
[snip snip snip]
CREATE INDEX
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
‘sessions_pkey’ f
or table ‘sessions’
CREATE TABLE
COMMIT

My platform/environment:
Redhat 9
Postgresql 7.3.4 (postgresql-server-7.3.4-3.rhl9)
perl-DBI version 1.38, DBD::Pg version 1.31

–Abe


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

sbin/rt-setup-database from 3.0.7_01 dies when I try to initialize a
postgresql database. From what I can tell, it’s choking on the
transaction “BEGIN” at the top of Pg.schema, but I didn’t dig into
rt-setup-database enough to be sure.

So, it appears as if the author of DBD::Pg has released a new version in
the past week or so that changes the semantics of how postgres copes
with transactionalization. On top of that, it appears that it won’t
build on my development box. Which does make testing fixes difficult.

Can anyone being bitten by this confirm that simply removing the BEGIN
and COMMIT from the postgres datafile fixes this issue?

-jesse

Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

sbin/rt-setup-database from 3.0.7_01 dies when I try to initialize a
postgresql database. From what I can tell, it’s choking on the
transaction “BEGIN” at the top of Pg.schema, but I didn’t dig into
rt-setup-database enough to be sure.

So, it appears as if the author of DBD::Pg has released a new version in
the past week or so that changes the semantics of how postgres copes
with transactionalization. On top of that, it appears that it won’t
build on my development box. Which does make testing fixes difficult.

Can anyone being bitten by this confirm that simply removing the BEGIN
and COMMIT from the postgres datafile fixes this issue?

And tested on my debian box. This change has entered the repo as change
#371. It will be released as part of 3.0.8. 3.0.8 will likely be a
fairly minor update released in early december to fix a number of small
issues folks have been running into.

-j

-jesse


Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

“AI” == Abraham Ingersoll abe@dajoba.com writes:

AI> perl-DBI version 1.38, DBD::Pg version 1.31

Try dropping back to DBD::Pg 1.22. I’ve been experiencing 1.31
dumping core within mod_perl under both Perl 5.6.1 and 5.8.2 and Pg
7.2 and 7.4. I haven’t had non-modperl core dumps but it could be
related. DBD::Pg 1.22 has been rock stable for me.

“JV” == Jesse Vincent jesse@bestpractical.com writes:

Can anyone being bitten by this confirm that simply removing the BEGIN
and COMMIT from the postgres datafile fixes this issue?

JV> And tested on my debian box. This change has entered the repo as change
JV> #371. It will be released as part of 3.0.8. 3.0.8 will likely be a
JV> fairly minor update released in early december to fix a number of small
JV> issues folks have been running into.

I’m not sure it is the right fix. My testing (actually, just firing
up mod_perl on my main site) dumps core due to DBD::Pg 1.3. Backing
down to 1.22 results in a very stable system. My httpd does some
queries upon startup, and the crash happens within DBD::Pg while
fetching a row.

Personally, I’d mark DBD::Pg 1.3 as unstable currently, and recommend
1.22 instead.

Abraham,

I had the exact same problem earlier today. Jody Belka provided this
workaround:

"I installed RT on my system just the other day and also had this problem.
It seems that the file used for initialising a Postgres database
(schema.Pg) is actually designed to run through psql, not through
rt-setup-database. To get it up and running i had to let it create the
database, run the Pg script through psql, and then modify
rt-setup-database to skip these two stages (by commenting out the
appropriate lines). "

The steps I took to get the database up were:

  1. make initialize database

  2. edit the script it ran ($RT_HOME/sbin/rt-setup-database) and comment out
    the create_database and create_schema calls (I think those are the names of
    the functions)

  3. run “make initialize” a second time to finish the process.

  4. undo the changes I made to $RT_HOME/sbin/rt-setup-database

Hope this helps

Ken McKinlay
Dy 4 Systems-----Original Message-----
From: Abraham Ingersoll
To: rt-devel@lists.fsck.com
Cc: rt-users@lists.fsck.com
Sent: 11/26/03 6:36 PM
Subject: [rt-users] rt3.0.7_01 rt_setup_database fails w/postgres

sbin/rt-setup-database from 3.0.7_01 dies when I try to initialize a
postgresql database. From what I can tell, it’s choking on the
transaction “BEGIN” at the top of Pg.schema, but I didn’t dig into
rt-setup-database enough to be sure.

rt-setup-database output (args{debug} on):

[root@gimli rt-3-0-7_01]# make initialize-database
/usr/bin/perl //home/abe/apache_perl/rt/sbin/rt-setup-database --action
init --dba root --prompt-for-dba-password --debug
In order to create a new database and grant RT access to that database,
this script needs to connect to your Pg instance on localhost as root.
Please specify that user’s database password below. If the user has no
database
password, just press return.

Password: Now creating a database for RT.
Creating Pg database rt3.
Now populating database schema.
Creating database schema.
SQL:

BEGIN
Died at //home/abe/apache_perl/rt/sbin/rt-setup-database line 161.
make: *** [initialize-database] Error 2

Importing the schema into postgres by hand seems to work:

[root@gimli etc]# psql template1 -U root -W < schema.Pg
Password:
BEGIN
CREATE SEQUENCE
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
'attachments_pkey
’ for table ‘attachments’
CREATE TABLE
CREATE INDEX
CREATE INDEX
[snip snip snip]
CREATE INDEX
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
‘sessions_pkey’ f
or table ‘sessions’
CREATE TABLE
COMMIT

My platform/environment:
Redhat 9
Postgresql 7.3.4 (postgresql-server-7.3.4-3.rhl9)
perl-DBI version 1.38, DBD::Pg version 1.31

–Abe

rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm