当前位置:网站首页>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 .
边栏推荐
- 1280_C语言求两个无符号整形的平均值
- Lecture record: history and development of strapdown inertial navigation solution
- L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding
- Finereport (sail soft) handling the problem that the histogram data label is blocked
- CTF_ Variable coverage in web:php
- How to screen out words related to products and eliminate invalid words accurately
- 【esp32学习之路6——flash加密】
- Error 1062 is reported during MySQL insertion, but I do not have this field.
- @Requestbody solution get parameter is null
- 【openwrt】推荐一个国内开发的openwrt的版本,iStoreOS简介,非常好用,主要是做了一些优化。解决了汉化的问题。
猜你喜欢
![LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
LeetCode 劍指Offer II 091 粉刷房子[動態規劃] HERODING的LeetCode之路

Coinlist how to operate the middle lot number security tutorial

navicat可不可以直接操作安卓数据库SQLite

论文阅读《LSD-SLAM: Large-Scale Direct Monocular SLAM》

地方/園區產業規劃之 “ 如何進行產業定比特 ”

无法安装redis接口

CTF_ Web:php weak type bypass and MD5 collision

讲座记录《多种空间大地测量技术的数据处理方法和应用》

CTF_ Web:8-bit controllable character getshell

Finereport displays and hides column data according to conditions
随机推荐
Sourcetree pulls the code and prompts to fill in authentic, but the configuration cannot change the user
小白学习MySQL - 统计的'投机取巧'
"Comment positionner l'industrie" dans la planification industrielle locale / parc
Synchronous and asynchronous functions (callback function, promise, generator, async/await)
How many images can opencv open?
【Kubernetes系列】Helm的安装使用
kenlm
2021.4.15 note the difference between let, const and VaR in ES6
2021.8.29 notes: register, bit operation, pointer, structure
Communication problems in parent and child components of uniapp
Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)
【LeetCode】143. Rearrange linked list
Easyrecovery15 very easy to use computer data recovery software
GBASE 8S内存管理
Summary of various problems encountered by cocos2d-x
GBase 8s的封锁技术的基本介绍
彻底理解数据库事务
1280_ C language to find the average value of two unsigned integer
English Grammar - pronunciation rules
GBASE 8s存储过程语法结构