Forum OpenACS Q&A: 3.2.5 with 4.6 on same Linux/Postgres install -- delurk

We have a production server with 3.2.5 and I just finished setting up a brand new server with the same configuration. Suddenly, we don't need to have the second server for another half year (at least), so I want to try 4.6 on the machine to test that version in the mean time.

Can they both co-exist on the same machine? I believe OpenACS 4.6 requires a newer AOLserver and I'm wondering if it is possible to keep both AOLservers running without messing things up too much? Can I just install the new one in a new directory?

On the other hand, I don't mind installing the new server on top of the old one if it's the most stable way to go. Is it?

Thanks to all for the excellent OpenACS...

There is no problem at all. Simply install OpenACS 4.6 in another directory, edit the nsd.tcl file and go.

Enjoy!

Hello,

Yes, both can coexist without a problem. Just make sure of using a different database for each ;)

Cheers

/B

Okay, thank you for the help. I finally got 4.6 running, with the help of my friend. And I believe you -- both 3.2.5 and 4.6 could be running on the same machine. I ended up just installing 4.6 over the 3.2.5 -- and I had to upgrade postgres and aolserver first. This caused some issues:

bash-2.05a$ createlang plpgsql template1
psql: FATAL 1:  cannot open /var/lib/pgsql/data/global/1262: No such file or directory
createlang: external error

/var/lib/ was where our old database was, but I echo $PATH  = /usr/local/pgsql/... hmmmm... I ended up resolving that with a reboot! So I guess some of the old db processes were running. But then I was still getting this error:

bash-2.05a$ createlang plpgsql template1
/usr/bin/psql: relocation error: /usr/bin/psql: undefined symbol: pg_encoding_to_char
createlang: external error

I think the problem was that I didn't uninstall the existing postgres files. After reading about many other very smart people who were getting the same error, we came to the same conclusion as many of them -- which was that the best thing to do is uninstall postgres and start over again.

So we figured that we'd "cowboy" it and install the latest postgres version 7.3.2 instead of OpenACS recommended 7.2.3 version of postgres -- that was a mistake. OpenACS doesn't work with the 7.3.2 version yet. We found some info on the postgres site that said "the naming convention wasn't 100% followed until version 7.3.*" So my friend was fixing things in the database to overcome some errors, one by one, but there were too many errors for him to make a patch -- and we figured out it would be easier to install 7.2.3 so we did and it worked.

Thanks all for the excellent improvements from the 3.2.5 version -- I'm really excited to use 4.6 to create some excellent sites.

Collapse
Posted by Ben Koot on
We have tried installing 7.2.4 but old databases created in 7.1.2 won't work. Does anybody have an idea what we can do to solve this problem?

Thanks a bunch

As with any major release of PostgreSQL, you have to dump and restore. It would be wise to follow the migration instructions for your release of PG, 7.2 in this case:

http://www.postgresql.org/docs/view.php?version=7.2&idoc=0&file=release.html#RELEASE-7-2

-Roberto

I dumped an OpenACS 3.2.5 database from version 7.1.2 (RH 7.1, Postgresql 7.1.2 rpm version) with a lot of blobs using this command:
pg_dump -Ft -b mydb > mydb.tar,

which produced a 30 MB tarball.

I installed RH 7.3 and PostgreSQL 7.2.4 rpm version.

I created a pristine database:

createdb -T template0 newdb

Then:

pg_restore -d mydb.tar newdb

This produced a lot of notices, until:

pg_restore: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'event_info_pkey' for table 'event_info'
pg_restore: ERROR:  copy: line 389, Cannot insert a duplicate key into unique index user_group_map_pkey
pg_restore: lost synchronization with server, resetting connection
pg_restore: [archiver (db)] error returned by PQendcopy

And that was it.

psql -V output:

psql (PostgreSQL) 7.2.4
contains support for: readline, history, multibyte
Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Portions Copyright (c) 1996, Regents of the University of California
Read the file COPYRIGHT or use the command \copyright to see the
usage and distribution terms.

