Darcy Buskermolen darcy
Tue Aug 23 22:33:32 PDT 2005
On Thursday 28 July 2005 11:49, Christopher Browne wrote:
> I discovered yesterday that a couple of changes were needed to this
> patch to accomodate log shipping...
>
> 1.  Change to remote_worker.c
>
> (I don't have a reasonable "diff of a diff"; this should be clear
> enough, particularly as it's only a few lines of change)
>
> @@ -2778,7 +2810,10 @@
>          if (archive_dir) {
>              slon_log(SLON_DEBUG4, "start log ship copy of %s\n",
> tab_fqname);
>              slon_mkquery(&query1,
> -                     "delete from %s;copy %s from stdin;", tab_fqname,
> tab_fqname);
> +                     "select %s.disableSubscriptionIndexes('%s'); "
> +                     "delete from %s; "
> +                     "copy %s from stdin;",
> +                     rtcfg_namespace, tab_fqname, tab_fqname, tab_fqname);
>              rc = submit_query_to_archive(&query1);
>              if (rc < 0) {
>                  slon_log(SLON_ERROR, "remoteWorkerThread_d: "
>
> 2.  Need enable/disableSubscriptionIndexes() in the initial dump...

There is a problem with the slony1-dump patch as youhave provided, it has no 
logic to load the correct functions depending on PostgreSQL version.  I think 
we may have to rethink how slony1_diump.sh works both to be able to deal with 
the above version logic, as well as prevent code duplication.

One thing we could do in the interim is to only disable indexes during 
conventional slony operation, and ignore that during logshipping mode.

>
> RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/slony1_dump.sh,v
> retrieving revision 1.1
> diff -c -u -r1.1 slony1_dump.sh
> cvs diff: conflicting specifications of output style
> --- slony1_dump.sh    17 Feb 2005 06:59:05 -0000    1.1
> +++ slony1_dump.sh    28 Jul 2005 18:47:38 -0000
> @@ -155,6 +155,48 @@
>  end;
>  ' language plpgsql;
>
> +create or replace function $clname.disableSubscriptionIndexes(text)
> +returns bigint
> +as '
> +declare
> +        p_fqname        alias for \$1;
> +begin
> +        update pg_catalog.pg_class set relhasindex = ''f'' from
> $clname.sl_table
> +                where  pg_catalog.pg_class.oid =
> $clname.sl_table.tab_reloid
> +                and $clname.slon_quote_input(''"'' ||
> $clname.sl_table.tab_nspname || ''"."'' || $clname.sl_table.tab_relname
>
> || ''"'') = ''p_fqname'';
>
> +        return 1;
> +end;
> +' language plpgsql;
> +
> +create or replace function $clname.enableSubscriptionIndexes(text)
> +returns bigint
> +as '
> +declare
> +    p_fqname    alias for \$1;
> +begin
> +    update pg_catalog.pg_class set relhasindex = ''t'' from
> $clname.sl_table
> +        where  pg_catalog.pg_class.oid = $clname.sl_table.tab_reloid
> +        and $clname.slon_quote_input(''"'' ||
> $clname.sl_table.tab_nspname || ''"."'' || $clname.sl_table.tab_relname
>
> || ''"'') = ''p_fqname'';
>
> +    return 1;
> +end;
> +' language plpgsql;
> +
> +create or replace function $clname.maintenance_work_mem(text)
> +returns text
> +as '
> +declare
> +        p_maintenance_work_mem          alias for \$1;
> +        v_old_maintenance_work_mem      text;
> +begin
> +        select current_setting(''vacuum_mem'') into
> v_old_maintenance_work_mem;
> +        if p_maintenance_work_mem > 0 then
> +        perform set_config(''vacuum_mem'',p_maintenance_work_mem,''t'');
> +    end if;
> +        return v_old_maintenance_work_mem;
> +end;
> +' language plpgsql;
> +
> +
>  _EOF_

>
>
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/slony1-general

-- 
Darcy Buskermolen
Wavefire Technologies Corp.

http://www.wavefire.com
ph: 250.717.0200
fx: 250.763.1759


More information about the Slony1-general mailing list