]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
If deleteZone fails due to a backend exception, show it... 15160/head
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 14 Feb 2025 10:50:40 +0000 (11:50 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 14 Feb 2025 10:50:40 +0000 (11:50 +0100)
...rather than any further backend exception caused by
abortTransaction(), which will be much less helpful.

Using the sqlite backend on a full filesystem, pdnsutil delete-zone now
correctly reports "database or disk is full" instead of "cannot rollback
- no transaction is active" which no human can make sense of in this
situation.

pdns/pdnsutil.cc

index 3a35755fd0518e06114d5719895928121a9b34ab..47cd9801b635cabc4b8caf6e2c03e1bb9082fab6 100644 (file)
@@ -955,8 +955,8 @@ static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk)
 
   auto rrs = vector<DNSResourceRecord>{rr};
   if (!sd.db->replaceRRSet(sd.domain_id, zone, rr.qtype, rrs)) {
-    sd.db->abortTransaction();
     cerr << "Backend did not replace SOA record. Backend might not support this operation." << endl;
+    sd.db->abortTransaction();
     return -1;
   }
 
@@ -997,7 +997,13 @@ static int deleteZone(const DNSName &zone) {
       return EXIT_SUCCESS;
     }
   } catch (...) {
-    di.backend->abortTransaction();
+    try {
+      di.backend->abortTransaction();
+    } catch (...) {
+      // Ignore this exception (which is likely "cannot rollback - no
+      // transaction is active"), we have a more important one we want to
+      // rethrow.
+    }
     throw;
   }