From 415a97ce57b09e5a01c1d4666cce1b28ddb82789 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Fri, 14 Feb 2025 11:50:40 +0100 Subject: [PATCH] If deleteZone fails due to a backend exception, show it... ...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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 3a35755fd051..47cd9801b635 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -955,8 +955,8 @@ static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk) auto rrs = vector{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; }