当前位置:网站首页>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 .
边栏推荐
- Laravel document sorting 8. Middleware
- 【Kubernetes系列】Helm的安装使用
- 如何筛选出和产品相关的词,精准排除掉无效词
- PostgreSQL数据库WAL——RM_HEAP_ID日志记录动作
- Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
- 1、项目第二阶段——用户注册和登陆
- navicat可不可以直接操作安卓数据库SQLite
- sql_ mode=only_ full_ group_ By's pit
- 关于TCP连接三次握手的详细总结
- Can Navicat directly operate the Android database SQLite
猜你喜欢

Can Navicat directly operate the Android database SQLite

Finereport displays and hides column data according to conditions

Intel 13th generation core showed its true colors for the first time: 68mb cache improved significantly

Lecture record: history and development of strapdown inertial navigation solution

A detailed summary of TCP connection triple handshake

CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
Zoran community

UCLA | 用于黑盒优化的生成式预训练

"How to carry out industrial positioning" in local / Park industrial planning

讲座记录《捷联惯导解算的历史及发展》
随机推荐
Laravel document sorting 1. Installation and Preliminary Configuration
GBASE 8s存儲過程語法結構
A detailed summary of four handshakes (or four waves) over TCP connections
什么是持久化?redis 持久化中的RDB和AOF是什么?
Laravel document sorting 8. Middleware
记录小知识点
Text keyword extraction: ansj
微信小程序父子组件之间传值
SQL, CTE, flg case problems
CTF_ Web: Learn flask template injection (SSTI) from 0
What is data persistence?
GBASE 8s活锁、死锁问题的解决
Lecture record: new application of inertial navigation - inertial measurement
How to draw an industry investment map
2021.8.29 notes: register, bit operation, pointer, structure
LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路
Laravel document sorting 6. Response
如何筛选出和产品相关的词,精准排除掉无效词
GBASE 8s存储过程执行和删除
Where is the red area of OpenCV?