Diff

plugins/mod_storage_sql.lua @ 10793:9ce67da45e54

mod_storage_sql: Log database connection parameters when creating engine This is meant to help trace down an issue where Prosody apparently creates multiple conflicting SQL engines, causing problems especially with SQLite3, e.g. #616 #784.
author Kim Alvefur <zash@zash.se>
date Sat, 02 May 2020 14:13:02 +0200
parent 10701:929c95e518f0
child 10925:73e95ecec733
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Wed Apr 29 23:28:21 2020 +0200
+++ b/plugins/mod_storage_sql.lua	Sat May 02 14:13:02 2020 +0200
@@ -759,9 +759,10 @@
 	if prosody.prosodyctl then return; end
 	local engines = module:shared("/*/sql/connections");
 	local params = normalize_params(module:get_option("sql", default_params));
-	engine = engines[sql.db2uri(params)];
+	local db_uri = sql.db2uri(params);
+	engine = engines[db_uri];
 	if not engine then
-		module:log("debug", "Creating new engine");
+		module:log("debug", "Creating new engine %s", db_uri);
 		engine = sql:create_engine(params, function (engine) -- luacheck: ignore 431/engine
 			if module:get_option("sql_manage_tables", true) then
 				-- Automatically create table, ignore failure (table probably already exists)