当前位置:网站首页>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 .
边栏推荐
- Introduction to single chip microcomputer: LED lights cycle to the left and turn on
- vscode常用快捷键
- Using JS to implement click events
- 2.19 haas506 2.0开发教程 - bluetooth - 蓝牙通信(仅支持2.2以上版本)
- What is the ranking of good securities companies? Is online account opening safe
- JUC源码学习笔记3——AQS等待队列和CyclicBarrier,BlockingQueue
- C# - partial 关键字
- Lsyncd set up synchronous image - use lsyncd to realize real-time synchronization between local and remote servers
- AttributeError: module ‘seaborn‘ has no attribute ‘histplot‘
- SQL row to column, column to row
猜你喜欢

降噪蓝牙耳机哪个好?性价比最高的降噪蓝牙耳机排行

2.19 haas506 2.0开发教程 - bluetooth - 蓝牙通信(仅支持2.2以上版本)

From which dimensions can we judge the quality of code? How to have the ability to write high-quality code?

矩阵的秩和图像的秩的一些了解

After taking aiyouteng's medicine, Naifei's condition improved

Introduction to kettle messy notes

faster-rcnn 训练自己的数据集
![[SWT] user defined data table](/img/bf/a0c60f1ac9461874b8a573f805e1fe.png)
[SWT] user defined data table

机器学习笔记 - 构建推荐系统(5) 前馈神经网络用于协同过滤

Fast RCNN trains its own data set
随机推荐
从哪些维度评判代码质量的好坏?如何具备写出高质量代码的能力?
memcache缓存应用(LNMP+memcache)
YOLO5Face:为什么要重新发明人脸检测器
yolov6训练自己的数据集
Dynamics 365: explain virtual entity from 0 to 1
Personal practical experience: Data Modeling "whether account data belongs to dimension or account domain"
Using JS to implement click events
徽商期货平台安全吗?办理期货开户没问题吧?
Kubernetes GPU's Dilemma and failure
Nine key measures to maintain server security in Hong Kong
Arduino IDE ESP32固件安装和升级教程
Dedecms editor supports automatic pasting of word pictures
Dynamics crm: mailbox configuration (III) - configure email server profiles and mailboxes
Introduction to single chip microcomputer: LED bidirectional water lamp
PHP中array_merge的坑
Experience summary of slow SQL problems
iptables常用命令小清单
简化理解:发布订阅
Research on stability of time-delay systems based on Lambert function
AttributeError: module ‘seaborn‘ has no attribute ‘histplot‘