Open SLedunois opened 3 weeks ago
Can you share the definition of mdl_sessions table? I suspect there's something wrong with query rewriting in pgpool with the query because timemodified column sounds like a timestamp type or something like that, which needs rewriting so that the query is not confused by subtle time difference between those PostgreSQL servers.
The timemodified is a bigint. Please find below the table schema. I also check if there is some trigger on the table.
psql=# \d+ mdl_sessions;
Table "public.mdl_sessions"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
--------------+------------------------+-----------+----------+------------------------------------------+----------+-------------+--------------+-------------
id | bigint | | not null | nextval('mdl_sessions_id_seq'::regclass) | plain | | |
state | bigint | | not null | 0 | plain | | |
sid | character varying(128) | | not null | ''::character varying | extended | | |
userid | bigint | | not null | | plain | | |
sessdata | text | | | | extended | | |
timecreated | bigint | | not null | | plain | | |
timemodified | bigint | | not null | | plain | | |
firstip | character varying(45) | | | | extended | | |
lastip | character varying(45) | | | | extended | | |
Indexes:
"mdl_sess_id_pk" PRIMARY KEY, btree (id)
"mdl_sess_sid_uix" UNIQUE, btree (sid)
"mdl_sess_sta_ix" btree (state)
"mdl_sess_tim2_ix" btree (timemodified)
"mdl_sess_tim_ix" btree (timecreated)
"mdl_sess_use_ix" btree (userid)
Access method: heap
psql =# SELECT event_object_table
,trigger_name
,event_manipulation
,action_statement
,action_timing
FROM information_schema.triggers
WHERE event_object_table = 'mdl_sessions' -- Your table name comes here
ORDER BY event_object_table
,event_manipulation;
event_object_table | trigger_name | event_manipulation | action_statement | action_timing
--------------------+--------------+--------------------+------------------+---------------
(0 rows)
This is really strange. I have no issues with two PostgreSQL servers, but as soon as I add the third one, I encounter errors.
I did run a synchronization that completed successfully:
# pcp_detach_node -h pgpool -p 9898 -U pgpool -W -n 1
Password:
pcp_detach_node -- Command Successful
# pcp_detach_node -h pgpool -p 9898 -U pgpool -W -n 2
Password:
pcp_detach_node -- Command Successful
# pcp_recovery_node -h pgpool -p 9898 -n 2 -U pgpool -W
Password:
pcp_recovery_node -- Command Successful
# pcp_recovery_node -h pgpool -p 9898 -n 1 -U pgpool -W
Password:
pcp_recovery_node -- Command Successful
But the issue persists.
psql=# \d+ mdl_sessions;
OK. No timestamp or similar data types are not used, which means no query rewriting is involved.
Have you enabled insert_lock?
By default, insert_lock
is enabled.
I tried disabling it, but the issue still persists.
However, I noticed something interesting: I received this error log:
Debug info: ERROR: pgpool detected difference of the number of inserted, updated or deleted tuples. Possible last query was: "UPDATE mdl_sessions SET timemodified = $1 WHERE id=$2"
HINT: check data consistency between main and other db node
UPDATE mdl_sessions SET timemodified = $1 WHERE id=$2
[array (
'timemodified' => 1725437846,
0 => '4139994',
)]
and the following pgpool log:
2024-09-04 07:50:04.583: [unknown] pid 1344002: LOG: pgpool detected difference of the number of inserted, updated or deleted tuples. Possible last query was: "UPDATE mdl_sessions SET timemodified = $1 WHERE id=$2"
2024-09-04 07:50:04.583: [unknown] pid 1344002: LOG: processing command complete
2024-09-04 07:50:04.583: [unknown] pid 1344002: DETAIL: CommandComplete: Number of affected tuples are: 1 0 1
We can see that the write operation is not the same on the second server. So I went to check the corresponding row on my three database servers:
id | state | sid | userid | sessdata | timecreated | timemodified | firstip | lastip
---------+-------+----------------------------+--------+----------+-------------+--------------+----------------+----------------
4139994 | 0 | b00fji3fg20mv4d8mfktngc3mr | 2 | | 1725437844 | 1725437844 | XXX.XXX.XXX.XX | XXX.XXX.XXX.XX
(1 row)
id | state | sid | userid | sessdata | timecreated | timemodified | firstip | lastip
---------+-------+----------------------------+--------+----------+-------------+--------------+----------------+----------------
4139994 | 0 | cdulq8jhgkij6irukhi75l6mq9 | 0 | | 1725437846 | 1725437846 | XXX.XXX.XXX.XX | XXX.XXX.XXX.XX
(1 row)
id | state | sid | userid | sessdata | timecreated | timemodified | firstip | lastip
---------+-------+----------------------------+--------+----------+-------------+--------------+----------------+----------------
4139994 | 0 | b00fji3fg20mv4d8mfktngc3mr | 2 | | 1725437844 | 1725437844 | XXX.XXX.XXX.XX | XXX.XXX.XXX.XX
(1 row)
We can see that on the second PostgreSQL server, the timecreated
, timemodified
, and userid
columns are different.
I found the same row on bdd02 by executing the following query:
SELECT * FROM mdl_sessions WHERE sid = 'b00fji3fg20mv4d8mfktngc3mr' AND userid = 2;
id | state | sid | userid | sessdata | timecreated | timemodified | firstip | lastip
---------+-------+----------------------------+--------+----------+-------------+--------------+----------------+----------------
4139993 | 0 | b00fji3fg20mv4d8mfktngc3mr | 2 | | 1725437844 | 1725437844 | XXX.XXX.XXX.XX | XXX.XXX.XXX.XX
(1 row)
The identifier is different. The row was inserted earlier.
How could this happen?
Sorry I was not clear. I just wanted to make sure that insert_lock is enabled in your installation. If a target table for INSERT has SERIAL columns (your case), insert_lock needs to be enabled to acquire locking for consistent replication. However you already enable insert_lock...
We can see that on the second PostgreSQL server, the timecreated, timemodified, and userid columns are different.
How did you INSERT the row? Can you share the actual INSERT statement?
Sorry I was not clear. I just wanted to make sure that insert_lock is enabled in your installation. If a target table for INSERT has SERIAL columns (your case), insert_lock needs to be enabled to acquire locking for consistent replication. However you already enable insert_lock...
Just in case, I explicitly set insert_lock
to true.
How did you INSERT the row? Can you share the actual INSERT statement?
Sure, the insert statement is:
LOG: duration: 0.044 ms bind <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
DETAIL: parameters: $1 = '0', $2 = 'ntmh2rvpidgdittphj91bag350', $3 = NULL, $4 = '0', $5 = '1725453377', $6 = '1725453377', $7 = 'XXX.XXX.XXX.XX', $8 = 'XXX.XXX.XXX.XX'
How could this happen?
If insert_lock is disabled, it could happen because pgpool can't control concurrent INSERTs.
So when you enable insert_lock, did you see something like below in the postgresql log when you execute INSERT to the table?
LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
This is an expected behavior and I want to make sure pgpool is working as expected.
In addition to this, I would like to know followings:
ERROR: could not serialize access due to concurrent update
or not while executing your transactionSo when you enable insert_lock, did you see something like below in the postgresql log when you execute INSERT to the table?
LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
This is an expected behavior and I want to make sure pgpool is working as expected.In addition to this, I would like to know followings:
- Exact pgpool version
- Whether you had
ERROR: could not serialize access due to concurrent update
or not while executing your transaction
The insert_lock
configuration is enabled on pgpool. I can see the LOCK TABLE
in the logs:
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.026 ms statement: BEGIN
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.041 ms parse pgpool1426415: SELECT current_setting('transaction_read_only')
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.022 ms bind pgpool1426415/pgpool1426415: SELECT current_setting('transaction_read_only')
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.007 ms execute pgpool1426415/pgpool1426415: SELECT current_setting('transaction_read_only')
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.014 ms parse pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.002 ms bind pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.067 ms execute pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.007 ms parse pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.002 ms bind pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.005 ms execute pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.003 ms parse pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.001 ms bind pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.002 ms execute pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.097 ms parse <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.010 ms parse pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.002 ms bind pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.008 ms execute pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.005 ms parse pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.001 ms bind pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.003 ms execute pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.004 ms parse pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1427121]: LOG: duration: 0.028 ms statement: COMMIT
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.001 ms bind pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.003 ms execute pgpool1426415/pgpool1426415: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.058 ms bind <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
2024-09-05 09:38:12 CEST [1426630]: DETAIL: parameters: $1 = '0', $2 = 'iqvlbuce6behoc0fngmgrm7hin', $3 = NULL, $4 = '0', $5 = '1725521892', $6 = '1725521892', $7 = '192.168.240.63', $8 = '192.168.240.63'
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.135 ms execute <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
2024-09-05 09:38:12 CEST [1426630]: DETAIL: parameters: $1 = '0', $2 = 'iqvlbuce6behoc0fngmgrm7hin', $3 = NULL, $4 = '0', $5 = '1725521892', $6 = '1725521892', $7 = '192.168.240.63', $8 = '192.168.240.63'
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.026 ms statement: COMMIT
2024-09-05 09:38:12 CEST [1427121]: LOG: duration: 0.047 ms statement: BEGIN
2024-09-05 09:38:12 CEST [1426630]: LOG: duration: 0.046 ms statement: DISCARD ALL
For the PgPool version, we are using 4.5.2:
# pgpool --version
pgpool-II version 4.5.2 (hotooriboshi)
I do indeed have a serialization error:
LOG: connection authenticated: identity="xxx" method=md5 (/etc/postgresql/15/main/pg_hba.conf:92)
LOG: connection authorized: user=xxx database=xxx
ERROR: could not serialize access due to concurrent update
STATEMENT: UPDATE mdl_category_options SET categoryid = $1,name = $2,value = $3 WHERE id=$4
ERROR: could not serialize access due to concurrent update
The PostgreSQL log looks really weird. Process 1426630 executed "LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE" over and over again. It is expected this executes only once after BEGIN. Can you share pgpool log when INSERT is executed with "log_per_node_statement" and "log_client_messages" enabled?
Here are the PgPool logs with the log_per_node_statement and log_client_messages configurations enabled:
Bdd01 pgpool leader: /var/log/pgpool_log/pgpool-2024-09-10_130753.log
[unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[unknown] pid 1777163: LOG: DB node id: 0 backend pid: 1777406 statement: Parse: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[unknown] pid 1777143: LOG: Sync message from frontend.
[unknown] pid 1777143: LOG: DB node id: 0 backend pid: 1777454 statement: COMMIT
[unknown] pid 1777143: LOG: DB node id: 1 backend pid: 1559714 statement: COMMIT
[unknown] pid 1777163: LOG: DB node id: 1 backend pid: 1559691 statement: Parse: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: Parse: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: COMMIT
[unknown] pid 1777163: LOG: Bind message from frontend.
[unknown] pid 1777163: DETAIL: portal: "", statement: ""
[unknown] pid 1777163: LOG: DB node id: 0 backend pid: 1777406 statement: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[unknown] pid 1777163: LOG: DB node id: 1 backend pid: 1559691 statement: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[unknown] pid 1777163: LOG: DB node id: 0 backend pid: 1777406 statement: Bind: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[unknown] pid 1777163: LOG: DB node id: 1 backend pid: 1559691 statement: Bind: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: Bind: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[unknown] pid 1777163: LOG: Describe message from frontend.
[unknown] pid 1777163: DETAIL: portal: ""
[unknown] pid 1777163: LOG: DB node id: 0 backend pid: 1777406 statement: D message
[unknown] pid 1777163: LOG: DB node id: 1 backend pid: 1559691 statement: D message
[unknown] pid 1777143: LOG: Parse message from frontend.
58929[unknown] pid 1777143: DETAIL: statement: "", query: "SELECT id, scoid, element, value
FROM mdl_scorm_scoes_track
WHERE scormid = $1
AND userid = $2 AND element IN (
'cmi.core.lesson_status',
'cmi.completion_status',
'cmi.success_status'
)
-- line 66 of /mod/scorm/classes/completion/custom_completion.php: call to pgsql_native_moodle_database->get_records_sql()"
[unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: D message
[unknown] pid 1777143: LOG: DB node id: 0 backend pid: 1777454 statement: BEGIN
[unknown] pid 1777143: LOG: DB node id: 1 backend pid: 1559714 statement: BEGIN
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: Execute message from frontend.
2024-09-10 13:07:57.169: [unknown] pid 1777163: DETAIL: portal: ""
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: DB node id: 0 backend pid: 1777406 statement: Execute: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: BEGIN
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: DB node id: 0 backend pid: 1777454 statement: SELECT current_setting('transaction_read_only')
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: DB node id: 1 backend pid: 1559691 statement: Execute: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: Execute: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: DB node id: 1 backend pid: 1559714 statement: SELECT current_setting('transaction_read_only')
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: SELECT current_setting('transaction_read_only')
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: Parse: SELECT id, scoid, element, value
FROM mdl_scorm_scoes_track
WHERE scormid = $1
AND userid = $2 AND element IN (
'cmi.core.lesson_status',
'cmi.completion_status',
'cmi.success_status'
)
-- line 66 of /mod/scorm/classes/completion/custom_completion.php: call to pgsql_native_moodle_database->get_records_sql()
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: Sync message from frontend.
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: DB node id: 1 backend pid: 1559691 statement: COMMIT
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: Bind message from frontend.
2024-09-10 13:07:57.169: [unknown] pid 1777143: DETAIL: portal: "", statement: ""
2024-09-10 13:07:57.169: [unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: Bind: SELECT id, scoid, element, value
FROM mdl_scorm_scoes_track
WHERE scormid = $1
AND userid = $2 AND element IN (
'cmi.core.lesson_status',
'cmi.completion_status',
'cmi.success_status'
)
-- line 66 of /mod/scorm/classes/completion/custom_completion.php: call to pgsql_native_moodle_database->get_records_sql()
2024-09-10 13:07:57.169: [unknown] pid 1777163: LOG: DB node id: 2 backend pid: 632818 statement: COMMIT
[unknown] pid 1777143: LOG: Describe message from frontend.
[unknown] pid 1777143: DETAIL: portal: ""
[unknown] pid 1777163: LOG: DB node id: 0 backend pid: 1777406 statement: COMMIT
[unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: D message
[unknown] pid 1777143: LOG: Execute message from frontend.
[unknown] pid 1777143: DETAIL: portal: ""
[unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: Execute: SELECT id, scoid, element, value
FROM mdl_scorm_scoes_track
WHERE scormid = $1
AND userid = $2 AND element IN (
'cmi.core.lesson_status',
'cmi.completion_status',
'cmi.success_status'
)
-- line 66 of /mod/scorm/classes/completion/custom_completion.php: call to pgsql_native_moodle_database->get_records_sql()
[unknown] pid 1777143: LOG: Sync message from frontend.
[unknown] pid 1777143: LOG: DB node id: 0 backend pid: 1777454 statement: COMMIT
[unknown] pid 1777143: LOG: DB node id: 1 backend pid: 1559714 statement: COMMIT
[unknown] pid 1777143: LOG: DB node id: 2 backend pid: 632847 statement: COMMIT
However, I am also including the PostgreSQL logs because I just realized that the LOCK TABLE is present in the PostgreSQL logs only on BDD01: BDD01 logs Postgresql@15-main: /appli/postgresql/15/main/pg_log/postgresql-2024-09-10.log
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.009 ms statement: BEGIN
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.037 ms parse pgpool1777163: SELECT current_setting('transaction_read_only')
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.016 ms bind pgpool1777163/pgpool1777163: SELECT current_setting('transaction_read_only')
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.005 ms execute pgpool1777163/pgpool1777163: SELECT current_setting('transaction_read_only')
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.015 ms parse pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.003 ms bind pgpool1777163/pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.081 ms execute pgpool1777163/pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.006 ms parse pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.002 ms bind pgpool1777163/pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.004 ms execute pgpool1777163/pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.004 ms parse pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.002 ms bind pgpool1777163/pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.002 ms execute pgpool1777163/pgpool1777163: LOCK TABLE "mdl_sessions" IN SHARE ROW EXCLUSIVE MODE
[1777406]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.109 ms parse <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[1777454]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.015 ms statement: COMMIT
BDD02 logs postgresql@15-main: /appli/postgresql/15/main/pg_log/postgresql-2024-09-10.log
[1559714]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.010 ms statement: BEGIN
[1559714]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.024 ms parse pgpool1777143: SELECT current_setting('transaction_read_only')
[1559714]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.026 ms bind pgpool1777143/pgpool1777143: SELECT current_setting('transaction_read_only')
[1559714]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.005 ms execute pgpool1777143/pgpool1777143: SELECT current_setting('transaction_read_only')
[1559691]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.121 ms execute <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[1559691]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX DETAIL: parameters: $1 = '0', $2 = 's089pi37n21h2ujlfbdhl7dtdt', $3 = NULL, $4 = '0', $5 = '1725973677', $6 = '1725973677', $7 = '192.168.240.63', $8 = '192.168.240.63'
[1559691]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.023 ms statement: COMMIT
BDD03 logs postgresql@15-main:/appli/postgresql/15/main/pg_log/postgresql-2024-09-10.log
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.011 ms statement: BEGIN
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.026 ms parse pgpool1777143: SELECT current_setting('transaction_read_only')
[632818]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.114 ms execute <unnamed>: INSERT INTO mdl_sessions (state,sid,sessdata,userid,timemodified,timecreated,lastip,firstip) VALUES($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id
[632818]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX DETAIL: parameters: $1 = '0', $2 = 's089pi37n21h2ujlfbdhl7dtdt', $3 = NULL, $4 = '0', $5 = '1725973677', $6 = '1725973677', $7 = '192.168.240.63', $8 = '192.168.240.63'
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.014 ms bind pgpool1777143/pgpool1777143: SELECT current_setting('transaction_read_only')
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.004 ms execute pgpool1777143/pgpool1777143: SELECT current_setting('transaction_read_only')
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.053 ms parse <unnamed>: SELECT id, scoid, element, value
FROM mdl_scorm_scoes_track
WHERE scormid = $1
AND userid = $2 AND element IN (
'cmi.core.lesson_status',
'cmi.completion_status',
'cmi.success_status'
)
-- line 66 of /mod/scorm/classes/completion/custom_completion.php: call to pgsql_native_moodle_database->get_records_sql()
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.110 ms bind <unnamed>: SELECT id, scoid, element, value
FROM mdl_scorm_scoes_track
WHERE scormid = $1
AND userid = $2 AND element IN (
'cmi.core.lesson_status',
'cmi.completion_status',
'cmi.success_status'
)
-- line 66 of /mod/scorm/classes/completion/custom_completion.php: call to pgsql_native_moodle_database->get_records_sql()
[632847]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX DETAIL: parameters: $1 = '1597', $2 = '46673'
[632818]: db=XXX,user=XXX,app=[unknown],client=XX.XXX.XXX.XX LOG: duration: 0.025 ms statement: COMMIT
However, I am also including the PostgreSQL logs because I just realized that the LOCK TABLE is present in the PostgreSQL logs only on BDD01:
I was able to reproduce the issue. It seems Pgpool-II does not send LOCK TABLE to other than main node (that is node 0 in your case). This only happens in extended query protocol mode. I will fix this.
Awesome! thank you very much! Do you have an estimated date for the fix version?
I need 24 hours for this before I push the fix to git repository.
Done. Here is the commit link for 4.5 stable branch. https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=a4c15f4595fc2ab5b5ac58eedf96b5b5119e074e
Thank you so much ! Do you have a 4.5.5 release date ?
You are welcome. 4.5.5 release date will be November 21. https://pgpool.net/mediawiki/index.php/Roadmap
Hello,
I am currently encountering an issue with PgPool2 in Snapshot isolation mode. I followed the example provided here: https://www.pgpool.net/docs/latest/en/html/example-replication-mode.html
I have 3 PostgreSQL servers, each with PgPool installed on them:
However, while using my application, I frequently receive the following error message:
This error message consistently occurs when the cluster contains 3 PostgreSQL instances, whereas it seems to work correctly with 2 PostgreSQL instances.
It seems that the nodes desynchronize very quickly. However, it is PgPool's responsibility to maintain this synchronization. That is why I chose the snapshot isolation mode.
I have indeed added the following configuration in the PostgreSQL instances:
My PgPool2 configuration:
Did I miss something? Could this be caused by a configuration related to the number of connections?
Thank you,
SLedunois