[Pdns-users] updated patch to improve SQL db AXFR performance

ktm at rice.edu ktm at rice.edu
Tue Jul 16 19:12:15 UTC 2013


Dear PDNS community,

We are preparing to upgrade to the DNSSEC capable pdns 3.3. Please find
the attached patch to include a "finalize-axfr-query" to replace the
blanket assumption of "commit". This allows you to utilize areas other
than your primary records tables to manage the API mismatch between
a flatfile update and that of an MVCC capable SQL DB. Here is the
README I wrote while updating the patch to version 3.3. It was originally
targeting 2.9.x and was posted in May 2007. The patch is attached.

README-------------------------------
This file documents what was changed and why to improve the AXFR
performance with an MVCC type database like PostgreSQL/Oracle and
MySQL with the INNODB storage engine. The AXFR process works as
follows:

1. AXFR for a domain is received by SLAVE.
2. SLAVE transfers zone and checks for validity.
3  SLAVE DELETEs all zone records.
4. SLAVE INSERTs the updated zone.

This is a crazy waste when there are few changes (The usual case)
and even worse for systems that need to be able to ROLLBACK the
changes. A simple substitution of loading the new zone into a
working TEMPORARY table and using that to calculate the deltas,
records added, deleted, or changed. Then only apply those much
smaller updates. The fly in the ointment is that the clean-up
or application of the deletas needs to be done when the zone is
committed and while the delete-zone-query and insert-zone-query
are user defineable, the final commit for a zone transfer is
hard-coded to "commit".

This patch updates the commitTransaction() function to utilize
a new user defineable query called finalize-axfr-query with
a default value of "commit" to yield the same behavior if it
is left undefined. However, it can be defined to execute the
needed zone finalization actions to leverage the use of the
temporary tables. In the original patch against version 2.9.x,
the speed-up was 10x not to mention the reduced table bloating
which needed VACUUM with PostgreSQL to reuse the space. It
appears that the oracle backend already has this by setting
the oracle-finalize-axfr-query. This adds the ability to the
gsql backends.

Note: I have provided patches against the oracle, lua and odbx
backends to support the additional argument to the commitTransaction()
function, but they are just a stub to prevent compile and runtime
errors and I have not tested them. They will need to be tested by
someone with access to and experience with building the different
backends.

patch changes:

1. Add the declaration for finalize-axfr-query to:
./pdns/backends/gsql/gsqlbackend.cc
./modules/gsqlite3backend/gsqlite3backend.cc
./modules/godbcbackend/godbcbackend.cc
./modules/gmysqlbackend/gmysqlbackend.cc
./modules/goraclebackend/goraclebackend.cc
./modules/gpgsqlbackend/gpgsqlbackend.cc
declare(suffix, "commit-zone-axfr-query", "", "commit");

2. Declare d_FinalizeAXFRQuery for g* backends:
./pdns/backends/gsql/gsqlbackend.hh
./pdns/backends/gsql/gsqlbackend.cc
string d_FinalizeAXFRQuery;
d_FinalizeAXFRQuery=getArg("finalize-axfr-query");

3. Add domain_id argument to bool commitTransaction() declaration:
./pdns/backends/bind/bindbackend2.hh
./pdns/backends/gsql/gsqlbackend.hh
./pdns/dnsbackend.hh
./modules/oraclebackend/oraclebackend.hh
./modules/luabackend/luabackend.hh
./modules/opendbxbackend/odbxbackend.hh

4. Fix commitTransaction() functions to use the user defined SQL
command if defined:
./pdns/backends/bind/bindbackend2.cc
./pdns/backends/gsql/gsqlbackend.cc
./modules/oraclebackend/oraclebackend.cc
./modules/luabackend/slave.cc
./modules/opendbxbackend/odbxbackend.cc
./pdns/ws.cc
./pdns/pdnssec.cc
./pdns/slavecommunicator.cc
./pdns/packethandler.cc

5. Test and benchmark AXFR functionality.
The benchmark shows the patched version works like the original version.
If the queries are updated, the patched version is approximately 2X faster
than the unpatched as well as resulting in less DB churn. Here are the
queries I used for testing:

