#define DEBUGLOG(msg) do {} while(0)
#endif
+int LMDBBackend::s_reloadcount=0;
pthread_mutex_t LMDBBackend::s_initlock = PTHREAD_MUTEX_INITIALIZER;
LMDBBackend::LMDBBackend(const string &suffix)
catch (ArgException e) {
d_doDnssec = false;
}
+ d_lastreload = s_reloadcount;
open_db();
}
}
void LMDBBackend::reload() {
+ ++s_reloadcount;
+}
+
+void LMDBBackend::needReload() {
+ if (s_reloadcount > d_lastreload) {
+ d_lastreload = s_reloadcount;
close_db();
open_db();
+ }
}
bool LMDBBackend::getDomainMetadata(const string& name, const std::string& kind, std::vector<std::string>& meta)
if (!d_doDnssec)
return false;
+ needReload();
+
if (kind == "PRESIGNED" || kind == "NSEC3PARAM") {
int rc;
MDB_val key, data;
if (!d_doDnssec)
return false;
+ needReload();
+
MDB_val key, data;
string key_str, cur_key, cur_value;
vector<string> keyparts, valparts;
if (!d_doDnssec)
return false;
+ needReload();
+
int rc;
MDB_val key, data;
string key_str, cur_value;
// Get the zone name of the requested zone (labelReversed) OR the name of the closest parrent zone
bool LMDBBackend::getAuthZone( string &rev_zone )
{
+ needReload();
+
MDB_val key, data;
// XXX can do this just using char *
bool LMDBBackend::getAuthData( SOAData &soa, DNSPacket *p )
{
+ needReload();
+
MDB_val key, value;
if( mdb_cursor_get(zone_cursor, &key, &value, MDB_GET_CURRENT) )
return false;
{
DEBUGLOG("lookup: " <<inQdomain << " " << type.getName() << endl);
+ needReload();
+
d_first = true;
d_origdomain = inQdomain;
d_curqtype = type;
// d_querykey with some additional bits potentially tacked on to make searching faster
string d_searchkey;
+ // d_lastreload last time the db was reloaded
+ int d_lastreload;
+
void open_db();
void close_db();
+ void needReload();
inline bool get_finished();
+ static int s_reloadcount;
static pthread_mutex_t s_initlock;
public: