From bfb6535d45d7f23cab6b32eb0cc32a00702e523e Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 24 Nov 2014 13:17:08 -0500 Subject: [PATCH] Allow entire databases to be set as 'makedelta'u --- Bucardo.pm | 6 +++--- bucardo | 13 ++++++++++++- bucardo.schema | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Bucardo.pm b/Bucardo.pm index d7f2080c6..02d37b290 100644 --- a/Bucardo.pm +++ b/Bucardo.pm @@ -2990,7 +2990,7 @@ sub start_kid { } ## end each source database - ## Set all makedelta tables (can be target databases too, as another sync may have them as a source) + ## Set all makedelta tables (target databases can have them too, as another sync may have them as a source) for my $dbname (@dbs) { my $d = $sync->{db}{$dbname}; @@ -3002,8 +3002,8 @@ sub start_kid { ($S,$T) = ($g->{safeschema},$g->{safetable}); ## Set the per database/per table makedelta setting now - if (defined $g->{makedelta}) { - if ($g->{makedelta} eq 'on' or $g->{makedelta} =~ /\b$dbname\b/) { + if ($d->{makedelta} or defined $g->{makedelta}) { + if ($d->{makedelta} or $g->{makedelta} eq 'on' or $g->{makedelta} =~ /\b$dbname\b/) { $d->{does_makedelta}{$S}{$T} = 1; $self->glog("Set table $dbname.$S.$T to makedelta", LOG_NORMAL); } diff --git a/bucardo b/bucardo index 0fd45b631..1964d4dee 100755 --- a/bucardo +++ b/bucardo @@ -1605,6 +1605,7 @@ sub add_database { addalltables none 0 null addallsequences none 0 null server_side_prepares|ssp server_side_prepares TF null + makedelta makedelta TF null service|dbservice dbservice 0 null }; @@ -2255,6 +2256,9 @@ sub list_databases { if (! $info->{server_side_prepares}) { print ' (SSP is off)'; } + if ($info->{makedelta}) { + print " (makedelta on)"; + } } if ($dbtype eq 'drizzle') { my $showport = (length $info->{dbport} and $info->{dbport} != 3306) @@ -7502,7 +7506,6 @@ sub upgrade { ); my @old_columns = ( - ['bucardo', 'db', 'makedelta'], ['bucardo', 'dbmap', 'makedelta'], ['bucardo', 'sync', 'disable_rules'], ['bucardo', 'sync', 'disable_triggers'], @@ -10058,6 +10061,10 @@ Automatically adds all sequences once the database has been added. Optional. Enable or disable server-side prepares. Pass 1 to enable them or 0 to disable them. Defaults to 1. +=item C + +Enable or disable makedelta for this database. Defaults to 0. + =item C =item C @@ -10894,6 +10901,10 @@ Status of the database in Bucardo. Must be either "active" or "inactive". Enable or disable server-side prepares. Pass 1 to enable them or 0 to disable them. +=item C + +Enable or disable makedelta for this database. + =item C =item C diff --git a/bucardo.schema b/bucardo.schema index 55e626080..9067bc46f 100644 --- a/bucardo.schema +++ b/bucardo.schema @@ -201,6 +201,7 @@ CREATE TABLE bucardo.db ( pgpass TEXT NULL, -- local file with connection info same as pgpass status TEXT NOT NULL DEFAULT 'active', server_side_prepares BOOLEAN NOT NULL DEFAULT true, + makedelta BOOLEAN NOT NULL DEFAULT false, cdate TIMESTAMPTZ NOT NULL DEFAULT now() ); COMMENT ON TABLE bucardo.db IS $$Holds information about each database used in replication$$; -- 2.39.5