Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL replication with rubyrep

I'm new to rubyrep and currently using rubyrep-1.2.0 version for PostgreSQL Master-Master replication. All data types except bytea are getting replicated properly. While replicating bytea column, it seems like the data is escaped twice. I'm using postgreSQL9.2 version and I have tried both bytea_output = 'hex' and bytea_output = 'escape' options in postgres configuration without any luck.

left database bytea column value:

\xc30d0409030220f8eef5543ac6906cd234018e307bd602ca16a61e674a6c4368f8018b01c3ae3007ae0313a9e44dc661a97a61cc94032f3ed1921e5987e92ff723f674a903

The bytea data from left is replicated to right database as:

\x5c3330335c3031355c3030345c3031315c3030335c3030325c3034305c3337305c3335365c3336355c3132345c3037325c3330365c3232305c3135345c3332325c3036345c3030315c3231365c3036305c3137335c3332365c3030325c3331325c3032365c3234365c3033365c3134375c3131325c3135345c3130335c3135305c3337305c3030315c3231335c3030315c3330335c3235365c3036305c3030375c3235365c3030335c3032335c3235315c3334345c3131355c3330365c3134315c3235315c3137325c3134315c3331345c3232345c3030335c3035375c3037365c3332315c3232325c3033365c3133315c3230375c3335315c3035375c3336375c3034335c3336365c3136345c3235315c303033 

Anything, am I missing in the rubyrep/postgresql configuration?

like image 333
Kumaran6.2 Avatar asked Nov 12 '22 18:11

Kumaran6.2


1 Answers

Something must be messing with the values during the replication process. In PostgreSQL 9.1, I can repeatedly cast back and forth between bytea and text.

select 'test'::bytea;

returns \x74657374

The following also return the same value:

select 'test'::bytea::text;
select 'test'::bytea::text::bytea;

this makes me wonder if Ruby-rep is double escaping the data itself, or not unescaping but escaping anyway.

At this point, given my tests on the PostgreSQL side I think the appropriate response is to take this up as a bug with the ruby-rep developers. This has to be a bug in their code.

like image 139
Chris Travers Avatar answered Dec 21 '22 07:12

Chris Travers