当前位置:网站首页>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 .
边栏推荐
- EasyRecovery15非常好用的电脑数据恢复软件
- English Grammar - pronunciation rules
- What is data persistence?
- 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)
- Error 1062 is reported during MySQL insertion, but I do not have this field.
- 【Kubernetes系列】Helm的安装使用
- unity Quad剔除背面并剔除透明部分的shader
- 冰冰学习笔记:循环队列的实现
- Retrofit source code analysis
- 讲座记录《多种空间大地测量技术的数据处理方法和应用》
猜你喜欢

Coinlist queuing tutorial to improve the winning rate

CTF_ Web: Advanced questions of attack and defense world expert zone WP (9-14)

English Grammar - pronunciation rules

i. Max development board learning record

CTF_ Web:php weak type bypass and MD5 collision

Text keyword extraction: ansj

Acmstreamopen return value problem

【openwrt】推荐一个国内开发的openwrt的版本,iStoreOS简介,非常好用,主要是做了一些优化。解决了汉化的问题。
Zoran community

CTF_ Web: Advanced questions of attack and defense world expert zone WP (19-21)
随机推荐
GBASE 8s 总体架构
OBS Browser+浏览器的基本使用
JS arrow function
Detailed explanation of flex attributes in flex layout
Easyrecovery15 very easy to use computer data recovery software
2020.3.3 notes async/await and promise and Then processes and threads
SQL, CTE, flg case problems
Introduction to intstream API
GBase 8s 锁的分类
地方/園區產業規劃之 “ 如何進行產業定比特 ”
1280_C语言求两个无符号整形的平均值
Synchronous and asynchronous functions (callback function, promise, generator, async/await)
UCLA | generative pre training for black box optimization
Laravel document sorting 9. Blade template
微信小程序父子组件之间传值
@Requestbody solution get parameter is null
GBASE 8s的隔离级别介绍
Shutter fittedbox component
Retrofit 源码分析
Acmstreamopen return value problem