Permalink
Browse files

Use transaction when updating serial

  • Loading branch information...
1 parent 6e82a23 commit 4a95ab4d7443d3b6c843049614f689560627a054 @cmouse cmouse committed with Habbie Oct 14, 2014
Showing with 5 additions and 0 deletions.
  1. +5 −0 pdns/pdnssec.cc
View
@@ -612,7 +612,10 @@ int increaseSerial(const string& zone, DNSSECKeeper &dk)
}
rrs[0].content = serializeSOAData(sd);
+ sd.db->startTransaction("", -1);
+
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;
return -1;
}
@@ -638,6 +641,8 @@ int increaseSerial(const string& zone, DNSSECKeeper &dk)
}
}
+ sd.db->commitTransaction();
+
cout<<"SOA serial for zone "<<zone<<" set to "<<sd.serial<<endl;
return 0;
}

0 comments on commit 4a95ab4

Please sign in to comment.