Commit 8c57956e authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1332] overall log updates

parent e84f2aa5
......@@ -1100,10 +1100,11 @@ private:
// A shortcut typedef to keep the code concise.
typedef DatabaseAccessor Accessor;
public:
DatabaseJournalReader(shared_ptr<Accessor> accessor, int zone_id,
const RRClass& rrclass, uint32_t begin,
DatabaseJournalReader(shared_ptr<Accessor> accessor, const Name& zone,
int zone_id, const RRClass& rrclass, uint32_t begin,
uint32_t end) :
accessor_(accessor), rrclass_(rrclass), finished_(false)
accessor_(accessor), zone_(zone), rrclass_(rrclass),
begin_(begin), end_(end), finished_(false)
{
context_ = accessor_->getDiffs(zone_id, begin, end);
}
......@@ -1118,6 +1119,10 @@ public:
string data[Accessor::COLUMN_COUNT];
if (!context_->getNext(data)) {
finished_ = true;
LOG_DEBUG(logger, DBG_TRACE_BASIC,
DATASRC_DATABASE_JOURNALREADER_END).
arg(zone_).arg(rrclass_).arg(accessor_->getDBName()).
arg(begin_).arg(end_);
return (ConstRRsetPtr());
}
......@@ -1128,9 +1133,15 @@ public:
RRTTL(data[Accessor::TTL_COLUMN])));
rrset->addRdata(rdata::createRdata(rrset->getType(), rrclass_,
data[Accessor::RDATA_COLUMN]));
LOG_DEBUG(logger, DBG_TRACE_DETAILED,
DATASRC_DATABASE_JOURNALREADER_NEXT).
arg(rrset->getName()).arg(rrset->getType()).
arg(zone_).arg(rrclass_).arg(accessor_->getDBName());
return (rrset);
} catch (const Exception& ex) {
// TBD: log it.
LOG_ERROR(logger, DATASRC_DATABASE_JOURNALREADR_BADDATA).
arg(zone_).arg(rrclass_).arg(accessor_->getDBName()).
arg(begin_).arg(end_).arg(ex.what());
isc_throw(DataSourceError, "Failed to create RRset from diff on "
<< accessor_->getDBName());
}
......@@ -1138,8 +1149,11 @@ public:
private:
shared_ptr<Accessor> accessor_;
const Name zone_;
const RRClass rrclass_;
Accessor::IteratorContextPtr context_;
const uint32_t begin_;
const uint32_t end_;
bool finished_;
};
......@@ -1161,17 +1175,19 @@ DatabaseClient::getJournalReader(const isc::dns::Name& zone,
const pair<ZoneJournalReader::Result, ZoneJournalReaderPtr> ret(
ZoneJournalReader::SUCCESS,
ZoneJournalReaderPtr(new DatabaseJournalReader(jnl_accessor,
zone,
zoneinfo.second,
rrclass_,
begin_serial,
end_serial)));
LOG_DEBUG(logger, DBG_TRACE_BASIC,
DATASRC_DATABASE_JOURNALREADER_START).arg(zone).arg(rrclass_).
arg(jnl_accessor->getDBName()).arg(begin_serial).arg(end_serial);
return (ret);
} catch (const NoSuchSerial&) {
return (pair<ZoneJournalReader::Result, ZoneJournalReaderPtr>(
ZoneJournalReader::NO_SUCH_SERIAL,
ZoneJournalReaderPtr()));
} catch (...) {
throw;
}
}
}
......
......@@ -630,3 +630,31 @@ database module are shown in the log message.
Debug information. A set of updates to a zone has been successfully
committed to the corresponding database backend. The zone name,
its class and the database name are printed.
% DATASRC_DATABASE_JOURNALREADER_START %1/%2 on %3 from %4 to %5
This is a debug message indicating that the program starts reading
a zone's difference sequences from a database-based data source. The
zone's name and class, database name, and the start and end serials
are shown in the message.
% DATASRC_DATABASE_JOURNALREADER_NEXT %1/%2 in %3/%4 on %5
This is a debug message indicating that the program retrieves one
difference in difference sequences of a zone and successfully converts
it to an RRset. The zone's name and class, database name, and the
name and RR type of the retrieved diff are shown in the message.
% DATASRC_DATABASE_JOURNALREADER_END %1/%2 on %3 from %4 to %5
This is a debug message indicating that the program (successfully)
reaches the end of sequences of a zone's differences. The zone's name
and class, database name, and the start and end serials are shown in
the message.
% DATASRC_DATABASE_JOURNALREADR_BADDATA failed to convert a diff to RRset in %1/%2 on %3 between %4 and %5: %6
This is an error message indicating that a zone's diff is broken and
the data source library failed to convert it to a valid RRset. The
most likely cause of this is that someone has manually modified the
zone's diff in the database and inserted invalid data as a result.
The zone's name and class, database name, and the start and end
serials, and an additional detail of the error are shown in the
message. The administrator should examine the diff in the database
to find any invalid data and fix it.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment