8 Replies Latest reply: Apr 16, 2013 1:42 AM by Matthew Jason
Beno 44 Level 1 Level 1 (15 points)

Afternoon Apple Community.

 

I'm having some issues with iCal Server after upgrading from 10.6 to 10.8 server.

 

Not too sure what's going on but I'm having issues with iCal Server since the upgarde on one particular use...mine!

 

Nothing can be added or removed I get "The server responded with 500 to operation CalDAVAccountRefreshQueueableOperation).

 

I am not entirely sure that the transfer to Postres has succeded corretly.

 

I do have a caldav table in postres but when trying to dump the database I get the following error which contradict each other!

 

Latest schema version (12) is installed

bash-3.2# pg_dump -U _postgres caldav -c -f /db_backups/caldav.sql

pg_dump: [archiver (db)] connection to database "caldav" failed: FATAL:  database "caldav" does not exist

bash-3.2# dropdb -U _postgres caldav

dropdb: database removal failed: ERROR:  database "caldav" does not exist

bash-3.2# calendarserver_bootstrap_database -v

 

 

Attempting to create user...

Executing: /Applications/Server.app/Contents/ServerRoot/usr/bin/createuser -h /Library/Server/PostgreSQL For Server Services/Socket --username=_postgres caldav --no-superuser --createdb --no-createrole

createuser: creation of new role failed: ERROR:  role "caldav" already exists

 

 

Database User 'caldav' exists

 

 

Attempting to create database...

Executing: /Applications/Server.app/Contents/ServerRoot/usr/bin/createdb -h /Library/Server/PostgreSQL For Server Services/Socket --username=caldav caldav

createdb: database creation failed: ERROR:  database "caldav" already exists

 

 

Database 'caldav' exists

 

 

Attempting to read schema version...

Executing: /Applications/Server.app/Contents/ServerRoot/usr/bin/psql -h /Library/Server/PostgreSQL For Server Services/Socket -d caldav -U caldav -t -c select value from calendarserver where name='VERSION';

12

 

 

 

 

Latest schema version (12) is installed

bash-3.2# dropdb -U _postgres caldav

dropdb: database removal failed: ERROR:  database "caldav" does not exist

bash-3.2#

 

 

When the server is booting I'm getting the following error messages:

 

Mar 16 13:46:01 mail.example.com.au CalendarAgent[507]: [com.apple.calendar.store.log.caldav] [During deep refresh in calendar "Final", had collection tag match, but etag mismatch for url http://mail.example.com.au:8008/calendars/__uids__/D9F3C0D6-1334-44B7-B48B-10EC3 B8E3713/calendar/F60B9168-DDC6-4C3A-9C82-9309D3D2B041.ics: local changes not sent to the server - cTag:842_4711 syncToken:(null)]

 

Please helppppppp,it's driving me nuts!

  • 1. Re: iCal Postgres issues
    ~morgen Level 1 Level 1 (105 points)

    As of 10.8 there are 2 instances of postgres, a general purpose one, and a new one now dedicated to Server.  calendarserver_bootstrap_database is talking to the new one (via /Library/Server/PostgreSQL For Server Services/Socket) and indeed that new database does have a "caldav" user and "caldav" db.  When you are running pg_dump and dropdb by hand you are by default talking to the other, general purpose postgres.

     

    Your calendar data should have already been migrated into the new database.  Had you gotten errors during migration?

     

    Is your Calendar Server pointing at the new database?  You can tell by examining the "DSN" value via:

     

       # serveradmin settings calendar:DSN

     

    You should see:

     

       calendar:DSN = "/Library/Server/PostgreSQL For Server Services/Socket:caldav:caldav:::"

  • 2. Re: iCal Postgres issues
    Matthew Jason Level 1 Level 1 (0 points)

    Hi. How do I access the PostgreSQL database for the Server Services? I use pgadmin but it seems to be pointing to the general purpose database and not the Server Service database which contain the Cal data. I am trying to find solution/command for pgdump and pgrestore cal data.

     

    matthew

  • 3. Re: iCal Postgres issues
    ~morgen Level 1 Level 1 (105 points)

    sudo psql -h "/Library/Server/PostgreSQL For Server Services/Socket" -d caldav -U caldav

  • 4. Re: iCal Postgres issues
    Matthew Jason Level 1 Level 1 (0 points)

    Thanks. Any idea about accessing the database using pgadmin?

     

    I can connect to the database but am not sure what command to dump and restore?

  • 5. Re: iCal Postgres issues
    ~morgen Level 1 Level 1 (105 points)

    This is what calendarserver_backup does to backup...

     

    sudo pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket" --username=caldav --clean --no-privileges --file=/path/to/your_dump_file caldav

     

    ...and restore...

     

    sudo psql -h "/Library/Server/PostgreSQL For Server Services/Socket" --username=caldav --file=/path/to/your_dump_file

  • 6. Re: iCal Postgres issues
    Matthew Jason Level 1 Level 1 (0 points)

    Thanks ~morgen. I should so seriously learn more about PostgreSQL to admin my server. I assume OS X Server is using the standard PostgreSQL you reckon or I shouldn't waste my time?

  • 7. Re: iCal Postgres issues
    Matthew Jason Level 1 Level 1 (0 points)

    I am using the latest Server app 2.2.1 and now I get this message.

     

    pg_dump: server version: 9.2.1; pg_dump version: 9.1.5

    pg_dump: aborting because of server version mismatch

     

    How can I update the pg_dump version or workaround?

     

    matthew

  • 8. Re: iCal Postgres issues
    Matthew Jason Level 1 Level 1 (0 points)

    I managed to update my pg_dump. However, I got this error. Similar to the error I get when I tried to restore via pgadmin:

     

    129: ERROR:  must be owner of extension plpgsql

    130: ERROR:  must be owner of schema public

    135: ERROR:  schema "public" already exists

    ALTER SCHEMA

    144: ERROR:  must be owner of schema public

    CREATE EXTENSION

    158: ERROR:  must be owner of extension plpgsql

     

    Noticed that the data are back, is it safe to ignore or there are something else to do?

     

    Thanks.

    matthew