bugzilla-daemon at main.slony.info bugzilla-daemon at main.slony.info
Thu Jun 9 06:20:07 PDT 2011
http://www.slony.info/bugzilla/show_bug.cgi?id=220

           Summary: parameters to reshape subscription are passed in the
                    wrong order
           Product: Slony-I
           Version: 2.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: low
         Component: slonik
        AssignedTo: slony1-bugs at lists.slony.info
        ReportedBy: ssinger at ca.afilias.info
                CC: slony1-bugs at lists.slony.info
   Estimated Hours: 0.0


Bug report from Glyn Still
--
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. 

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

-- 
Configure bugmail: http://www.slony.info/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Slony1-bugs mailing list