From 376ec278f649e6d19120c1aab898b21ef104cf55 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Mon, 10 Feb 2014 19:36:26 +0100 Subject: [PATCH] when an exception is thrown in suck() only rollback if there is a open transaction --- pdns/slavecommunicator.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 6a6725ad7b..3a8a090897 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -71,7 +71,7 @@ void CommunicatorClass::suck(const string &domain,const string &remote) DomainInfo di; di.backend=0; - bool first=true; + bool transaction=false; try { UeberBackend *B=dynamic_cast(P.getBackend()); // copy of the same UeberBackend NSEC3PARAMRecordContent ns3pr, hadNs3pr; @@ -156,6 +156,7 @@ void CommunicatorClass::suck(const string &domain,const string &remote) unsigned int soa_serial = 0; vector rrs; set secured; + bool first=true; while(retriever.getChunk(recs)) { if(first) { L<startTransaction(domain, domain_id); + transaction = true; + L<commitTransaction(); + transaction = false; di.backend->setFresh(domain_id); PC.purge(domain+"$"); @@ -347,35 +350,35 @@ void CommunicatorClass::suck(const string &domain,const string &remote) } catch(DBException &re) { L<abortTransaction(); } } catch(MOADNSException &re) { L<abortTransaction(); } } catch(std::exception &re) { L<abortTransaction(); } } catch(ResolverException &re) { L<abortTransaction(); } } catch(PDNSException &ae) { L<abortTransaction(); } -- 2.47.2