MariaDB Galera集群:SELECT ... FOR UPDATE为什么没有锁定?

时间:2018-06-22 09:20:01

标签: mysql mariadb galera mysql-cluster

为什么记录未在MariaDB Galera Cluster 10.2.11的2个节点之间锁定?

Node 1                                        Node 2

START TRANSACTION;
SELECT * FROM table WHERE id = 1 FOR UPDATE;
+----+------+
| id | info |
+----+------+
|  1 | 123  |
+----+------+

                                              START TRANSACTION;
                                              SELECT * FROM table WHERE id = 1 FOR UPDATE;
                                              +----+------+
                                              | id | info |
                                              +----+------+
                                              |  1 | 123  |
                                              +----+------+

如果我在一个节点上通过两个连接尝试此操作-锁定就可以了。

我的服务器配置(/etc/my.cnf.d/server.cnf)

[server]

[mysqld]
log_bin = prod-bin
sql_mode = STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
transaction-isolation = READ-COMMITTED
slow_query_log = ON
slow_launch_time = 2
innodb_buffer_pool_size=3G
expire_logs_days = 30
auto_increment_increment = 3
auto_increment_offset = 2
sql_error_log_rotate = TRUE
max_connections = 2000

[galera]
wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.0.102,192.168.0.80,192.168.0.23
wsrep_cluster_name="cluster"
wsrep_sst_method=xtrabackup
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2

[embedded]

[mariadb]

[mariadb-10.1]

谢谢。

0 个答案:

没有答案