[Pdns-users] strange behaviour with gmysql & mydns backend

Andreas Danzer andreas at danzer.org
Tue Jan 21 11:47:18 UTC 2014


Hi Ruben,

thanks for your answer. Well, both databases have been built from the
SQL files in the source packages of MyDNS-NG and PowerDNS. The mydns
backend runs on MyISAM, powerdns on innodb.

Here's a dump of my test database for  powerdns (gmysql backend):

--
-- Database: `powerdns`
--

CREATE TABLE IF NOT EXISTS `cryptokeys` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `domain_id` int(11) NOT NULL,
  `flags` int(11) NOT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `content` text,
  PRIMARY KEY (`id`),
  KEY `domainidindex` (`domain_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `domainmetadata` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `domain_id` int(11) NOT NULL,
  `kind` varchar(16) DEFAULT NULL,
  `content` text,
  PRIMARY KEY (`id`),
  KEY `domainmetaidindex` (`domain_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `domains` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `master` varchar(128) DEFAULT NULL,
  `last_check` int(11) DEFAULT NULL,
  `type` varchar(6) NOT NULL,
  `notified_serial` int(11) DEFAULT NULL,
  `account` varchar(40) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name_index` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=50000007 ;

INSERT INTO `domains` (`id`, `name`, `master`, `last_check`, `type`,
`notified_serial`, `account`) VALUES
(50000005, 'test-zone-1.de', NULL, NULL, 'MASTER', NULL, NULL),

CREATE TABLE IF NOT EXISTS `records` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `domain_id` int(11) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `type` varchar(10) DEFAULT NULL,
  `content` mediumtext,
  `ttl` int(11) DEFAULT NULL,
  `prio` int(11) DEFAULT NULL,
  `change_date` int(11) DEFAULT NULL,
  `ordername` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `auth` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `nametype_index` (`name`,`type`),
  KEY `domain_id` (`domain_id`),
  KEY `recordorder` (`domain_id`,`ordername`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=50000045 ;

INSERT INTO `records` (`id`, `domain_id`, `name`, `type`, `content`,
`ttl`, `prio`, `change_date`, `ordername`, `auth`) VALUES
(50000032, 50000005, 'test-zone-1.de', 'SOA', 'dns1.xyzdns.de
hostmaster.xyz.de 2014012008 28800 7200 604800 3600', 86400, 0,
1390208823, NULL, NULL),
(50000036, 50000005, 'test-zone-1.de', 'NS', 'dns1.xyzdns.de', 86400, 0,
1390208815, NULL, NULL),
(50000042, 50000005, 'www.test-zone-1.de', 'A', '123.45.67.89', 86400,
0, 1390208815, NULL, NULL),
(50000043, 50000005, 'mail.test-zone-1.de', 'A', '123.45.67.89', 86400,
0, 1390208815, NULL, NULL),
(50000044, 50000005, 'test-zone-1.de', 'MX', 'mail.test-zone-1.de',
86400, 10, 1390208815, NULL, NULL);

CREATE TABLE IF NOT EXISTS `supermasters` (
  `ip` varchar(64) NOT NULL,
  `nameserver` varchar(255) NOT NULL,
  `account` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `tsigkeys` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `algorithm` varchar(50) DEFAULT NULL,
  `secret` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `namealgoindex` (`name`,`algorithm`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;




The mydns backend looks this way:



--
-- Database: `mydns`
--

-- --------------------------------------------------------

--
-- Table structure for table `rr`
--

CREATE TABLE IF NOT EXISTS `rr` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `zone` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(200) NOT NULL DEFAULT '',
  `type`
enum('A','AAAA','CNAME','HINFO','MX','NS','PTR','SRV','TXT','NAPTR')
DEFAULT NULL,
  `data` varchar(255) NOT NULL DEFAULT '',
  `aux` int(10) unsigned NOT NULL DEFAULT '0',
  `ttl` int(10) unsigned NOT NULL DEFAULT '86400',
  PRIMARY KEY (`id`),
  UNIQUE KEY `rr` (`zone`,`name`,`type`,`data`),
  KEY `zone` (`zone`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8078028 ;

INSERT INTO `rr` (`id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`) VALUES
(8077984, 7461072, '', 'NS', 'dns1.xyzdns.de.', 0, 3600),
(8078001, 7461072, 'www', 'A', '23.45.67.89', 0, 3600),
(8078002, 7461072, 'mail', 'A', '23.45.67.89', 0, 3600),
(8078015, 7461072, '', 'MX', 'mail.test-zone-2.de.', 10, 3600);


-- --------------------------------------------------------

--
-- Table structure for table `soa`
--

CREATE TABLE IF NOT EXISTS `soa` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `origin` varchar(200) NOT NULL DEFAULT '',
  `ns` varchar(255) NOT NULL DEFAULT '',
  `mbox` varchar(255) NOT NULL DEFAULT '',
  `serial` int(10) unsigned NOT NULL DEFAULT '1',
  `refresh` int(10) unsigned NOT NULL DEFAULT '28800',
  `retry` int(10) unsigned NOT NULL DEFAULT '7200',
  `expire` int(10) unsigned NOT NULL DEFAULT '604800',
  `minimum` int(10) unsigned NOT NULL DEFAULT '86400',
  `ttl` int(10) unsigned NOT NULL DEFAULT '86400',
  `active` enum('Y','N') NOT NULL DEFAULT 'Y',
  `xfer` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `origin` (`origin`),
  KEY `active` (`active`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7461074 ;

INSERT INTO `soa` (`id`, `origin`, `ns`, `mbox`, `serial`, `refresh`,
`retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES
(7461072, 'test-zone-2.de.', 'dns1.xyzdns.de.', 'hostmaster.xyz.de.',
2014012005, 28800, 7200, 604800, 3600, 3600, 'Y', NULL);



Both backends are started by:

[...]
launch=mydns,gmysql

mydns-rr-active=no
mydns-soa-active=no
mydns-use-minimal-ttl=no
mydns-dbname=mydns
mydns-user=mydns_usr
mydns-host=localhost
mydns-password=secret

gmysql-host=localhost
gmysql-user=pdns_usr
gmysql-dbname=powerdns
gmysql-password=secret
[...]


The order of the backends has no impact on the false behaviour of
powerdns. Mydns backend works flawless in any combination (standalone
and with gmysql). Gmysql backend work swithout problems only standalone.
As soon as I add the mydns backend, I get e.g. a timeout if I do a 'dig
@dns1.xyzdns.de A www.test-zone-1.de' (gmysql). SOA, ANY, NS work.
It looks like, the problem is somewhere in the generation of the SQL
statement for querying A records in the gmysql backend when subdomains
come into play. A dig for the non-existent A record for test-zone-1.de
delivers no timeout.

I hope the information is sufficient for you to replicate the issue.

Best regards,
Andreas



Am 17.01.2014 17:58, schrieb Ruben d'Arco:

> Hi,
> 
> I do not have the same setup, but i would not know why this should not work.
> 
> Would you mind sharing your database content so i can try to identify the issue and/or replicate the issue?
> 
> Regards,
> 	Ruben
> 
> 
> 
> On Fri, Jan 17, 2014 at 04:43:28PM +0100, Andreas Danzer wrote:
>> Hi,
>>
>> I'm running powerdns-server 3.3.1 with gmysql and mydns backend enabled
>> simultaneously (launch=gmysql,mydns). I'd like to setup new zones in the
>> gmysql backend, while my old zones stay in the mydns backend until I'm
>> able to transfer them to the native gmysql backend. Zones in the mydns
>> backend work without a problem. If I want to look up A records for zones
>> in the gmysql backend - SOA, NS, MX, ANY work - I get backend errors. It
>> looks like the query is getting the correct ZoneID but then fails.
>>
>> example:
>>
>> The zone danzer-test.de is in the gmysql-backend database. A "dig
>> @dns.mydns.de A www.danzer-test.de" results in following logfile entries:
>>
>> Query: select content,ttl,prio,type,domain_id,name from records where
>> type='SOA' and name='danzer-test.de'
>> Jan 17 16:36:41 1371476707-1 pdns[28287]: Query: select
>> content,ttl,prio,type,domain_id,name from records where type='NS' and
>> name='www.danzer-test.de' and domain_id=50000002
>> Jan 17 16:36:41 1371476707-1 pdns[28287]: Query: select origin, minimum
>> from soa where id = 50000002 and active = 1 and 1 = 1
>> Jan 17 16:36:41 1371476707-1 pdns[28287]: Backend reported permanent
>> error which prevented lookup (lookup() passed zoneId = 50000002 but no
>> such zone!) sending out servfail
>> Jan 17 16:36:41 1371476707-1 pdns[28287]: Backend error: lookup() passed
>> zoneId = 50000002 but no such zone!
>> Jan 17 16:36:45 1371476707-1 pdns[28287]: Engaging bypass - now
>> operating unthreaded
>>
>> A "dig @dns.mydns.de ANY danzer-test.de" works.
>>
>> If I disable the mydns backend, gmysql works without a problem.
>> Transfering the zone from the mydns backend to gmysql is not an option
>> at the moment as several systems depend on the old structure.
>>
>> Has anybody been able to get a similar setup to work without problems?
>> Is there a workaround?
>>
>> Best regards,
>> Andreas
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pdns-users mailing list
>> Pdns-users at mailman.powerdns.com
>> http://mailman.powerdns.com/mailman/listinfo/pdns-users
> 
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> http://mailman.powerdns.com/mailman/listinfo/pdns-users
> 





More information about the Pdns-users mailing list