[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r4078 - trunk/OpenDNSSEC/signer/src/signer

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Oct 11 16:28:51 CEST 2010


Author: matthijs
Date: 2010-10-11 16:28:51 +0200 (Mon, 11 Oct 2010)
New Revision: 4078

Modified:
   trunk/OpenDNSSEC/signer/src/signer/domain.c
   trunk/OpenDNSSEC/signer/src/signer/domain.h
   trunk/OpenDNSSEC/signer/src/signer/rrset.c
   trunk/OpenDNSSEC/signer/src/signer/rrset.h
   trunk/OpenDNSSEC/signer/src/signer/zone.c
   trunk/OpenDNSSEC/signer/src/signer/zonedata.c
   trunk/OpenDNSSEC/signer/src/signer/zonedata.h
Log:
cancel failed update




Modified: trunk/OpenDNSSEC/signer/src/signer/domain.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-10-11 14:28:51 UTC (rev 4078)
@@ -456,6 +456,31 @@
 
 
 /**
+ * Cancel update.
+ *
+ */
+void
+domain_cancel_update(domain_type* domain)
+{
+    ldns_rbnode_t* node = LDNS_RBTREE_NULL;
+    rrset_type* rrset = NULL;
+
+    se_log_assert(domain);
+    se_log_assert(domain->rrsets);
+
+    if (domain->rrsets->root != LDNS_RBTREE_NULL) {
+        node = ldns_rbtree_first(domain->rrsets);
+    }
+    while (node && node != LDNS_RBTREE_NULL) {
+        rrset = (rrset_type*) node->data;
+        rrset_cancel_update(rrset);
+        node = ldns_rbtree_next(node);
+    }
+    return;
+}
+
+
+/**
  * Update domain status.
  *
  */

Modified: trunk/OpenDNSSEC/signer/src/signer/domain.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/domain.h	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/domain.h	2010-10-11 14:28:51 UTC (rev 4078)
@@ -182,6 +182,13 @@
 int domain_update(domain_type* domain, uint32_t serial);
 
 /**
+ * Cancel update.
+ * \param[in] domain domain
+ *
+ */
+void domain_cancel_update(domain_type* domain);
+
+/**
  * Update domain status.
  * \param[in] domain domain
  *

Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-10-11 14:28:51 UTC (rev 4078)
@@ -346,6 +346,25 @@
     return 0;
 }
 
+/**
+ * Cancel update.
+ *
+ */
+void
+rrset_cancel_update(rrset_type* rrset)
+{
+    if (rrset->add) {
+        ldns_dnssec_rrs_deep_free(rrset->add);
+        rrset->add = NULL;
+        rrset->add_count = 0;
+    }
+    if (rrset->del) {
+        ldns_dnssec_rrs_deep_free(rrset->del);
+        rrset->del = NULL;
+        rrset->del_count = 0;
+    }
+    return;
+}
 
 /**
  * Return the number of RRs in RRset.

Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.h	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.h	2010-10-11 14:28:51 UTC (rev 4078)
@@ -83,7 +83,15 @@
  */
 int rrset_update(rrset_type* rrset, uint32_t serial);
 
+
 /**
+ * Cancel update.
+ * \param[in] rrset RRset
+ *
+ */
+void rrset_cancel_update(rrset_type* rrset);
+
+/**
  * Add RR to RRset.
  * \param[in] rrset RRset
  * \param[in] rr RR

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-10-11 14:28:51 UTC (rev 4078)
@@ -434,6 +434,7 @@
     if (error) {
         se_log_error("update zone %s failed: zone data contains errors",
             zone->name);
+        zonedata_cancel_update(zone->zonedata);
         return error;
     }
     return zonedata_update(zone->zonedata, zone->signconf);

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-10-11 14:28:51 UTC (rev 4078)
@@ -1096,10 +1096,7 @@
     error = zonedata_update_serial(zd, sc);
     if (error || !zd->internal_serial) {
         se_log_error("unable to update zonedata: failed to update serial");
-        /**
-         * If this happens, the next read task will error alot on duplicate
-         * pending rrs. Should be high unlikely to occur.
-         */
+        zonedata_cancel_update(zd);
         return 1;
     }
 
@@ -1109,8 +1106,9 @@
     while (node && node != LDNS_RBTREE_NULL) {
         domain = (domain_type*) node->data;
         if (domain_update(domain, zd->internal_serial) != 0) {
-            se_log_error("unable to update zonedata to serial %u: failed "
+            se_log_crit("unable to update zonedata to serial %u: failed "
                 "to update domain", zd->internal_serial);
+            /* If this happens, the zone is partially updated. */
             return 1;
         }
         node = ldns_rbtree_next(node);
@@ -1149,6 +1147,31 @@
 
 
 /**
+ * Cancel update.
+ *
+ */
+void
+zonedata_cancel_update(zonedata_type* zd)
+{
+    ldns_rbnode_t* node = LDNS_RBTREE_NULL;
+    domain_type* domain = NULL;
+
+    se_log_assert(zd);
+    se_log_assert(zd->domains);
+
+    if (zd->domains->root != LDNS_RBTREE_NULL) {
+        node = ldns_rbtree_first(zd->domains);
+    }
+    while (node && node != LDNS_RBTREE_NULL) {
+        domain = (domain_type*) node->data;
+        domain_cancel_update(domain);
+        node = ldns_rbtree_next(node);
+    }
+    return;
+}
+
+
+/**
  * Add RR to the zone data.
  *
  */

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.h
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.h	2010-10-11 14:28:06 UTC (rev 4077)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.h	2010-10-11 14:28:51 UTC (rev 4078)
@@ -163,6 +163,13 @@
 int zonedata_update(zonedata_type* zd, signconf_type* sc);
 
 /**
+ * Cancel update.
+ * \param[in] zd zone data
+ *
+ */
+void zonedata_cancel_update(zonedata_type* zd);
+
+/**
  * Add RR to zone data.
  * \param[in] zd zone data
  * \param[in] rr RR to add




More information about the Opendnssec-commits mailing list