pschiffe / docker-pdns

Docker images for PowerDNS
MIT License
274 stars 81 forks source link

thread died with error: virtual void GSQLBackend [...] Unknown column 'd.options' in 'field list' #97

Closed CptMinato closed 1 year ago

CptMinato commented 1 year ago

Hi, I updated the image today and also updated the mariadb version, basically adjusted it to your docker-compose.yml file. Unfortunately the master pdns container runs into an error:

Exiting because communicator thread died with error: virtual void GSQLBackend::getUpdatedMasters(std::vector<DomainInfo>&, std::unordered_set<DNSName>&, CatalogHashMap&) unable to retrieve list of master domains: Could not prepare statement: select d.id, d.name, d.type, d.notified_serial,d.options, d.catalog,r.content from records r join domains d on r.domain_id=d.id and r.name=d.name where r.type='SOA' and r.disabled=0 and d.type in ('MASTER', 'PRODUCER'): Unknown column 'd.options' in 'field list'

I don't fully understand the issue. I can see that in the table domains, the master column is empty:

mysql> select * from domains;
+----+--------------------------+--------+------------+--------+-----------------+----------------+
| id | name                     | master | last_check | type   | notified_serial | account        |
+----+--------------------------+--------+------------+--------+-----------------+----------------+
|  6 |  domain.tld              |        |       NULL | MASTER |      2023011502 |      username  |
|  7 | ip.in-addr.arpa          |        |       NULL | MASTER |      2022101202 |                |
+----+--------------------------+--------+------------+--------+-----------------+----------------+
7 rows in set (0.00 sec)

But I don't know if that's intended or not.

Do you have any idea what the issue might be and be able to help me out?

PS: Thank you for your work on this repo and all of the other projects you run.

CptMinato commented 1 year ago

I was able to fix it.


Through looking at the default schema for 4.7 here, I found in these upgrade notes:

Schema changes

The new Catalog Zones feature comes with a mandatory schema change for the gsql database backends. See files named 4.3.x_to_4.7.0_schema.X.sql for your database backend in our Git repo, tarball, or distro-specific documentation path. For the LMDB backend, please review lmdb-schema-version. The new LMDB schema version is 4.

Which now makes absolute sense that I receive the error, as it is obviously missing in my "old" database.

I found the necessary schema upgrades here:

ALTER TABLE domains ADD options VARCHAR(64000) DEFAULT NULL;
ALTER TABLE domains ADD catalog VARCHAR(255) DEFAULT NULL;
ALTER TABLE domains MODIFY type VARCHAR(8) NOT NULL;

CREATE INDEX catalog_idx ON domains(catalog);

I punched these into the database, recreated the container and now it works.

I wonder why the slave never had any issues. I created the columns there too, doesn't seem to have any kind of impact.


Maybe this helps somebody, if something unforeseen was to happen I would update the issue, but I think it can be closed.

pschiffe commented 1 year ago

Thank you for the investigation, the migration has been now included in the startup script.