Re: [Pdns-users] Problem with stored procedure pdns 4.1.6-3

2020-08-28 Thread Xan Charbonnet via Pdns-users

Hello Peter,

On 8/27/20 2:19 PM, Peter van Dijk via Pdns-users wrote:

? It would be great if you could include the definition of a stored
procedure that works with our default schema, and the pdns.conf query
override to use that procedure. Thanks!


I've put some detailed steps-to-reproduce in this bug:
https://github.com/PowerDNS/pdns/issues/9421

I think it can be duplicated by converting any query into a stored 
procedure, as I did with the basic query in my example.

___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Problem with stored procedure pdns 4.1.6-3

2020-08-27 Thread Peter van Dijk via Pdns-users
Hello Xan,

On Wed, 2020-08-26 at 11:29 -0500, Xan Charbonnet via Pdns-users wrote:
> When I move from MariaDB 10.1 to MariaDB 10.2 (or greater), all three 
> pdns versions fail with the "Prepared statement contains no metadata" 
> error.  Masood's experience leads me to believe that the same breakage 
> happened between MySQL 5.6 and 5.7.

Thank you for figuring out the 'what changed?' part of this. Can you
please file an issue at 
https://github.com/PowerDNS/pdns/issues/new?assignees===bug_report.md=
? It would be great if you could include the definition of a stored
procedure that works with our default schema, and the pdns.conf query
override to use that procedure. Thanks!

Kind regards,
-- 
Peter van Dijk
PowerDNS.COM BV - https://www.powerdns.com/

___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Problem with stored procedure pdns 4.1.6-3

2020-08-26 Thread Xan Charbonnet via Pdns-users
Apologies for the out-of-context post: I was attempting to respond to 
this message:

https://mailman.powerdns.com/pipermail/pdns-users/2020-July/026762.html
and clearly I messed up!
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Problem with stored procedure pdns 4.1.6-3

2020-08-26 Thread Xan Charbonnet via Pdns-users
I believe I am having the same problem as you, Masood.  It seems to not 
be related to the PowerDNS version but rather to the version of MySQL.


Using stored procedures with the pdns MySQL backend works fine for me on 
Debian Stretch with MariaDB 10.1 on pdns versions 4.0.3, 4.1.6, and 4.3.0.


I should note that the Debian version of 4.0.3 contains a backported fix 
for dealing with stored procedures, which is native in 4.1.6 and 4.3.0: 
https://github.com/Habbie/pdns/commit/d64a77e368495132d92833f4ab2bc91b647d2beb
Without this fix, 4.0.3 wouldn't be able to deal with stored procedures 
at all.  I believe that Masood is also using this Debian version of 4.0.3.


The other two versions, 4.1.6 and 4.3.0, I compiled myself on Stretch 
(oldstable) from sources in Debian Buster (stable) and Debian Bullseye 
(testing), respectively.


When I move from MariaDB 10.1 to MariaDB 10.2 (or greater), all three 
pdns versions fail with the "Prepared statement contains no metadata" 
error.  Masood's experience leads me to believe that the same breakage 
happened between MySQL 5.6 and 5.7.



There are two places in smysql.cc where the same error, "Could not bind 
parameters to mysql statement", can be thrown.  I have found that in 
this case, it's the second one (the one near the comment "For some 
reason mysql_stmt_result_metadata returns NULL here") which is causing 
the problem.


I'm afraid I don't know enough about MySQL development in C++ to know 
what to do here.  Can anyone shine any light?


This is the relevant code (pardon the word wrapping):

#if MYSQL_VERSION_ID >= 50500
 if (d_residx >= d_resnum) {
   mysql_stmt_free_result(d_stmt);
   while(!mysql_stmt_next_result(d_stmt)) {
 if ((err = mysql_stmt_store_result(d_stmt))) {
   string error(mysql_stmt_error(d_stmt));
   releaseStatement();
   throw SSqlException("Could not store mysql statement while 
processing additional sets: " + d_query + string(": ") + error);

 }
 d_resnum = mysql_stmt_num_rows(d_stmt);
 // XXX: For some reason mysql_stmt_result_metadata returns 
NULL here, so we cannot

 // ensure row field count matches first result set.
 if (d_resnum > 0) { // ignore empty result set
   if (d_res_bind != nullptr && (err = 
mysql_stmt_bind_result(d_stmt, d_res_bind))) {

 string error(mysql_stmt_error(d_stmt));
 releaseStatement();
 throw SSqlException("Could not bind parameters to mysql 
statement: " + d_query + string(": ") + error);

   }
   d_residx = 0;
   break;
 }
 mysql_stmt_free_result(d_stmt);
   }
 }
#endif
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


[Pdns-users] Problem with stored procedure pdns 4.1.6-3

2020-07-06 Thread Masood Rahim via Pdns-users
I am using Debian Buster and trying to call a mysql stored procedure via:
gmysql-any-id-query=call getdns(?,?)

The stored procedure works fine on pdns 4.0.3-1 on Debian Stretch. When
calling the stored procedure via the mysql console it returns the same
results on both Buster and Stretch.

On Buster I'm seeing the following in the logs:

Jul  6 07:01:46 ns pdns_server[25975]: Query: SELECT
content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE
disabled=0 and type=? and name=?
Jul  6 07:01:46 ns pdns_server[25975]: Query: SELECT
content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE
disabled=0 and type=? and name=?
Jul  6 07:01:46 ns pdns_server[25975]: Query: SELECT
content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE
disabled=0 and type=? and name=? and domain_id=?
Jul  6 07:01:46 ns pdns_server[25975]: Query: call getdns(?,?)
Jul  6 07:01:46 ns pdns_server[25975]: Query: call getdns(?,?)
Jul  6 07:01:46 ns pdns_server[25975]: Backend reported permanent error
which prevented lookup (GSQLBackend get: Could not bind parameters to mysql
statement: call getdns(?,?): Prepared statement contains no metadata),
aborting
Jul  6 07:01:46 ns pdns_server[25975]: Query: call getdns(?,?)
Jul  6 07:01:46 ns pdns_server[25975]: Backend reported permanent error
which prevented lookup (GSQLBackend get: Could not bind parameters to mysql
statement: call getdns(?,?): Prepared statement contains no metadata),
aborting
Jul  6 07:01:46 ns pdns_server[25975]: Backend error: GSQLBackend get:
Could not bind parameters to mysql statement: call getdns(?,?): Prepared
statement contains no metadata

On Buster I am using mysql 5.7.30 and on Stretch I am using mysql 5.6.30.
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users