Unverified Commit b67bc1ca authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge #2180

Warn administrator when creating an empty SQLite data source.
parents 0f43c975 4275cf4b
......@@ -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
BIND 10, 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
......
......@@ -474,8 +474,8 @@ private:
// return db version
pair<int, int>
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<int, int> 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());
}
......
......@@ -788,7 +788,7 @@ private:
// return db version
pair<int, int> 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
......
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