当前位置:网站首页>MySQL write lock does not take effect
MySQL write lock does not take effect
2022-07-24 15:54:00 【Nie Bingyu】
1. background
Need to verify : Program query mylsq Whether the execution process after failure meets expectations .
Procedures to be tested :1. From time to time mysql Read data from ;2. The program has configured read-write timeout .
Verification process :
After the program starts , Add write lock , Next query mysql It should have failed , Will execute the failed process . After adding write lock , It can also read data correctly .
2. Lock / Unlock
Lock :
- locak table ‘table’ [read|write]
Unlock :
- unlock tables
3. Cause of failure
Performance after locking :
- Regular reading of data in the program is normal
- Current window terminal , Can query data
- Newly opened terminal , Query data blocking
In terms of performance 1 and 2 Before locking, there are from db Read data in ,3 Start reading data after locking . Speculation is related to caching .
Query found open cache :
MariaDB> show variables like "%query_cache%";
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| have_query_cache | YES |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 33554432 |
| query_cache_strip_comments | OFF |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
+------------------------------+----------+
The cache will expire after the data is updated , Update the table data , Program timing query failed , In line with expectations .
4. summary
When the table needs to be locked for verification , If the data can be read after locking , The reason for the invalidation may be related to opening the cache . terms of settlement , perform update or insert Update the table .
边栏推荐
- Error: pidfile (celerybeat.pid) already exists when celery starts beat
- 20. Shell programming variables
- 15. Talk about these common multi-threaded interview questions
- How to choose the appropriate data type for fields in MySQL?
- ReentrantLock 可重入锁
- Getting started with OpenMP
- Small list of iptables common commands
- 【AdaptiveAvgPool3d】pytorch教程
- Class assignment (6) - 575. Word division (word)
- Kubernetes GPU's Dilemma and failure
猜你喜欢

Dynamics 365: how to get the threshold value of executemullerequest in batch requests

Dedecms editor supports automatic pasting of word pictures

yolov4 训练自己的数据集

有了这个机器学习画图神器,论文、博客都可以事半功倍了!

【SWT】自定义数据表格

Will the capital market be optimistic about TCL's folding screen story?

Research on the efficiency of numpy array access

Dynamics 365: how to get the authentication information required to connect to D365 online from azure

Fast RCNN trains its own data set

Leetcode 223. 矩形面积
随机推荐
Pattern water flow lamp 1: check the table and display the LED lamp
20. Shell programming variables
Dedecms editor supports automatic pasting of word pictures
Force button 31. Next arrangement -- double finger needling
Kubernetes GPU's Dilemma and failure
Power of leetcode 231.2
You are only one SQL statement away from the tdengine Developer Conference!
降噪蓝牙耳机哪个好?性价比最高的降噪蓝牙耳机排行
LaneATT
2.19 haas506 2.0开发教程 - bluetooth - 蓝牙通信(仅支持2.2以上版本)
22 bracket generation
Mysql8 encountered the problem of stopping after the service was started
每天20分钟之feign
Dynamics 365: how to get the threshold value of executemullerequest in batch requests
Introduction to bermudagrass
上课作业(6)——#575. 单词的划分(word)
收益率在百分之六以上的理财产品,请说一下
Yolov3 trains its own data set
yolov4 训练自己的数据集
faster-rcnn 训练自己的数据集