With DNSSEC enabled:
#Update AXFR queries to use stage table for staging
gpgsql-delete-zone-query=CREATE TEMPORARY TABLE stage (id INT, domain_id INT,
name VARCHAR(255), \
   type VARCHAR(6), content VARCHAR(255), ttl INT, prio INT, auth BOOLEAN) ON
COMMIT DROP; \
   PREPARE axfrinsert (varchar, int, int, varchar, int, varchar, boolean) AS
INSERT INTO \
   stage (content,ttl,prio,type,domain_id,name,auth) VALUES
($1,$2,$3,$4,$5,$6,$7::boolean);
gpgsql-insert-record-query-auth=EXECUTE axfrinsert
(E'%s',%d,%d,E'%s',%d,E'%s','%d');
gpgsql-finalize-axfr-query=CREATE TEMPORARY TABLE axfrvars (name VARCHAR(6),
value INT) ON COMMIT DROP; \
INSERT INTO axfrvars (name, value) VALUES ('domain', %d); \
DELETE FROM records \
WHERE domain_id = \
    (SELECT value FROM axfrvars WHERE name = 'domain') AND \
      records.id NOT IN \
          (SELECT records.id FROM records INNER JOIN stage \
           USING (domain_id, name, type, content, ttl, prio)); \
INSERT INTO records (domain_id, name, type, content, ttl, prio, auth) \
SELECT domain_id, name, type, content, ttl, prio, auth FROM stage \
WHERE stage.domain_id = \
    (SELECT value FROM axfrvars WHERE name = 'domain') EXCEPT \
        SELECT domain_id, name, type, content, ttl, prio, auth from records \
        WHERE records.domain_id = \
            (SELECT value FROM axfrvars WHERE name = 'domain'); \
COMMIT; DEALLOCATE axfrinsert;

Without DNSSEC:
gpgsql-delete-zone-query=CREATE TEMPORARY TABLE stage (id INT, \
domain_id INT, name VARCHAR(255), type VARCHAR(6), content VARCHAR(255), \
ttl INT, prio INT) ON COMMIT DROP; PREPARE axfrinsert (varchar, int, int, \
 varchar, int, varchar) AS INSERT INTO stage \
(content,ttl,prio,type,domain_id,name) VALUES ($1,$2,$3,$4,$5,$6);
gpgsql-insert-record-query=EXECUTE axfrinsert (E'%s',%d,%d,E'%s',%d,E'%s');
gpgsql-finalize-axfr-query=CREATE TEMPORARY TABLE axfrvars (name VARCHAR(6), \
value INT) ON COMMIT DROP; \
INSERT INTO axfrvars (name, value) VALUES ('domain', %d); \
DELETE FROM records \
WHERE domain_id = \
    (SELECT value FROM axfrvars WHERE name = 'domain') AND \
      records.id NOT IN \
          (SELECT records.id FROM records INNER JOIN stage \
           USING (domain_id, name, type, content, ttl, prio)); \
INSERT INTO records (domain_id, name, type, content, ttl, prio) \
SELECT domain_id, name, type, content, ttl, prio FROM stage \
WHERE stage.domain_id = \
    (SELECT value FROM axfrvars WHERE name = 'domain') EXCEPT \
        SELECT domain_id, name, type, content, ttl, prio from records \
        WHERE records.domain_id = \
            (SELECT value FROM axfrvars WHERE name = 'domain'); \
COMMIT; DEALLOCATE axfrinsert;

6. Add this to PDNS documentation:

finalize-axfr-query
  Called to finalize an incoming AXFR. The domain_id is available in the
  query using %d. Default: commit



Here is the build process:

./configure --prefix=/home/ktm/PDNS/pdns-test --with-lua --with-modules="gpgsql gmysql" --with-pgsql=/usr/pgsql-9.2 --with-pgsql-includes=/usr/pgsql-9.2/include

make
make install

