Hello
Have a site that I am testing, has many updates related to Pheonix v1.0.1.4
using two servers with PHP 7.2.34 and 10.6.19-MariaDB-log - MariaDB Server
Replicating them with GTID using master-master, now it does all work can create orders on one and it be there on the other as long as its slow rejoin, but breaks because of duplicate entry in the sessions.
Error 'Duplicate entry 'uqdteoe9k5r6qet9utlo3l5ljr' for key 'PRIMARY'' on query. Default database: 'MYDATABASE NAME'. Query: 'insert into sessions values ('uqdteoe9k5r6qet9utlo3l5ljr', '1727943797', 'sessiontoken|s:32:\"74ebfb596f3298b5dd2ca0a7b8c712b6\";cart|O:12:\"shoppingCart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"GBP\";navigation|O:17:\"navigationHistory\":2:{s:4:\"path\";a:0:{}s:8:\"snapshot\";a:0:{}}')'
Error 'Duplicate entry 't8q4v1s1fko1aorvj9e2bnreih' for key 'PRIMARY'' on query. Default database: 'MYDATABASE NAME'. Query: 'insert into sessions values ('t8q4v1s1fko1aorvj9e2bnreih', '1727944393', 'language|s:7:\"english\";languages_id|s:1:\"1\";redirect_origin|a:4:{s:4:\"page\";s:10:\"orders.php\";s:3:\"get\";a:2:{s:4:\"page\";s:1:\"1\";s:3:\"oID\";s:6:\"117101\";}s:9:\"auth_user\";s:5:\"admin\";s:7:\"auth_pw\";s:12:\"MYPASSWORD\";}')'
So it looks like its breaking on admin side as well as catalog.
When I look into includes\funtions\sessions it says
if ( tep_db_num_rows($check_query) > 0 ) {
$result = tep_db_query("update sessions set expiry = '" . tep_db_input(time()) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'");
} else {
$result = tep_db_query("insert into sessions values ('" . tep_db_input($key) . "', '" . tep_db_input(time()) . "', '" . tep_db_input($value) . "')");
}
and admin\includes\functions\sessions.php it says
function _sess_write($key, $value) {
$check_query = tep_db_query("select 1 from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");
if ( tep_db_num_rows($check_query) > 0 ) {
$result = tep_db_query("update " . TABLE_SESSIONS . " set expiry = '" . tep_db_input(time()) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'");
} else {
$result = tep_db_query("insert into " . TABLE_SESSIONS . " values ('" . tep_db_input($key) . "', '" . tep_db_input(time()) . "', '" . tep_db_input($value) . "')");
}
so kind of think it is checking first before it puts another session in, but perhaps it needs to handled differently
Certainly not a coder, just a busy store owner, any pointers would be handy.
Kindest regards
Sessions duplicate in GTID replication
-
BatteryTrader
- Contributor
- Posts: 156
- Joined: Thu Apr 11, 2024 7:18 am
- Phoenix Version: 1.1.0.3
- Has thanked: 3 times
- Been thanked: 17 times
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Sessions duplicate in GTID replication
Just empty your sessions table.
Do it when you have no customers on site about to buy.
Do it when you have no customers on site about to buy.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.