From: Kees Monshouwer Date: Mon, 10 Feb 2014 18:36:26 +0000 (+0100) Subject: when an exception is thrown in suck() only rollback if there is a open transaction X-Git-Tag: rec-3.6.0-rc1~182^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1278%2Fhead;p=thirdparty%2Fpdns.git when an exception is thrown in suck() only rollback if there is a open transaction --- 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(); }