当前位置:网站首页>Solution of gbase 8s livelock and deadlock
Solution of gbase 8s livelock and deadlock
2022-06-25 04:32:00 【Eight delicacies tofu】
The lock problem ( Lock wait 、 Deadlock ) Most of them do not understand the management of locks correctly 、 The way of use leads to . To solve the problem of lock , We can try from the following aspects .
1.GBase8s database Lock resource Set up ONCONFIG Parameters LOCKS Setting is to configure an appropriate number of locks for the database . By searching online Does the log dynamically add locks :grep 'dynamically allocated' online.log Set a reasonable locking mode for the table 、 Row level lock or page level lock .
2. Application lock Usage mode Set up adopt onstat -g sql see SESSION Lock waiting mode and isolation level used , Set a reasonable isolation level and lock waiting mode for different applications . If the following statement is added to the application :
set isolation to dirty read;
set lock
3. Applications avoid using unnecessary locks Many applications SQL Statement because the index is not used correctly INDEX, This results in locking the entire table , The problem of lock concurrency is caused by . Need to pass through SQL Optimize and create reasonable indexes , Avoid lock conflicts caused by sequential scanning .
Lock waiting problem due to sequential scanning : Create table test_lock, Using row level locks , And in c1 Create index on field , Insert 3 Line test data .
create table test_lock (c1 int,c2 int,c3 char(10)) lock mode row;
create index idx_test_lock on test_lock(c1);
insert into test_lock values(1,1,'abc');
insert into test_lock values(2,2,'abc');
insert into test_lock values(3,3,'abc');Session 1 Modify the... By index scanning 2 rows :
Begin work;
update test_lock set c3='new' where c1=2;here ,Session 1 Add... To the second line of record X lock .
Session 2 adopt c2 Fields are scanned sequentially to modify the 3 rows .
Begin work;
update test_lock set c3='new' where c2=3;because Session 2 Adopt sequential scanning mode , In the course of scanning, it is found that 2 Row record added X lock , Therefore, a lock conflict error is prompted :
244: Could not do a physical-order read to fetch next row.
107: ISAM error: record is locked.If in c2 Add index... To the field , Or by c1=3 Modify the record in the third line , Then there will be no lock problem .
4. Applications Optimize to avoid too long Occupancy lock A lock is a public resource , Lock resources need to be released as soon as possible , Reduce waiting , If every transaction can be completed at the microsecond level , Then the lock will not be our concern , Reducing the lock time is also the key to solve the lock problem . We can go through Avoid big business , Split a large transaction into multiple submissions , So the lock can be released as soon as possible . in addition , Optimize application processing performance , Such as the rational use of indexes , Can speed up transaction processing , The possibility that lock conflicts can be solved invisibly .
5. Set up Reasonable isolation level Different isolation levels use different locks , Set a reasonable isolation level , It can improve the concurrency of applications , Improve the processing capacity of the system , Reduce lock conflicts , Avoid lock problems caused by read operations .
边栏推荐
- sql_ mode=only_ full_ group_ By's pit
- Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
- Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)
- 彻底理解数据库事务
- 【openwrt】推荐一个国内开发的openwrt的版本,iStoreOS简介,非常好用,主要是做了一些优化。解决了汉化的问题。
- Should I use on or where for the left join
- Lecture record: new application of inertial navigation - inertial measurement
- 515. 在每个树行中找最大值 / 剑指 Offer II 095. 最长公共子序列
- 关于TCP连接三次握手的详细总结
- Where is the red area of OpenCV?
猜你喜欢

Where is the red area of OpenCV?
![[openwrt] we recommend a domestically developed version of openwrt, an introduction to istoreos. It is very easy to use. It is mainly optimized. It solves the problem of Sinicization.](/img/62/6152d5a30c92a340cb286c7b1cbc54.png)
[openwrt] we recommend a domestically developed version of openwrt, an introduction to istoreos. It is very easy to use. It is mainly optimized. It solves the problem of Sinicization.

Lecture record: history and development of strapdown inertial navigation solution

关于TCP连接四次握手(或者叫四次挥手)的详细总结

论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)

Watch out for the stolen face! So many risks of face recognition used every day?

Laravel document sorting 4. Controller

Numpy NP tips: use OpenCV to interpolate and zoom the array to a fixed shape cv2 resize(res, dsize=(64, 64), interpolation=cv2. INTER_ CUBIC)

Basic use of OBS browser+ browser

Acmstreamopen return value problem
随机推荐
A detailed summary of TCP connection triple handshake
GBASE 8s 索引R树
Error 1062 is reported during MySQL insertion, but I do not have this field.
【LeetCode】148. Sort linked list
GBASE 8s的并行操作问题场景描述
Comparison of towe/ JIRA / tapd / Zen collaboration platforms
Laravel document sorting 7. View
SQL injection details
ThinkPHP is integrated with esaywechat. What's wrong with wechat payment callback without callback?
什么是数据持久化?
Office macro virus bounce shell experiment
cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
Zoran community
GBASE 8s 索引B+树
Laravel document sorting 11. System architecture
PHP code audit 2 - these functions must be known and understood
GBASE 8s存储过程语法结构
Doubts about judging the tinyint field type of MySQL
A detailed summary of four handshakes (or four waves) over TCP connections
Introduction to intstream API