From 6641a3114f980acd589fc15b15b47961aab0a3af Mon Sep 17 00:00:00 2001 From: Alexandre LEBRUN Date: Wed, 21 Aug 2024 11:49:03 +0200 Subject: [PATCH] wip --- .idea/.gitignore | 8 ++++++++ .idea/codeStyles/Project.xml | 7 +++++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++++ .idea/ejabberd.iml | 9 +++++++++ .idea/inspectionProfiles/Project_Default.xml | 6 ++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/rebar.xml | 6 ++++++ .idea/sbt.xml | 6 ++++++ .idea/scala_compiler.xml | 6 ++++++ .idea/vcs.xml | 6 ++++++ conf/ejabberd.yml | 0 src/ejabberd_sm_sql.erl | 6 +++++- src/ejabberd_sql.erl | 6 ++++++ src/ejabberd_sql_schema.erl | 2 ++ 15 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/ejabberd.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/rebar.xml create mode 100644 .idea/sbt.xml create mode 100644 .idea/scala_compiler.xml create mode 100644 .idea/vcs.xml create mode 100644 conf/ejabberd.yml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000000..13566b81b01 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000000..919ce1f1f77 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000000..a55e7a179bd --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/ejabberd.iml b/.idea/ejabberd.iml new file mode 100644 index 00000000000..d6ebd480598 --- /dev/null +++ b/.idea/ejabberd.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000000..112694c6294 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000000..cc6eae03c93 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000000..fe5c6686597 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/rebar.xml b/.idea/rebar.xml new file mode 100644 index 00000000000..ae4ef621d70 --- /dev/null +++ b/.idea/rebar.xml @@ -0,0 +1,6 @@ + + + + $PROJECT_DIR$/rebar + + \ No newline at end of file diff --git a/.idea/sbt.xml b/.idea/sbt.xml new file mode 100644 index 00000000000..20187435474 --- /dev/null +++ b/.idea/sbt.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/scala_compiler.xml b/.idea/scala_compiler.xml new file mode 100644 index 00000000000..3c0e0f6f64b --- /dev/null +++ b/.idea/scala_compiler.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000000..35eb1ddfbbc --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/conf/ejabberd.yml b/conf/ejabberd.yml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/ejabberd_sm_sql.erl b/src/ejabberd_sm_sql.erl index ff06d3ddac7..f9754431d02 100644 --- a/src/ejabberd_sm_sql.erl +++ b/src/ejabberd_sm_sql.erl @@ -52,14 +52,18 @@ init() -> case ejabberd_sql:sql_query( Host, ?SQL("delete from sm where node=%(Node)s")) of {updated, _} -> + ?DEBUG("Successfully cleaned 'sm' table on host: ~p", [Host]), ok; Err -> + ?DEBUG("Error tatata", []), ?ERROR_MSG("Failed to clean 'sm' table: ~p", [Err]), {error, db_failure} end; (_, Err) -> + ?DEBUG("Another case...", []), Err - end, ok, ejabberd_sm:get_vh_by_backend(?MODULE)). + end, ok, ejabberd_sm:get_vh_by_backend(?MODULE)), + ?DEBUG("Bullshit done...", []). schemas() -> [#sql_schema{ diff --git a/src/ejabberd_sql.erl b/src/ejabberd_sql.erl index 1e60b6fa7ba..db5e1402e86 100644 --- a/src/ejabberd_sql.erl +++ b/src/ejabberd_sql.erl @@ -144,10 +144,12 @@ sql_call(Host, Msg) -> Timeout = query_timeout(Host), case get(?STATE_KEY) of undefined -> + ?DEBUG("No existing state", []), sync_send_event(Host, {sql_cmd, Msg, current_time() + Timeout}, Timeout); _State -> + ?DEBUG("Existing state", [_State]), nested_op(Msg) end. @@ -167,14 +169,18 @@ keep_alive(Host, Proc) -> sync_send_event(Host, Msg, Timeout) when is_binary(Host) -> case ejabberd_sql_sup:start(Host) of ok -> + ?DEBUG("Loaded sql sup", []), Proc = get_worker(Host), sync_send_event(Proc, Msg, Timeout); {error, _} = Err -> + ?DEBUG("Error while starting sql sup", []), Err end; sync_send_event(Proc, Msg, Timeout) -> + ?DEBUG("sync_send_event 180", []), try p1_fsm:sync_send_event(Proc, Msg, Timeout) catch _:{Reason, {p1_fsm, _, _}} -> + ?DEBUG("sync_send_event 180 error", []), {error, Reason} end. diff --git a/src/ejabberd_sql_schema.erl b/src/ejabberd_sql_schema.erl index 172bc41e46a..e7fc5e6ae02 100644 --- a/src/ejabberd_sql_schema.erl +++ b/src/ejabberd_sql_schema.erl @@ -36,6 +36,7 @@ start(Host) -> case should_update_schema(Host) of true -> + ?DEBUG("Should update schema", []), case table_exists(Host, <<"schema_version">>) of true -> ok; @@ -52,6 +53,7 @@ start(Host) -> end end; false -> + ?DEBUG("Should not update schema", []), ok end.