Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should fix #1662, reloading while checking for domains that need to be n... #1673

Merged
merged 1 commit into from
Aug 19, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions modules/bindbackend/bindbackend2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,41 +290,43 @@ bool Bind2Backend::feedRecord(const DNSResourceRecord &r, string *ordername)

void Bind2Backend::getUpdatedMasters(vector<DomainInfo> *changedDomains)
{
vector<BB2DomainInfo> toPut;
vector<DomainInfo> consider;
{
ReadLock rl(&s_state_lock);
SOAData soadata;

for(state_t::const_iterator i = s_state.begin(); i != s_state.end() ; ++i) {
if(!i->d_masters.empty() && this->alsoNotify.empty() && i->d_also_notify.empty())
continue;
soadata.serial=0;
try {
this->getSOA(i->d_name, soadata); // we might not *have* a SOA yet, but this might trigger a load of it
}
catch(...){}

DomainInfo di;
di.id=i->d_id;
di.serial=soadata.serial;

di.zone=i->d_name;
di.last_check=i->d_lastcheck;
di.notified_serial = i->d_lastnotified;
di.backend=this;
di.kind=DomainInfo::Master;
if(!i->d_lastnotified) { // don't do notification storm on startup
// what if i->first is new??
BB2DomainInfo bbd;
if(safeGetBBDomainInfo(i->d_id, &bbd)) { // we hold a readlock, so this is fine
bbd.d_lastnotified=soadata.serial;
toPut.push_back(bbd); // but we can't write yet
}
consider.push_back(di);
}
else
if(soadata.serial != i->d_lastnotified)
changedDomains->push_back(di);
}
}
BOOST_FOREACH(BB2DomainInfo& bbd, toPut) {
safePutBBDomainInfo(bbd);

SOAData soadata;
BOOST_FOREACH(DomainInfo& di, consider) {
soadata.serial=0;
try {
this->getSOA(di.zone, soadata); // we might not *have* a SOA yet, but this might trigger a load of it
}
catch(...){}
BB2DomainInfo bbd;
if(safeGetBBDomainInfo(di.id, &bbd)) {
bbd.d_lastnotified=soadata.serial;
safePutBBDomainInfo(bbd);
}
di.serial=soadata.serial;
if(soadata.serial != di.notified_serial)
changedDomains->push_back(di);
}
}

Expand Down