Steve Singer ssinger at ca.afilias.info
Thu Jun 9 06:26:05 PDT 2011
On 11-06-08 11:15 PM, Glyn Astill wrote:
> Hi Guys,
>
> Just had an issue with subscribe set in 2.0.6.  From what I can see somehow slonik is passing parameters
> to reshapesubscription in the wrong order, instead of (sub_set, sub_provider, sub_receiver) it seems to be
> sending (sub_provider, sub_set, sub_receiver).  In turn that made slonik hang on me and borked my subscriptions.
>

Yes the parameters appear to be passed in the wrong order.

I have created a bug for this and attached a patch
http://bugs.slony.info/bugzilla/show_bug.cgi?id=220

Once Jan or Chris looks over the patch I will commit this for 2.0.7 and 
for the next 2.1 beta

Thanks for the report

> Here's what I submitted to slonik:
>
>      SUBSCRIBE SET ( ID = 1000, PROVIDER = 4, RECEIVER = 5, FORWARD = YES );
>
> Here's the error message I get from slonik:
>
>      Way5b:/pgsql/slony# slonik reshape.scr
>      reshape.scr:17: ATTEMPT:  SUBSCRIBE SET
>      reshape.scr:18: NOTICE:  subscribe set: omit_copy=f
>      reshape.scr:18: NOTICE:  subscribe set: omit_copy=f
>      CONTEXT:  SQL statement "SELECT  "_main_replication".subscribeSet_int( $1 ,  $2 ,  $3 ,  $4 ,  $5 )"
>      PL/pgSQL function "subscribeset" line 77 at PERFORM
>      reshape.scr:18: PGRES_FATAL_ERROR select "_main_replication".reshapeSubscription(4,1000,5); - ERROR:  insert or update on table "sl_subscribe" violates foreign key constraint "sl_subscribe-sl_path-ref"
>      DETAIL:  Key (sub_provider,sub_receiver)=(1000,5) is not present in table "sl_path".
>      CONTEXT:  SQL statement "update "_main_replication".sl_subscribe set sub_provider= $1  WHERE sub_set= $2  AND sub_receiver= $3 "
>      PL/pgSQL function "reshapesubscription" line 11 at SQL statement
>      error reshaping subscriber
>
> And here's what my reshapesubscription looks like:
>
>      CREATE OR REPLACE FUNCTION _main_replication.reshapesubscription(integer, integer, integer)
>        RETURNS integer AS
>      $BODY$
>      declare
>          p_sub_set            alias for $1;
>          p_sub_provider        alias for $2;
>          p_sub_receiver        alias for $3;
>      begin
>          -- ----
>          -- Grab the central configuration lock
>          -- ----
>          lock table "_main_replication".sl_config_lock;
>
>          update "_main_replication".sl_subscribe set sub_provider=p_sub_provider
>                 WHERE sub_set=p_sub_set AND sub_receiver=p_sub_receiver;
>          if found then
>             perform "_main_replication".RebuildListenEntries();
>             notify "_main_replication_Restart";
>          end if;
>          return 0;
>      end
>      $BODY$
>      LANGUAGE plpgsql VOLATILE;
>
> Looking in the slonik.c starting on on line 3541 I can see the following:
>
>                  slon_mkquery(&query,
>                                           "select \"_%s\".reshapeSubscription(%d,%d,%d);",
>                                           stmt->hdr.script->clustername,
>                                           stmt->sub_provider,stmt->sub_setid,
>                                           stmt->sub_receiver);
>
> Unless I'm going crazy (It is now 4am), that pretty much looks the wrong way around to me?
>
> Thanks
> Glyn
>
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at lists.slony.info
> http://lists.slony.info/mailman/listinfo/slony1-general



More information about the Slony1-general mailing list