-------------- next part --------------
--- pdns-3.3/pdns/pdnssec.cc	2013-07-04 14:07:15.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/pdnssec.cc	2013-07-11 20:10:29.852849751 -0500
@@ -165,11 +165,6 @@
 // I think this has to do with interlocking transactions between B and DK, but unsure.
 bool rectifyZone(DNSSECKeeper& dk, const std::string& zone)
 {
-  if(dk.isPresigned(zone)){
-    cerr<<"Rectify presigned zone '"<<zone<<"' is not allowed/necessary."<<endl;
-    return false;
-  }
-
   UeberBackend B("default");
   bool doTransaction=true; // but see above
   SOAData sd;
@@ -842,7 +837,7 @@
   cout<<"Feeding overlong TXT"<<endl;
   db->feedRecord(rr);
   cout<<"Committing"<<endl;
-  db->commitTransaction();
+  db->commitTransaction(di.id);
   cout<<"Querying TXT"<<endl;
   db->lookup(QType(QType::TXT), zone, NULL, di.id);
   if(db->get(rrget))
@@ -881,7 +876,7 @@
 
   rr.qname="bla."+zone;
   cout<<"Committing"<<endl;
-  db->commitTransaction();
+  db->commitTransaction(di.id);
 
   cout<<"Securing zone"<<endl;
   secureZone(dk, zone);
--- pdns-3.3/pdns/slavecommunicator.cc	2013-07-04 13:32:30.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/slavecommunicator.cc	2013-07-11 16:33:50.056878093 -0500
@@ -155,7 +155,6 @@
     bool gotOptOutFlag = false;
     unsigned int soa_serial = 0;
     vector<DNSResourceRecord> rrs;
-    set<string> secured;
     while(retriever.getChunk(recs)) {
       if(first) {
         L<<Logger::Error<<"AXFR started for '"<<domain<<"'"<<endl;
@@ -178,10 +177,7 @@
           continue;
         } else if (i->qtype.getCode() == QType::NSEC3) {
           dnssecZone = gotPresigned = true;
-          NSEC3RecordContent ns3rc(i->content);
-          gotOptOutFlag = ns3rc.d_flags & 1;
-          if (ns3rc.d_set.count(QType::NS) && !pdns_iequals(i->qname, domain))
-            secured.insert(toLower(makeRelative(i->qname, domain)));
+          gotOptOutFlag = NSEC3RecordContent(i->content).d_flags & 1;
           continue;
         } else if (i->qtype.getCode() == QType::NSEC) {
           dnssecZone = gotPresigned = true;
@@ -197,6 +193,8 @@
         }
 
         i->domain_id=domain_id;
+        if (i->qtype.getCode() == QType::SRV)
+          i->content = stripDot(i->content);
 
 #if 0
         if(i->qtype.getCode()>=60000)
@@ -214,7 +212,6 @@
       }
     }
 
-
     BOOST_FOREACH(const DNSResourceRecord& rr, rrs) {
       if(rr.qtype.getCode() == QType::NS && !pdns_iequals(rr.qname, domain))
         nsset.insert(rr.qname);
@@ -281,8 +278,8 @@
       if (dnssecZone && rr.qtype.getCode() != QType::RRSIG) {
         if (haveNSEC3) {
           // NSEC3
-          ordername=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
-          if(!narrow && (rr.auth || (rr.qtype.getCode() == QType::NS && (!gotOptOutFlag || secured.count(ordername))))) {
+          if(!narrow && (rr.auth || (rr.qtype.getCode() == QType::NS && !gotOptOutFlag))) {
+            ordername=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname)));
             di.backend->feedRecord(rr, &ordername);
           } else
             di.backend->feedRecord(rr);
@@ -337,7 +334,7 @@
       dk.unsetNSEC3PARAM(domain);
     }
 
-    di.backend->commitTransaction();
+    di.backend->commitTransaction(domain_id);
     di.backend->setFresh(domain_id);
     PC.purge(domain+"$");
 
--- pdns-3.3/pdns/ws.cc	2013-05-10 07:04:04.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/ws.cc	2013-07-11 16:27:54.427849674 -0500
@@ -477,7 +477,7 @@
       // but now what
       sd.db->startTransaction(qname);
       sd.db->replaceRRSet(sd.domain_id, qname, qtype, rrset);
-      sd.db->commitTransaction();
+      sd.db->commitTransaction(sd.domain_id);
       return ret+post;
     }  
   }
--- pdns-3.3/pdns/backends/bind/bindbackend2.cc	2013-06-10 09:12:21.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/backends/bind/bindbackend2.cc	2013-07-11 16:13:10.457816879 -0500
@@ -180,7 +180,7 @@
   return true;
 }
 
