## `gmysql-innodb-read-committed`
Use the InnoDB READ-COMMITTED transaction isolation level. Default=yes.
+## `gmysql-timeout`
+The timeout in seconds for each attempt to read from, or write to the server. A value of 0 will disable the timeout. Default: 10
+
# Default Schema
```
!!include=../modules/gmysqlbackend/schema.mysql.sql
getArg("user"),
getArg("password"),
getArg("group"),
- mustDo("innodb-read-committed")));
+ mustDo("innodb-read-committed"),
+ getArgAsNum("timeout")));
}
catch(SSqlException &e) {
declare(suffix,"password","Pdns backend password to connect with","");
declare(suffix,"group", "Pdns backend MySQL 'group' to connect as", "client");
declare(suffix,"innodb-read-committed","Use InnoDB READ-COMMITTED transaction isolation level","yes");
+ declare(suffix,"timeout", "The timeout in seconds for each attempt to read/write to the server", "10");
declare(suffix,"dnssec","Enable DNSSEC processing","no");
};
SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const string &msocket, const string &user,
- const string &password, const string &group, bool setIsolation)
+ const string &password, const string &group, bool setIsolation, unsigned int timeout)
{
int retry=1;
#endif
#if MYSQL_VERSION_ID >= 50100
- unsigned int timeout = 180;
- mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &timeout);
- mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &timeout);
+ if(timeout) {
+ mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &timeout);
+ mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &timeout);
+ }
#endif
#if MYSQL_VERSION_ID >= 50500
int err;
if((err=mysql_query(&d_db,query.c_str())))
- throw sPerrorException("Failed to execute mysql_query '" + query + "', perhaps connection died? Err="+itoa(err));
+ throw sPerrorException("Failed to execute mysql_query '" + query + "' Err="+itoa(err));
}
void SMySQL::startTransaction() {
SMySQL(const string &database, const string &host="", uint16_t port=0,
const string &msocket="",const string &user="",
const string &password="", const string &group="",
- bool setIsolation=false);
+ bool setIsolation=false, unsigned int timeout=10);
~SMySQL();