BIND 10 trac744, updated. 7e9ea719c8fda75f346eb87daae58cf06c8070e0 [trac744] Logging for the SQLite datasource
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 3 18:11:10 UTC 2011
The branch, trac744 has been updated
via 7e9ea719c8fda75f346eb87daae58cf06c8070e0 (commit)
from 04c515e17a08b41c9dbf241e3983148596353d2c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7e9ea719c8fda75f346eb87daae58cf06c8070e0
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue May 3 20:10:47 2011 +0200
[trac744] Logging for the SQLite datasource
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/messagedef.mes | 81 ++++++++++++++++++++++++++++++++++++
src/lib/datasrc/sqlite3_datasrc.cc | 38 ++++++++++++++---
2 files changed, 113 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/messagedef.mes b/src/lib/datasrc/messagedef.mes
index 11f4140..5a7aa21 100644
--- a/src/lib/datasrc/messagedef.mes
+++ b/src/lib/datasrc/messagedef.mes
@@ -418,3 +418,84 @@ STATIC_BAD_CLASS Static data source can handle CH only
STATIC_FIND Looking for '%s/%s'
+ Debug information. We're looking for this resource record set in the static
+ data source.
+
+SQLITE_FINDREC Looking for record '%s/%s'
++ Debug information. The SQLite data source is looking up records of given name
++ and type in the database.
+
+SQLITE_ENCLOSURE Looking for zone containing '%s'
++ Debug information. The SQLite data source is trying to identify, which zone
++ should hold this domain.
+
+SQLITE_ENCLOSURE_BAD_CLASS Class mismatch looking for a zone ('%s' and '%s')
++ The SQLite data source can handle only one class at a time and it was asked
++ to identify which zone is holding data of a different class.
+
+SQLITE_ENCLOSURE_NOTFOUND No zone contains it
++ Debug information. The last SQLITE_ENCLOSURE query was unsuccessful, there's
++ no such zone in our data.
+
+SQLITE_PREVIOUS Looking for name previous to '%s'
++ Debug information. We're trying to look up name preceding the supplied one.
+
+SQLITE_PREVIOUS_NO_ZONE No zone containing '%s'
++ The SQLite data source tried to identify name preceding this one. But this
++ one is not contained in any zone in the data source.
+
+SQLITE_FIND_NSEC3 Looking for NSEC3 in zone '%s' for hash '%s'
++ Debug information. We're trying to look up a NSEC3 record in the SQLite data
++ source.
+
+SQLITE_FIND_NSEC3_NO_ZONE No such zone '%s'
++ The SQLite data source was asked to provide a NSEC3 record for given zone.
++ But it doesn't contain that zone.
+
+SQLITE_FIND Looking for RRset '%s/%s'
++ Debug information. The SQLite data source is looking up a resource record
++ set.
+
+SQLITE_FIND_BAD_CLASS Class mismatch looking for an rrset ('%s' and '%s')
++ The SQLite data source was looking up an RRset, but the data source contains
++ different class than the query was for.
+
+SQLITE_FINDEXACT Looking for exact RRset '%s/%s'
++ Debug information. The SQLite data source is looking up an exact resource
++ record.
+
+SQLITE_FINDEXACT_BAD_CLASS Class mismatch looking for an rrset ('%s' and '%s')
++ The SQLite data source was looking up an exact RRset, but the data source
++ contains different class than the query was for.
+
+SQLITE_FINDADDRS Looking for A/AAAA addresses for '%s'
++ Debug information. The data source is looking up the addresses for given
++ domain name.
+
+SQLITE_FINDADDRS_BAD_CLASS Class mismatch looking for addresses ('%s' and '%s')
++ The SQLite data source was looking up A/AAAA addresses, but the data source
++ contains different class than the query was for.
+
+SQLITE_FINDREF Looking for referral at '%s'
++ Debug information. The SQLite data source is identifying if this domain is
++ a referral and where it goes.
+
+SQLITE_FINDREF_BAD_CLASS Class mismatch looking for referral ('%s' and '%s')
++ The SQLite data source was trying to identify, if there's a referral. But the
++ but it contains different class than the query was for.
+
+SQLITE_CREATE SQLite data source created
++ Debug information. We're creating an instance of the SQLite data source.
+
+SQLITE_DESTROY SQLite data source destroyed
++ Debug information. We're destroying an instance of SQLite data source.
+
+SQLITE_SETUP Setting up SQLite database
++ The database for SQLite data source was found empty. So we're assuming this
++ is the first run and we initialize it with current schema. It'll still
++ contain no data, but it will be ready for use.
+
+SQLITE_OPEN Opening SQLite database '%s'
++ Debug information. The SQLite data source is loading an SQLite database in
++ the provide file.
+
+SQLITE_CLOSE Closing SQLite database
++ Debug information. The SQLite data source is closing the database file.
diff --git a/src/lib/datasrc/sqlite3_datasrc.cc b/src/lib/datasrc/sqlite3_datasrc.cc
index b1d53d2..2bc6d2e 100644
--- a/src/lib/datasrc/sqlite3_datasrc.cc
+++ b/src/lib/datasrc/sqlite3_datasrc.cc
@@ -228,6 +228,10 @@ Sqlite3DataSrc::findRecords(const Name& name, const RRType& rdtype,
RRsetList& target, const Name* zonename,
const Mode mode, uint32_t& flags) const
{
+ if (logger.isDebugEnabled(DBG_TRACE_DETAILED)) {
+ logger.debug(DBG_TRACE_DETAILED, DATASRC_SQLITE_FINDREC,
+ name.toText().c_str(), rdtype.toText().c_str());
+ }
flags = 0;
int zone_id = (zonename == NULL) ? findClosest(name, NULL) :
findClosest(*zonename, NULL);
@@ -378,8 +382,7 @@ Sqlite3DataSrc::findPreviousName(const Name& qname,
const int zone_id = (zonename == NULL) ?
findClosest(qname, NULL) : findClosest(*zonename, NULL);
if (zone_id < 0) {
- logger.error(DBG_TRACE_DATA, DATASRC_SQLITE_PREVIOUS_NO_ZONE,
- qname.toText().c_str());
+ logger.error(DATASRC_SQLITE_PREVIOUS_NO_ZONE, qname.toText().c_str());
return (ERROR);
}
@@ -511,8 +514,7 @@ Sqlite3DataSrc::findRRset(const Name& qname,
}
if (qclass != getClass() && qclass != RRClass::ANY()) {
logger.error(DATASRC_SQLITE_FIND_BAD_CLASS,
- getClass().toText().c_str(),
- qclass.toText().c_str());
+ getClass().toText().c_str(), qclass.toText().c_str());
return (ERROR);
}
findRecords(qname, qtype, target, zonename, NORMAL, flags);
@@ -527,7 +529,13 @@ Sqlite3DataSrc::findExactRRset(const Name& qname,
uint32_t& flags,
const Name* zonename) const
{
+ if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
+ logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_FINDEXACT,
+ qname.toText().c_str(), qtype.toText().c_str());
+ }
if (qclass != getClass() && qclass != RRClass::ANY()) {
+ logger.error(DATASRC_SQLITE_FINDEXACT_BAD_CLASS,
+ getClass().toText().c_str(), qclass.toText().c_str());
return (ERROR);
}
findRecords(qname, qtype, target, zonename, NORMAL, flags);
@@ -551,7 +559,13 @@ Sqlite3DataSrc::findAddrs(const Name& qname,
uint32_t& flags,
const Name* zonename) const
{
+ if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
+ logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_FINDADDRS,
+ qname.toText().c_str());
+ }
if (qclass != getClass() && qclass != RRClass::ANY()) {
+ logger.error(DATASRC_SQLITE_FINDADDRS_BAD_CLASS,
+ getClass().toText().c_str(), qclass.toText().c_str());
return (ERROR);
}
findRecords(qname, RRType::ANY(), target, zonename, ADDRESS, flags);
@@ -565,8 +579,14 @@ Sqlite3DataSrc::findReferral(const Name& qname,
uint32_t& flags,
const Name* zonename) const
{
+ if (logger.isDebugEnabled(DBG_TRACE_DATA)) {
+ logger.debug(DBG_TRACE_DATA, DATASRC_SQLITE_FINDREF,
+ qname.toText().c_str());
+ }
if (qclass != getClass() && qclass != RRClass::ANY()) {
- return (ERROR);
+ logger.error(DATASRC_SQLITE_FINDREF_BAD_CLASS,
+ getClass().toText().c_str(), qclass.toText().c_str());
+ return (ERROR);
}
findRecords(qname, RRType::ANY(), target, zonename, DELEGATION, flags);
return (SUCCESS);
@@ -574,9 +594,12 @@ Sqlite3DataSrc::findReferral(const Name& qname,
Sqlite3DataSrc::Sqlite3DataSrc() :
dbparameters(new Sqlite3Parameters)
-{}
+{
+ logger.debug(DBG_TRACE_BASIC, DATASRC_SQLITE_CREATE);
+}
Sqlite3DataSrc::~Sqlite3DataSrc() {
+ logger.debug(DBG_TRACE_BASIC, DATASRC_SQLITE_DESTROY);
if (dbparameters->db_ != NULL) {
close();
}
@@ -663,6 +686,7 @@ checkAndSetupSchema(Sqlite3Initializer* initializer) {
initializer->params_.version_ = sqlite3_column_int(prepared, 0);
sqlite3_finalize(prepared);
} else {
+ logger.info(DATASRC_SQLITE_SETUP);
if (prepared != NULL) {
sqlite3_finalize(prepared);
}
@@ -692,6 +716,7 @@ checkAndSetupSchema(Sqlite3Initializer* initializer) {
//
void
Sqlite3DataSrc::open(const string& name) {
+ logger.debug(DBG_TRACE_BASIC, DATASRC_SQLITE_OPEN, name.c_str());
if (dbparameters->db_ != NULL) {
isc_throw(DataSourceError, "Duplicate SQLite open with " << name);
}
@@ -711,6 +736,7 @@ Sqlite3DataSrc::open(const string& name) {
//
DataSrc::Result
Sqlite3DataSrc::close(void) {
+ logger.debug(DBG_TRACE_BASIC, DATASRC_SQLITE_CLOSE);
if (dbparameters->db_ == NULL) {
isc_throw(DataSourceError,
"SQLite data source is being closed before open");
More information about the bind10-changes
mailing list