-bool Bind2Backend::commitTransaction()
+bool Bind2Backend::commitTransaction(int id)
 {
   if(d_transaction_id < 0)
     return true;
@@ -423,7 +423,7 @@
     ;
   else if(bdr.qname==toLower(bb2.d_name))
     bdr.qname.clear();
-  else if(bdr.qname.length() > bb2.d_name.length() && dottedEndsOn(bdr.qname, bb2.d_name))
+  else if(bdr.qname.length() > bb2.d_name.length())
     bdr.qname.resize(bdr.qname.length() - (bb2.d_name.length() + 1));
   else
     throw AhuException("Trying to insert non-zone data, name='"+bdr.qname+"', qtype="+qtype.getName()+", zone='"+bb2.d_name+"'");
@@ -715,7 +715,7 @@
         staging->name_id_map[i->name]=bbd->d_id; // fill out name -> id map
 
         // overwrite what we knew about the domain
-        bbd->d_name=toLower(canonic(i->name));
+        bbd->d_name=i->name;
 
         bool filenameChanged = (bbd->d_filename!=i->filename);
         bbd->d_filename=i->filename;
--- pdns-3.3/pdns/backends/bind/bindbackend2.hh	2013-05-16 07:55:13.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/backends/bind/bindbackend2.hh	2013-07-11 16:12:52.297817164 -0500
@@ -142,7 +142,7 @@
   bool startTransaction(const string &qname, int id);
   //  bool Bind2Backend::stopTransaction(const string &qname, int id);
   bool feedRecord(const DNSResourceRecord &r, string *ordername=0);
-  bool commitTransaction();
+  bool commitTransaction(int id);
   bool abortTransaction();
   bool updateDNSSECOrderAndAuthAbsolute(uint32_t domain_id, const std::string& qname, const std::string& ordername, bool auth);
   void alsoNotifies(const string &domain, set<string> *ips);
--- pdns-3.3/pdns/backends/gsql/gsqlbackend.cc	2013-05-17 08:05:20.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/backends/gsql/gsqlbackend.cc	2013-07-12 09:04:49.419816553 -0500
@@ -281,6 +281,7 @@
   d_ZoneLastChangeQuery=getArg("zone-lastchange-query");
   d_InfoOfAllMasterDomainsQuery=getArg("info-all-master-query");
   d_DeleteZoneQuery=getArg("delete-zone-query");
+  d_FinalizeAXFRQuery=getArg("finalize-axfr-query");
   d_DeleteRRSet=getArg("delete-rrset-query");
   d_getAllDomainsQuery=getArg("get-all-domains-query");
 
@@ -971,10 +972,16 @@
   return true;
 }
 
