@@ -1,44 +1,34 @@
---- pdns/pdns.in.old 2012-03-09 18:56:55.000000000 +0100
-+++ pdns/pdns.in 2012-03-17 18:40:47.688025622 +0100
-@@ -1,20 +1,23 @@
- #!/bin/sh
--# chkconfig: - 80 75
--# description: PDNS is a versatile high performance authoritative nameserver
-+#
-+# powerdns This shell script takes care of starting and stopping powerdns.
-+#
-+# chkconfig: 345 80 75
-+# description: PowerDNS is a versatile high performance \
-+# authoritative nameserver
-+# probe: true
-+# processname: powerdns
-+# pidfile: /var/run/powerdns/powerdns.pid
-+# config: /etc/powerdns/pdns.conf
+--- pdns/pdns.in.orig 2013-01-07 11:29:06.301972809 +0100
++++ pdns/pdns.in 2013-01-07 12:00:16.217749159 +0100
+@@ -2,17 +2,16 @@
+ # chkconfig: - 80 75
+ # description: PDNS is a versatile high performance authoritative nameserver
-### BEGIN INIT INFO
-# Provides: pdns
-# Required-Start: $remote_fs $network $syslog
-# Required-Stop: $remote_fs $network $syslog
-# Should-Start: $all
--# Should-Stop: $all
+-# Should-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Start/stop PowerDNS authoritative server
-# Description: Start/stop PowerDNS authoritative server
-### END INIT INFO
-+# Source function library.
-+. /etc/rc.d/init.d/functions
++#
++# powerdns This shell script takes care of starting and stopping powerdns.
++#
++# chkconfig: 345 80 75
++# description: PowerDNS is a versatile high performance \
++# authoritative nameserver
++# probe: true
++# processname: powerdns
++# pidfile: /var/run/powerdns/powerdns.pid
++# config: /etc/powerdns/pdns.conf
+
+ set -e
--set -e
-+# Source networking configuration.
-+. /etc/sysconfig/network
-+
-+# Check that networking is up.
-+[ "${NETWORKING}" = "no" ] && exit 0
-
- prefix=@prefix@
- exec_prefix=@exec_prefix@
-@@ -28,11 +31,13 @@
+@@ -28,11 +27,13 @@
cd $SOCKETPATH
suffix=$(basename $0 | cut -d- -f2- -s)
@@ -53,7 +43,7 @@
PROGNAME=pdns
fi
-@@ -62,6 +67,7 @@
+@@ -63,6 +64,7 @@
if test "$NOTRUNNING" = "0"
then
doPC quit
@@ -61,7 +51,7 @@
echo $ret
else
echo "not running"
-@@ -72,6 +78,7 @@
+@@ -73,6 +75,7 @@
force-stop)
echo -n "Stopping PowerDNS authoritative nameserver: "
killall -v -9 pdns_server
@@ -69,11 +59,11 @@
echo "killed"
;;
-@@ -83,6 +90,7 @@
+@@ -84,6 +87,7 @@
else
if $pdns_server --daemon --guardian=yes
then
+ touch /var/lock/subsys/pdns
echo "started"
- fi
- fi
+ else
+ echo "starting failed"
|
@@ -1,150 +1,9 @@
-Index: pdns/backends/gsql/gsqlbackend.cc
-===================================================================
---- pdns/backends/gsql/gsqlbackend.cc (.../trunk/pdns-3.1-rc2) (revision 8)
-+++ pdns/backends/gsql/gsqlbackend.cc (.../branches/pdns-3.1-rc2-slavedb) (revision 8)
-@@ -78,7 +78,7 @@
- d_MasterOfDomainsZoneQuery.c_str(),
- sqlEscape(domain).c_str());
- try {
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
-@@ -111,7 +111,7 @@
- snprintf(output,sizeof(output)-1,d_InfoOfDomainsZoneQuery.c_str(),
- sqlEscape(domain).c_str());
- try {
-- d_db->doQuery(output,d_result);
-+ getDBReadonly()->doQuery(output,d_result);
- }
- catch(SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve information about a domain: "+e.txtReason());
-@@ -156,7 +156,7 @@
- /* list all domains that need refreshing for which we are slave, and insert into SlaveDomain:
- id,name,master IP,serial */
- try {
-- d_db->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
-+ getDBReadonly()->doQuery(d_InfoOfAllSlaveDomainsQuery, d_result);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve list of slave domains: "+e.txtReason());
-@@ -192,7 +192,7 @@
- /* list all domains that need notifications for which we are master, and insert into updatedDomains
- id,name,master IP,serial */
- try {
-- d_db->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
-+ getDBReadonly()->doQuery(d_InfoOfAllMasterDomainsQuery,d_result);
- }
- catch(SSqlException &e) {
- throw AhuException("GSQLBackend unable to retrieve list of master domains: "+e.txtReason());
-@@ -243,6 +243,7 @@
- {
- setArgPrefix(mode+suffix);
- d_db=0;
-+ d_db_slave=NULL;
- d_logprefix="["+mode+"Backend"+suffix+"] ";
-
- try
-@@ -529,7 +530,7 @@
- snprintf(output,sizeof(output)-1,d_GetDomainMetadataQuery.c_str(), sqlEscape(name).c_str(), sqlEscape(kind).c_str());
-
- try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to list metadata: "+e.txtReason());
-@@ -619,7 +620,7 @@
- DLOG(L<< "Query: '" << output << "'"<<endl);
-
- try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
- }
- catch(SSqlException &e) {
- throw AhuException(e.txtReason());
-@@ -637,7 +638,7 @@
- char output[1024];
- snprintf(output,sizeof(output)-1,d_listQuery.c_str(),domain_id);
- try {
-- d_db->doQuery(output);
-+ getDBReadonly()->doQuery(output);
- }
- catch(SSqlException &e) {
- throw AhuException("GSQLBackend list query: "+e.txtReason());
-@@ -657,7 +658,7 @@
- for(vector<DNSResourceRecord>::const_iterator i=nsset.begin();i!=nsset.end();++i) {
- try {
- snprintf(output,sizeof(output)-1,format.c_str(),sqlEscape(ip).c_str(),sqlEscape(i->content).c_str());
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
- }
- catch (SSqlException &e) {
- throw AhuException("GSQLBackend unable to search for a domain: "+e.txtReason());
-@@ -734,7 +735,7 @@
- {
- // L << "GSQLBackend get() was called for "<<qtype.getName() << " record: ";
- SSql::row_t row;
-- if(d_db->getRow(row)) {
-+ if(getDBReadonly()->getRow(row)) {
- r.content=row[0];
- if (row[1].empty())
- r.ttl = ::arg().asNum( "default-ttl" );
-@@ -831,7 +832,7 @@
- sd.domain_id);
-
- try {
-- d_db->doQuery(output, d_result);
-+ getDBReadonly()->doQuery(output, d_result);
- }
- catch (const SSqlException& e) {
- //DLOG(L<<"GSQLBackend unable to calculate SOA serial: " << e.txtReason()<<endl);
-Index: pdns/backends/gsql/gsqlbackend.hh
-===================================================================
---- pdns/backends/gsql/gsqlbackend.hh (.../trunk/pdns-3.1-rc2) (revision 8)
-+++ pdns/backends/gsql/gsqlbackend.hh (.../branches/pdns-3.1-rc2-slavedb) (revision 8)
-@@ -15,12 +15,24 @@
- {
- if(d_db)
- delete d_db;
-+ if(d_db_slave)
-+ delete d_db_slave;
- }
-
- void setDB(SSql *db)
- {
- d_db=db;
- }
-+
-+ void setDBReadonly(SSql *db)
-+ {
-+ d_db_slave=db;
-+ }
-+
-+ SSql *getDBReadonly()
-+ {
-+ return d_db_slave != NULL ? d_db_slave : d_db;
-+ }
-
- virtual string sqlEscape(const string &name);
- void lookup(const QType &, const string &qdomain, DNSPacket *p=0, int zoneId=-1);
-@@ -62,6 +74,7 @@
- QType d_qtype;
- int d_count;
- SSql *d_db;
-+ SSql *d_db_slave;
- SSql::result_t d_result;
-
- string d_wildCardNoIDQuery;
-Index: modules/gmysqlbackend/gmysqlbackend.cc
-===================================================================
---- modules/gmysqlbackend/gmysqlbackend.cc (.../trunk/pdns-3.1-rc2) (revision 8)
-+++ modules/gmysqlbackend/gmysqlbackend.cc (.../branches/pdns-3.1-rc2-slavedb) (revision 8)
-@@ -35,6 +35,24 @@
+--- modules/gmysqlbackend/gmysqlbackend.cc.orig 2013-01-07 11:29:06.321972721 +0100
++++ modules/gmysqlbackend/gmysqlbackend.cc 2013-01-07 12:04:56.456515547 +0100
+@@ -31,6 +31,24 @@
throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
}
- L<<Logger::Warning<<mode<<" Connection successful"<<endl;
+ L<<Logger::Info<<mode<<" Connection successful"<<endl;
+
+ if(!getArg("slave-socket").empty() || !getArg("slave-host").empty()) {
+ try {
@@ -166,8 +25,8 @@
}
class gMySQLFactory : public BackendFactory
-@@ -52,6 +70,13 @@
- declare(suffix,"password","Pdns backend password to connect with","");
+@@ -49,6 +67,13 @@
+ declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client");
declare(suffix,"dnssec","Assume DNSSEC Schema is in place","no");
+ declare(suffix,"slave-dbname","Pdns backend database name to connect to","");
|