deploying bucardo and solving a schema mismatch problem

No Gravatar

In the process of deploying bucardo 4.4.0 to replicate a fairly large django database using postgresql 8.4, I ran into a tricky issue.  Although I knew for certain that the database schemas were identical, bucardo still complained about a mismatch in the default value for the first table’s primary key column.

For some reason bucardo was identifying the reference to the sequence with the “public” schema explicitly named on one database and without “public” on the other.  In this case, schema refers to a namespace and not the database layout sense of the word. The goat validation was throwing the following error.

...
MCP Warning: Source database for sync "databaseA" has column "id" of table "public.auth_group" with a DEFAULT of "nextval('auth_group_id_seq'::regclass)", but target database "databaseB" has a DEFAULT of "nextval('public.auth_group_id_seq'::regclass)"
...

I was sure that the databases were identical because they were both restored from the same backup file.  I did find that I was running 8.4.1 on one postgresql server and 8.4.3 on the other. I synced up the postgresql versions, but I did not track down any of the relevant driver versions, because I was able to find a simple work around.

I searched for the error string in the bucardo perl source code and found the problematic section.  Since I knew the tables were identical, I felt that skipping this part of the validation would be harmless, so I made the following change to Bucardo.pm

2032 #if ($scol->{atthasdef} and $fcol->{atthasdef} and $scol->{def} ne $fcol->{def}) {
2033 if (1 == 2) {

After I installed my updated bucardo, I kicked off replication again with a successful result.

About edwin

I'm a web developer living in a post gis world. I’m interested in open source software, open data, GIS, spatial databases (geodatabases), web mapping applications and location based services. I love javascript (node!), python and postgresql.
This entry was posted in technology and tagged , , , , . Bookmark the permalink.

4 Responses to deploying bucardo and solving a schema mismatch problem

  1. NateNo Gravatar says:

    Thank you so much. This is an issue I ran into doing exactly the same thing as you are (using bucardo for a django database).

  2. eggyknapNo Gravatar says:

    You can also turn off strict_checking in the goat and sync tables to work around this problem

  3. edwinNo Gravatar says:

    Thanks!

    I wanted to get the error text out there in case anybody else is running into the same problem. I really appreciate your work on bucardo, it seems to do just what I need.

  4. Greg Sabino MullaneNo Gravatar says:

    This was a known problem that has been fixed in the dev version, and will be part of the next release (4.5.0). Here’s the official bug for it:

    http://bucardo.org/bugzilla/show_bug.cgi?id=17

    Thanks for using Bucardo!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>