-bool GSQLBackend::commitTransaction()
+bool GSQLBackend::commitTransaction(int domain_id)
 {
+  char output[1024];
+  if(domain_id >= 0)
+    snprintf(output,sizeof(output)-1,d_FinalizeAXFRQuery.c_str(),domain_id);
   try {
-    d_db->doCommand("commit");
+    if(domain_id >= 0)
+     d_db->doCommand(output);
+    else
+     d_db->doCommand("commit");
   }
   catch (SSqlException &e) {
     throw AhuException("Database failed to commit transaction: "+e.txtReason());
--- pdns-3.3/pdns/backends/gsql/gsqlbackend.hh	2013-05-16 07:55:13.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/pdns/backends/gsql/gsqlbackend.hh	2013-07-12 09:04:20.818867141 -0500
@@ -30,7 +30,7 @@
   bool isMaster(const string &domain, const string &ip);
   void alsoNotifies(const string &domain, set<string> *ips);
   bool startTransaction(const string &domain, int domain_id=-1);
-  bool commitTransaction();
+  bool commitTransaction(int domain_id=-1);
   bool abortTransaction();
   bool feedRecord(const DNSResourceRecord &r, string *ordername=0);
   bool feedEnts(int domain_id, set<string>& nonterm);
@@ -95,6 +95,7 @@
   string d_UpdateLastCheckofZoneQuery;
   string d_InfoOfAllMasterDomainsQuery;
   string d_DeleteZoneQuery;		
+  string d_FinalizeAXFRQuery;		
   string d_DeleteRRSet;
   string d_ZoneLastChangeQuery;
   
--- pdns-3.3/modules/gsqlite3backend/gsqlite3backend.cc	2013-05-16 07:55:13.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/gsqlite3backend/gsqlite3backend.cc	2013-07-12 09:00:26.725818490 -0500
@@ -99,27 +99,28 @@
     declare(suffix,"nullify-ordername-and-auth-query", "DNSSEC nullify ordername and auth query", "update records set ordername=NULL,auth=0 where name='%s' and type='%s' and domain_id='%d'");
     declare(suffix,"set-auth-on-ds-record-query", "DNSSEC set auth on a DS record", "update records set auth=1 where domain_id='%d' and name='%s' and type='DS'");
     
-    declare( suffix, "master-zone-query", "Data", "select master from domains where name='%s' and type='SLAVE'");
+    declare(suffix, "master-zone-query", "Data", "select master from domains where name='%s' and type='SLAVE'");
 
-    declare( suffix, "info-zone-query", "","select id,name,master,last_check,notified_serial,type from domains where name='%s'");
+    declare(suffix, "info-zone-query", "","select id,name,master,last_check,notified_serial,type from domains where name='%s'");
 
-    declare( suffix, "info-all-slaves-query", "","select id,name,master,last_check,type from domains where type='SLAVE'");
-    declare( suffix, "supermaster-query", "", "select account from supermasters where ip='%s' and nameserver='%s'");
-    declare( suffix, "insert-slave-query", "", "insert into domains (type,name,master,account) values('SLAVE','%s','%s','%s')");
-
-    declare( suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,name) values ('%s',%d,%d,'%s',%d,'%s')");
-    declare( suffix, "insert-record-query-auth", "", "insert into records (content,ttl,prio,type,domain_id,name,auth) values ('%s',%d,%d,'%s',%d,'%s',%d)");
-    declare( suffix, "insert-record-order-query-auth","", "insert into records (content,ttl,prio,type,domain_id,name,ordername,auth) values ('%s',%d,%d,'%s',%d,'%s','%s','%d')");
-    declare( suffix, "insert-ent-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,name) values (null,'%d','%s')");
-    declare( suffix, "insert-ent-query-auth", "insert empty non-terminal in zone", "insert into records (type,domain_id,name,auth) values (null,'%d','%s','1')");
-    declare( suffix, "insert-ent-order-query-auth", "insert empty non-terminal in zone", "insert into records (type,domain_id,name,ordername,auth) values (null,'%d','%s','%s','1')");
-
-    declare( suffix, "update-serial-query", "", "update domains set notified_serial=%d where id=%d");
-    declare( suffix, "update-lastcheck-query", "", "update domains set last_check=%d where id=%d");
-    declare (suffix, "zone-lastchange-query", "", "select max(change_date) from records where domain_id=%d");
-    declare( suffix, "info-all-master-query", "", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
-    declare( suffix, "delete-zone-query", "", "delete from records where domain_id=%d");
-    declare( suffix, "delete-rrset-query", "", "delete from records where domain_id = %d and name='%s' and type='%s'");
+    declare(suffix, "info-all-slaves-query", "","select id,name,master,last_check,type from domains where type='SLAVE'");
+    declare(suffix, "supermaster-query", "", "select account from supermasters where ip='%s' and nameserver='%s'");
+    declare(suffix, "insert-slave-query", "", "insert into domains (type,name,master,account) values('SLAVE','%s','%s','%s')");
+
+    declare(suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,name) values ('%s',%d,%d,'%s',%d,'%s')");
+    declare(suffix, "insert-record-query-auth", "", "insert into records (content,ttl,prio,type,domain_id,name,auth) values ('%s',%d,%d,'%s',%d,'%s',%d)");
+    declare(suffix, "insert-record-order-query-auth","", "insert into records (content,ttl,prio,type,domain_id,name,ordername,auth) values ('%s',%d,%d,'%s',%d,'%s','%s','%d')");
+    declare(suffix, "insert-ent-query", "insert empty non-terminal in zone", "insert into records (type,domain_id,name) values (null,'%d','%s')");
+    declare(suffix, "insert-ent-query-auth", "insert empty non-terminal in zone", "insert into records (type,domain_id,name,auth) values (null,'%d','%s','1')");
+    declare(suffix, "insert-ent-order-query-auth", "insert empty non-terminal in zone", "insert into records (type,domain_id,name,ordername,auth) values (null,'%d','%s','%s','1')");
+
+    declare(suffix, "update-serial-query", "", "update domains set notified_serial=%d where id=%d");
+    declare(suffix, "update-lastcheck-query", "", "update domains set last_check=%d where id=%d");
+    declare(suffix, "zone-lastchange-query", "", "select max(change_date) from records where domain_id=%d");
+    declare(suffix, "info-all-master-query", "", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
+    declare(suffix, "delete-zone-query", "", "delete from records where domain_id=%d");
+    declare(suffix, "finalize-axfr-query", "", "commit");
+    declare(suffix, "delete-rrset-query", "", "delete from records where domain_id = %d and name='%s' and type='%s'");
     declare(suffix, "dnssec", "Assume DNSSEC Schema is in place","no");
 
     declare(suffix,"add-domain-key-query","", "insert into cryptokeys (domain_id, flags, active, content) select id, %d, %d, '%s' from domains where name='%s'");
--- pdns-3.3/modules/oraclebackend/oraclebackend.cc	2013-06-18 04:39:55.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/oraclebackend/oraclebackend.cc	2013-07-11 16:15:02.048818590 -0500
@@ -1077,7 +1077,7 @@
 }
 
 bool
-OracleBackend::commitTransaction ()
+OracleBackend::commitTransaction (int zoneId)
 {
   sword rc;
   OCIStmt *stmt;
@@ -1330,14 +1330,14 @@
 {
   if(!d_dnssecQueries)
     return -1;
+  DomainInfo di;
+  if (getDomainInfo(name, di) == false) return false;
 
   sword rc;
   OCIStmt *stmt;
 
   stmt = prepare_query(pooledSvcCtx, getTSIGKeyQuerySQL, getTSIGKeyQueryKey);
-  string_to_cbuf(mQueryName, name, sizeof(mQueryName));
   bind_str(stmt, ":name", mQueryName, sizeof(mQueryName));
-
   define_output_str(stmt, 1, &mResultTypeInd, mResultType, sizeof(mResultType));
   define_output_str(stmt, 2, &mResultContentInd, mResultContent, sizeof(mResultContent));
 
--- pdns-3.3/modules/oraclebackend/oraclebackend.hh	2013-05-17 06:05:27.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/oraclebackend/oraclebackend.hh	2013-07-11 16:14:45.277912311 -0500
@@ -70,7 +70,8 @@
   bool list(const string &domain, int zoneId);
   bool startTransaction(const string &domain, int zoneId);
   bool feedRecord(const DNSResourceRecord &rr);
-  bool commitTransaction();
+  bool commitTransaction(int zoneId);
+  bool feedRecord(const DNSResourceRecord &rr);
   bool abortTransaction();
   bool superMasterBackend(const string &ip, const string &domain,
                           const vector<DNSResourceRecord> &nsset,
@@ -107,6 +108,7 @@
   string zoneMastersQuerySQL;
   string isZoneMasterQuerySQL;
   string deleteZoneQuerySQL;
+  string commitZoneAXFRQuerySQL;
   string zoneSetLastCheckQuerySQL;
 
   string insertRecordQuerySQL;
--- pdns-3.3/modules/godbcbackend/godbcbackend.cc	2013-04-26 14:54:34.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/godbcbackend/godbcbackend.cc	2013-07-12 09:00:46.322818580 -0500
@@ -73,6 +73,7 @@
     declare( suffix, "update-lastcheck-query", "", "update domains set last_check=%d where id=%d");
     declare( suffix, "info-all-master-query", "", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare( suffix, "delete-zone-query", "", "delete from records where domain_id=%d");
+    declare( suffix, "finalize-axfr-query", "", "commit");
   }
   
   //! Constructs a new gODBCBackend object.
--- pdns-3.3/modules/gmysqlbackend/gmysqlbackend.cc	2013-05-16 07:55:13.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/gmysqlbackend/gmysqlbackend.cc	2013-07-12 09:01:03.093850160 -0500
@@ -109,6 +109,7 @@
     declare(suffix,"zone-lastchange-query", "", "select max(change_date) from records where domain_id=%d");
     declare(suffix,"info-all-master-query","", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=%d");
+    declare(suffix, "finalize-axfr-query", "", "commit");
     declare(suffix,"delete-rrset-query","","delete from records where domain_id=%d and name='%s' and type='%s'");
     declare(suffix,"add-domain-key-query","", "insert into cryptokeys (domain_id, flags, active, content) select id, %d, %d, '%s' from domains where name='%s'");
     declare(suffix,"list-domain-keys-query","", "select cryptokeys.id, flags, active, content from domains, cryptokeys where cryptokeys.domain_id=domains.id and name='%s'");
--- pdns-3.3/modules/goraclebackend/goraclebackend.cc	2013-05-16 08:25:08.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/goraclebackend/goraclebackend.cc	2013-07-12 09:01:23.283878100 -0500
@@ -109,6 +109,7 @@
     declare(suffix,"zone-lastchange-query", "", "select max(change_date) from records where domain_id=%d");
     declare(suffix,"info-all-master-query","", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=%d");
+    declare(suffix, "finalize-axfr-query", "", "commit");
     declare(suffix,"delete-rrset-query","","delete from records where domain_id=%d and name='%s' and type='%s'");
     declare(suffix,"add-domain-key-query","", "insert into cryptokeys (id, domain_id, flags, active, content) select cryptokeys_id_sequence.nextval, id, %d, %d, '%s' from domains where name='%s'");
     declare(suffix,"list-domain-keys-query","", "select cryptokeys.id, flags, active, content from domains, cryptokeys where cryptokeys.domain_id=domains.id and name='%s'");
--- pdns-3.3/modules/luabackend/luabackend.hh	2013-04-26 14:54:34.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/luabackend/luabackend.hh	2013-07-11 16:16:33.516839944 -0500
@@ -54,7 +54,7 @@
     void setFresh(int id);
 
     bool startTransaction(const string &qname, int id);
-    bool commitTransaction();
+    bool commitTransaction(int id);
     bool abortTransaction();
     bool feedRecord(const DNSResourceRecord &rr);
 
--- pdns-3.3/modules/luabackend/slave.cc	2013-04-26 14:54:34.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/luabackend/slave.cc	2013-07-11 16:15:36.552816887 -0500
@@ -69,7 +69,7 @@
     return ok;
 }
 
-bool LUABackend::commitTransaction() {
+bool LUABackend::commitTransaction(int id) {
 
     if (f_lua_committransaction == 0)
         return false;
--- pdns-3.3/modules/opendbxbackend/odbxbackend.cc	2013-04-26 14:54:34.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/opendbxbackend/odbxbackend.cc	2013-07-11 16:17:51.159816500 -0500
@@ -732,7 +732,7 @@
 
 
 
-bool OdbxBackend::commitTransaction()
+bool OdbxBackend::commitTransaction( int zoneid )
 {
         try
         {
--- pdns-3.3/modules/opendbxbackend/odbxbackend.hh	2013-04-26 14:54:34.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/opendbxbackend/odbxbackend.hh	2013-07-11 16:17:31.950849918 -0500
@@ -81,7 +81,7 @@
         bool get( DNSResourceRecord& rr );
 
         bool startTransaction( const string& domain, int domain_id );
-        bool commitTransaction();
+        bool commitTransaction( int domain_id );
         bool abortTransaction();
 
         bool isMaster( const string& domain, const string& ip );
--- pdns-3.3/modules/gpgsqlbackend/gpgsqlbackend.cc	2013-05-16 07:55:13.000000000 -0500
+++ pdns-3.3-FINALIZEAXFR/modules/gpgsqlbackend/gpgsqlbackend.cc	2013-07-12 09:01:44.645815447 -0500
@@ -110,6 +110,7 @@
     declare(suffix,"zone-lastchange-query", "", "select max(change_date) from records where domain_id=%d");
     declare(suffix,"info-all-master-query","", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
     declare(suffix,"delete-zone-query","", "delete from records where domain_id=%d");
+    declare(suffix, "finalize-axfr-query", "", "commit");
     declare(suffix,"delete-rrset-query","","delete from records where domain_id=%d and name=E'%s' and type=E'%s'");
 
     declare(suffix,"add-domain-key-query","", "insert into cryptokeys (domain_id, flags, active, content) select id, %d, (%d = 1), '%s' from domains where name=E'%s'");


More information about the Pdns-users mailing list