Hi, long shot here, but…
We are using Laravel 5.8 / PHP 7.2 with Percona XtraDB Cluster 8.
The Dev team are running migrations constantly with create table inside the migration, for tables that already exist. They are starting to add ‘If table not exist then do create table’ to new migrations but there is a lot of code already done, and there wasn’t a problem with a single mysql server, so they are loathe to update all the code.
When they run a create table for a table that already exists then if they specify a different charset or collation type to the mysql default then the node drops out. This only happens using laravel/php. Using workbench or anything else returns an error as it should and the cluster keeps working.
This code in Laravel/PHP makes the node drop out of the cluster?
create table brokers
(name
varchar(255) not null) default character set utf8 collate ‘utf8_unicode_ci’;
But this one doesn’t…
create table brokers
(name
varchar(255) not null)');
Both times the error code SQLSTATE (42S01) Base table already exists is returned which is correct.
Thanks
Mike
This is the mysql err log when the node drops out of the cluster;
============================
2023-01-23T15:05:38.696342Z 0 [Note] [MY-000000] [Galera] Member 2(dev-pxc-cluster-node-1) initiates vote on 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688,96c8de7a7cc64f40: Table 'cluster_test' already exis
ts, Error_code: 1050;
2023-01-23T15:05:38.696438Z 0 [Note] [MY-000000] [Galera] Votes over 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688:
96c8de7a7cc64f40: 1/3
Waiting for more votes.
2023-01-23T15:05:38.698678Z 0 [Note] [MY-000000] [Galera] Member 0(dev-pxc-cluster-node-2) initiates vote on 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688,9aa9a058451d27cc: 'utf8' is currently an alias for
the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous., Error_code: 3719; 'utf8mb3_unicode_ci' is a collation of the depre
cated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead., Error_code: 3778; Table 'cluster_test' already exists, Error_code: 1050;
2023-01-23T15:05:38.698742Z 0 [Note] [MY-000000] [Galera] Votes over 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688:
96c8de7a7cc64f40: 1/3
9aa9a058451d27cc: 1/3
Waiting for more votes.
2023-01-23T15:05:38.698777Z 0 [Note] [MY-000000] [Galera] Member 1(dev-pxc-cluster-node-3) initiates vote on 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688,9aa9a058451d27cc: 'utf8' is currently an alias for
the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous., Error_code: 3719; 'utf8mb3_unicode_ci' is a collation of the depre
cated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead., Error_code: 3778; Table 'cluster_test' already exists, Error_code: 1050;
2023-01-23T15:05:38.698834Z 0 [Note] [MY-000000] [Galera] Votes over 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688:
96c8de7a7cc64f40: 1/3
9aa9a058451d27cc: 2/3
Winner: 9aa9a058451d27cc
2023-01-23T15:05:38.699152Z 367 [ERROR] [MY-000000] [Galera] Inconsistency detected: Inconsistent by consensus on 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688
at galera/src/replicator_smm.cpp:process_apply_error():1440
2023-01-23T15:05:38.700675Z 367 [Note] [MY-000000] [Galera] Closing send monitor...
2023-01-23T15:05:38.700749Z 367 [Note] [MY-000000] [Galera] Closed send monitor.
2023-01-23T15:05:38.700782Z 367 [Note] [MY-000000] [Galera] gcomm: terminating thread
2023-01-23T15:05:38.700889Z 367 [Note] [MY-000000] [Galera] gcomm: joining thread
2023-01-23T15:05:38.701265Z 367 [Note] [MY-000000] [Galera] gcomm: closing backend
2023-01-23T15:05:38.716635Z 367 [Note] [MY-000000] [Galera] Current view of cluster as seen by this node
view (view_id(NON_PRIM,11569cdc-971a,21)
memb {
d564d9bd-99eb,0
}
joined {
}
left {
}
partitioned {
11569cdc-971a,0
4df0c6dd-a314,0
}
)
2023-01-23T15:05:38.716699Z 367 [Note] [MY-000000] [Galera] PC protocol downgrade 1 -> 0
2023-01-23T15:05:38.716717Z 367 [Note] [MY-000000] [Galera] Current view of cluster as seen by this node
view ((empty))
2023-01-23T15:05:38.717337Z 367 [Note] [MY-000000] [Galera] gcomm: closed
2023-01-23T15:05:38.717402Z 0 [Note] [MY-000000] [Galera] New COMPONENT: primary = no, bootstrap = no, my_idx = 0, memb_num = 1
2023-01-23T15:05:38.717550Z 0 [Note] [MY-000000] [Galera] Flow-control interval: [100, 100]
2023-01-23T15:05:38.717594Z 0 [Note] [MY-000000] [Galera] Received NON-PRIMARY.
2023-01-23T15:05:38.717618Z 0 [Note] [MY-000000] [Galera] Shifting SYNCED -> OPEN (TO: 1051688)
2023-01-23T15:05:38.717667Z 0 [Note] [MY-000000] [Galera] New SELF-LEAVE.
2023-01-23T15:05:38.717733Z 16 [Note] [MY-000000] [Galera] ================================================
View:
id: 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688
status: non-primary
protocol_version: 4
capabilities: MULTI-MASTER, CERTIFICATION, PARALLEL_APPLYING, REPLAY, ISOLATION, PAUSE, CAUSAL_READ, INCREMENTAL_WS, UNORDERED, PREORDERED, STREAMING, NBO
final: no
own_index: 0
members(1):
0: d564d9bd-9b2b-11ed-99eb-1a2381e29aad, dev-pxc-cluster-node-1
=================================================
2023-01-23T15:05:38.717759Z 16 [Note] [MY-000000] [Galera] Non-primary view
2023-01-23T15:05:38.717755Z 0 [Note] [MY-000000] [Galera] Flow-control interval: [0, 0]
2023-01-23T15:05:38.717770Z 16 [Note] [MY-000000] [WSREP] Server status change synced -> connected
2023-01-23T15:05:38.717789Z 16 [Note] [MY-000000] [WSREP] wsrep_notify_cmd is not defined, skipping notification.
2023-01-23T15:05:38.717857Z 16 [Note] [MY-000000] [WSREP] wsrep_notify_cmd is not defined, skipping notification.
2023-01-23T15:05:38.717788Z 0 [Note] [MY-000000] [Galera] Received SELF-LEAVE. Closing connection.
2023-01-23T15:05:38.717926Z 0 [Note] [MY-000000] [Galera] Shifting OPEN -> CLOSED (TO: 1051688)
2023-01-23T15:05:38.717973Z 0 [Note] [MY-000000] [Galera] RECV thread exiting 0: Success
2023-01-23T15:05:38.718129Z 367 [Note] [MY-000000] [Galera] recv_thread() joined.
2023-01-23T15:05:38.718146Z 367 [Note] [MY-000000] [Galera] Closing replication queue.
2023-01-23T15:05:38.718154Z 367 [Note] [MY-000000] [Galera] Closing slave action queue.
2023-01-23T15:05:38.718318Z 16 [Note] [MY-000000] [Galera] ================================================
View:
id: 4ab2da3b-3cc2-11ed-b34d-7aa6ac77c226:1051688
status: non-primary
protocol_version: 4
capabilities: MULTI-MASTER, CERTIFICATION, PARALLEL_APPLYING, REPLAY, ISOLATION, PAUSE, CAUSAL_READ, INCREMENTAL_WS, UNORDERED, PREORDERED, STREAMING, NBO
final: yes
own_index: -1
members(0):
=================================================
2023-01-23T15:05:38.718331Z 16 [Note] [MY-000000] [Galera] Non-primary view
2023-01-23T15:05:38.718341Z 16 [Note] [MY-000000] [WSREP] Server status change connected -> disconnected
2023-01-23T15:05:38.718349Z 16 [Note] [MY-000000] [WSREP] wsrep_notify_cmd is not defined, skipping notification.
2023-01-23T15:05:38.718361Z 16 [Note] [MY-000000] [WSREP] wsrep_notify_cmd is not defined, skipping notification.
2023-01-23T15:05:38.728001Z 12 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 12
2023-01-23T15:05:38.728043Z 15 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 15
2023-01-23T15:05:38.728106Z 2 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 2
2023-01-23T15:05:38.728363Z 10 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 10
2023-01-23T15:05:38.728377Z 14 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 14
2023-01-23T15:05:38.728055Z 13 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 13
2023-01-23T15:05:38.728726Z 11 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 6 thd: 11
2023-01-23T15:05:38.729896Z 0 [Note] [MY-000000] [Galera] Service thread queue flushed.
2023-01-23T15:05:38.730042Z 16 [Note] [MY-000000] [Galera] ####### Assign initial position for certification: 00000000-0000-0000-0000-000000000000:-1, protocol version: 5
2023-01-23T15:05:38.730096Z 16 [Note] [MY-000000] [WSREP] Applier thread exiting ret: 0 thd: 16