[Bucardo-general] cannot delete in a read-only transaction

Greg Sabino Mullane greg at endpoint.com
Tue Jun 7 17:56:50 UTC 2016


On Tue, May 31, 2016 at 08:16:50AM +0000, Videanu Adrian wrote:
> Hi all,
> I have a 4 master bucardo setup which works as it should, only that sometimes i get this kind of messages in log: 
> Any idea why this is happening ?

> ... VAC was killed at line 7727: DBD::Pg::st pg_result failed: ERROR:  cannot execute DELETE in a read-only transaction

I think this is a bug. While we go out of our way to set transaction isolation when connecting 
to sources and targets, the VAC has no such check. Obviously, it needs to override read_only 
if it is set. Try this patch:

diff --git a/Bucardo.pm b/Bucardo.pm
index 1f8870e..60f04a7 100644
--- a/Bucardo.pm
+++ b/Bucardo.pm
@@ -5787,6 +5787,12 @@ sub connect_database {
         $dbh->commit();
     }
 
+    ## If this is a vacuum process, make sure it can write to the database!
+    if ('VAC' eq $self->{logprefix}) {
+        $dbh->do(qq{SET default_transaction_read_only = off});
+        $dbh->commit();
+    }
+
     return $backend, $dbh;
 
 } ## end of connect_database


-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20160607/f7b10979/attachment.sig>


More information about the Bucardo-general mailing list