A smaller OpenACS 3.2.5 database does load without errors and is OK.

An OpenACS4 database did not load at all:

$ pg_restore -d oacs oacs46-12mrt.tar
pg_restore: [archiver (db)] could not execute query: ERROR:  Function 'tree_ancestor_keys(varbit, int4)' does not exist
    Unable to identify a function that satisfies the given argument types
    You may need to add explicit typecasts

Anybody got a clue? Thanks!

P.S. Maybe I should post this at the PostgreSQL forum as well...

Well... although the database loaded alright, it is unusable. I get an empty first page and error messages like:

[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: dbinit: error(localhost::blog,ERROR:  value too long for type character(1)
): 'select sec_rotate_last_visit(8778, 1047680358)'
[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: Filter sec_read_security_info returned error #1: Database operation "1row" failed (exception NSDB, "Query was not a statement returning rows.")
[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: tclop: invalid return code from filter proc 'Critical filter sec_read_security_info failed.': must be filter_ok, filter_return, or filter_break
NOTICE:  Error occurred while executing PL/pgSQL function sec_rotate_last_visit
NOTICE:  line 11 at SQL statement
[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: Ns_PgExec: result status: 7 message: ERROR:  value too long for type character(1)

[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: dbinit: error(localhost::blog,ERROR:  value too long for type character(1)
): 'select sec_rotate_last_visit(8780, 1047680358)'
[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: Filter sec_read_security_info returned error #1: Database operation "1row" failed (exception NSDB, "Query was not a statement returning rows.")
[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: tclop: invalid return code from filter proc 'Critical filter sec_read_security_info failed.': must be filter_ok, filter_return, or filter_break

Very annoying....
By the way, I do not expect any of you to have a solution for this... I guess we just have to use the old databases on a different install.

With the databases unable to be loaded into new versions, and postmaster not being allowed to run more than once on a machine, I guess this means you have to ditch all of your data every 1-2 years when software must be updated ;)

In this way, one can only use it as a test environment.

[14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: dbinit: error(localhost::blog,ERROR: value too long for type character(1) ): 'select sec_rotate_last_visit(8780, 1047680358)' [14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: Filter sec_read_security_info returned error #1: Database operation "1row" failed (exception NSDB, "Query was not a statement returning rows.") [14/Mar/2003:23:19:18][5118.4101][-conn0-] Error: tclop: invalid return code from filter proc 'Critical filter sec_read_security_info failed.': must be filter_ok, filter_return, or filter_break

Very annoying.... By the way, I do not expect any of you to have a solution for this... I guess we just have to use the old databases on a different install.

Actually, there is a quite simple fix for this problem. In the function sec_rotate_last_visit in security.sql, just cast the variable vtime as a varchar, not a char, thus:

create function sec_rotate_last_visit(integer, integer)
returns integer as '
DECLARE
	v_browser_id alias for $1;
	v_time alias for $2;
BEGIN
    lock table sec_browser_properties;
    delete from sec_browser_properties
        where browser_id = v_browser_id and module = ''acs'' and property_name = ''second_to_last_visit'';
    update sec_browser_properties
        set property_name = ''second_to_last_visit''
        where module = ''acs'' and property_name = ''last_visit'' and browser_id = v_browser_id;
    insert into sec_browser_properties(browser_id, module, property_name, property_value, secure_p)
        values(v_browser_id, ''acs'', ''last_visit'', v_time::varchar, ''f'');

    return 1;
end;
' language 'plpgsql';

Drop the function using PSQL and then read the security.sql file into the database to reload the function. I think all will be happiness and light then.

This actually has been previously discussed at length. See https://openacs.org/forums/message-view?message_id=29185 for one thread...

Thanks, this works! For those who want to solve this problem as well: (as far as I remember) I did

psql -f mydb

\drop function sec_rotate_last_visit

I edited security.sql as outlined above.

And then: psql -f security.sql mydb.

By the way, it stays strange that a big database does not load at all. Maybe I should try and redump it, if needed without blobs (although that would take away a lot of important info).