From: Michal 'vorner' Vaner Date: Tue, 28 Aug 2012 10:54:05 +0000 (+0200) Subject: [2180] Make the SQLITE_SETUP message a warning X-Git-Tag: trac2351_base~105^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fcde1f32cd4925a3c5b4c061a8b79fb83e2406af;p=thirdparty%2Fkea.git [2180] Make the SQLITE_SETUP message a warning Since creating new file is suspicious, the administrator may have misspelled some file name. The message explains the problem and shows the file name as well. Also, removed a duplicate message, created a new instance for it. --- diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes index 6837476243..c78dab6e81 100644 --- a/src/lib/datasrc/datasrc_messages.mes +++ b/src/lib/datasrc/datasrc_messages.mes @@ -787,10 +787,20 @@ example.com). However, this name is not contained in any zone in the data source. This is an error since it indicates a problem in the earlier processing of the query. -% DATASRC_SQLITE_SETUP setting up SQLite database +% DATASRC_SQLITE_SETUP setting up new SQLite3 database in '%1' The database for SQLite data source was found empty. It is assumed this is the first run and it is being initialized with current schema. It'll still contain -no data, but it will be ready for use. +no data, but it will be ready for use. If this is indeed the first run of +Bind10, it is to be expected and completely harmless. If you just configured +a data source to point to an existing file and you see this, you may have +misspelled the file name. + +% DATASRC_SQLITE_SETUP_OLD_API setting up new SQLite database +The database for SQLite data source was found empty. It is assumed this is the +first run and it is being initialized with current schema. It'll still contain +no data, but it will be ready for use. This is similar to DATASRC_SQLITE_SETUP +message, but it is logged from the old API. You should never see it, since the +API is deprecated. % DATASRC_STATIC_CLASS_NOT_CH static data source can handle CH class only An error message indicating that a query requesting a RR for a class other diff --git a/src/lib/datasrc/sqlite3_accessor.cc b/src/lib/datasrc/sqlite3_accessor.cc index ba21de8912..457d578c4b 100644 --- a/src/lib/datasrc/sqlite3_accessor.cc +++ b/src/lib/datasrc/sqlite3_accessor.cc @@ -474,8 +474,8 @@ private: // return db version pair -createDatabase(sqlite3* db) { - logger.info(DATASRC_SQLITE_SETUP); +createDatabase(sqlite3* db, const std::string& name) { + logger.warn(DATASRC_SQLITE_SETUP).arg(name); // try to get an exclusive lock. Once that is obtained, do the version // check *again*, just in case this process was racing another @@ -501,12 +501,12 @@ createDatabase(sqlite3* db) { } void -checkAndSetupSchema(Initializer* initializer) { +checkAndSetupSchema(Initializer* initializer, const std::string& name) { sqlite3* const db = initializer->params_.db_; pair schema_version = checkSchemaVersion(db); if (schema_version.first == -1) { - schema_version = createDatabase(db); + schema_version = createDatabase(db, name); } else if (schema_version.first != SQLITE_SCHEMA_MAJOR_VERSION) { LOG_ERROR(logger, DATASRC_SQLITE_INCOMPATIBLE_VERSION) .arg(schema_version.first).arg(schema_version.second) @@ -540,7 +540,7 @@ SQLite3Accessor::open(const std::string& name) { isc_throw(SQLite3Error, "Cannot open SQLite database file: " << name); } - checkAndSetupSchema(&initializer); + checkAndSetupSchema(&initializer, name); initializer.move(dbparameters_.get()); } diff --git a/src/lib/datasrc/sqlite3_datasrc.cc b/src/lib/datasrc/sqlite3_datasrc.cc index b450cd5b56..bced1ae5b1 100644 --- a/src/lib/datasrc/sqlite3_datasrc.cc +++ b/src/lib/datasrc/sqlite3_datasrc.cc @@ -788,7 +788,7 @@ private: // return db version pair create_database(sqlite3* db) { - logger.info(DATASRC_SQLITE_SETUP); + logger.info(DATASRC_SQLITE_SETUP_OLD_API); // try to get an exclusive lock. Once that is obtained, do the version // check *again*, just in case this process was racing another