[Bucardo-general] Fix delta clean up in cascaded slave replication scenario

Abdul Yadi abdulyadi.datatrans at gmail.com
Thu Sep 18 15:46:37 UTC 2014


In cascaded replication scenario, delta table at primary slave (whose
changes will be propagated to the next cascaded slave) is not cleaned up by
VAC. Please refer to
http://abdulyadi.wordpress.com/2014/09/15/delta-table-clean-up-in-bucardo-5-cascaded-slave-replication/
for more explanation.
------------------------------
--------------------------------------------------------------------------
diff --git a/bucardo.schema b/bucardo.schema
index 1195c8c..46ec068 100644
--- a/bucardo.schema
+++ b/bucardo.schema
@@ -1924,8 +1924,11 @@ SELECT 'Fixme'::TEXT;
                       -- 3) Are older than the first argument interval
                       myst = 'DELETE FROM bucardo.'
                       || deltatable
-                      || ' USING (SELECT txntime AS tt FROM bucardo.'
+                      || ' USING (SELECT track.txntime AS tt FROM bucardo.'
                       || tracktable
+                      || ' track INNER JOIN bucardo.bucardo_delta_targets
bdt ON track.target=bdt.target '
+                      || ' WHERE bdt.tablename::regclass::text='
+                      || quote_literal(\$2)
                       || ' GROUP BY 1 HAVING COUNT(*) = '
                       || drows
                       || ') AS foo'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20140918/0a8f51bc/attachment-0001.html>
-------------- next part --------------
diff --git a/bucardo.schema b/bucardo.schema
index 1195c8c..46ec068 100644
--- a/bucardo.schema
+++ b/bucardo.schema
@@ -1924,8 +1924,11 @@ SELECT 'Fixme'::TEXT;
                       -- 3) Are older than the first argument interval
                       myst = 'DELETE FROM bucardo.'
                       || deltatable
-                      || ' USING (SELECT txntime AS tt FROM bucardo.'
+                      || ' USING (SELECT track.txntime AS tt FROM bucardo.'
                       || tracktable 
+                      || ' track INNER JOIN bucardo.bucardo_delta_targets bdt ON track.target=bdt.target '
+                      || ' WHERE bdt.tablename::regclass::text='
+                      || quote_literal(\$2)
                       || ' GROUP BY 1 HAVING COUNT(*) = '
                       || drows
                       || ') AS foo'


More information about the Bucardo-general mailing list