- What's New
- Function Overview
- Service Overview
- Billing
- Getting Started
-
User Guide
- Permissions Management
- Logging in to a DB Instance
-
MySQL
- Account Management
- Database Management
- SQL Operations
- Table Management
- View Management
- Stored Procedure Management
- Event Management
- Trigger Management
- Function Management
- Data Import and Export
- Data Generator (Not Promoted)
- Tracking and Rolling Back Data (Not Promoted)
- Task Management
- Table Structure Comparison and Synchronization (Not Promoted)
- Intelligent O&M (New Version)
- Intelligent O&M (Old Version)
- RDS for SQL Server
- PostgreSQL
-
RDS for MariaDB
- Account Management
- Database Management
- SQL Operations
- Table Management
- View Management
- Stored Procedure Management
- Event Management
- Trigger Management
- Function Management
- Data Import and Export
- Data Generator (Not Promoted)
- Task Management
- Table Structure Comparison and Synchronization (Not Promoted)
- Intelligent O&M
- GaussDB
-
TaurusDB
- Account Management
- Database Management
- SQL Operations
- Table Management
- View Management
- Event Management
- Stored Procedure Management
- Function Management
- Trigger Management
- Data Import and Export
- Data Generator (Not Promoted)
- Task Management
- Table Structure Comparison and Synchronization (Not Promoted)
- Intelligent O&M
- GeminiDB Cassandra
- GaussDB(DWS) (Unavailable Soon)
- DDS
- DDM
- Audit
- Event Monitoring
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs (in OBT)
- API Version Queries
-
Cloud DBA
- Registering a Database User
- Modifying a Database User
- Deleting a Database User
- Querying Intelligent O&M Quotas
- Querying Database User Information
- Querying Database Users
- Killing Sessions
- Querying the SQL Execution Plan (GET Request)
- Querying the SQL Execution Plan (POST Request)
- Querying Metadata Locks
- Querying Instance Sessions
- Querying InnoDB Lock Waits
- Enabling or Disabling SQL Explorer and Slow Query Log
- Querying Whether SQL Explorer and Slow Query Log Are Enabled
- Exporting Slow Query Logs
- Exporting SQL Explorer Data
- Querying Whether SQL Statement Concurrency Control Is Enabled
- Enabling or Disabling SQL Statement Concurrency Control
- Querying Concurrency Control Rules of SQL Statements
- Generate Keywords of a Concurrency Control Rule from the Original SQL Statement
- Creating a Concurrency Control Rule for SQL Statements
- Deleting a Concurrency Control Rule of SQL Statements
- Querying SQL Statement Concurrency Control Tasks
- Exporting the Top SQL Template List
- Exporting SQL Execution Time Distribution
- Exporting the Slow SQL Template List
- Viewing the Instance List on the Intelligent O&M Page
- Setting a Shared Link
- Deleting a Shared Link
- Executing a SQL Diagnosis
- Obtaining Diagnosis Results
- Creating an Instance Diagnosis Task
- Querying Instance Diagnosis Reports
- Obtaining an Instance Diagnosis Report
- Synchronizing the Instance List
- Deprecated APIs
- Permissions Policies and Supported Actions
- Appendixes
-
FAQs
-
Product Consulting
- How Is DAS Billed?
- Which Data Sources Does DAS Support?
- Does DAS Support Multi-Region Access?
- Where Is SQL Execution Records Saved If I Enable This Function?
- What Should I Enter in the Database Column to Log In to a PostgreSQL DB Instance on the DAS Console?
- Will I Be Changed If I Enable Collect Metadata Periodically and Show Executed SQL Statements on the Add Login Page?
-
Managing connections
- What Should I Do If I Can't Connect to My DB Instance Due to Insufficient Permissions?
- What Should I Do If I Can't Connect to My RDS for MySQL Instance?
- What Should I Do If I Can't Connect to My ECS (MySQL) Instance?
- What Should I Do If I Can't Connect to My RDS for SQL Server Instance?
- What Should I Do If I Can't Connect to My ECS (Microsoft SQL Server) Instance?
- What Should I Do If I Can't Connect to My RDS for PostgreSQL Instance?
- What Should I Do If I Can't Connect to My ECS (PostgreSQL) Instance?
- What Should I Do If I Can't Connect to My DDS Instance?
- What Should I Do If I Can't Connect to My GaussDB(for MySQL) Instance?
- What Should I Do If I Can't Connect to My GaussDB Instance?
- What Should I Do If I Can't Connect to My DDM Instance?
- How Do I View and Modify ECS Security Group Rules?
- How Do I View and Modify Firewall Rules?
- What Should I Do If My Connection Fails?
-
Usage
- What Can I Do If Garbled Characters Are Displayed in the Exported Database Result Set?
- What Are the Precautions for Connecting DAS to a Third-Party Client?
- What Are the Username and Password for DAS?
- What Should I Do If Table Obtaining Times Out?
- How Do I Modify the Collation?
- When a user creates a data tracking task, an error message indicating that the current user does not have the OBS operator permissions is displayed.
- Resource Freezing, Release, Deletion, and Unsubscription
-
Product Consulting
- Glossary
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
-
User Guide
- Permissions Management
- Logging In to the DAS Console
- Adding Login Information
- Modifying Login Information
- Deleting Login Information
- Logging In to Databases Shared by Others
- MySQL DB Instance Management (Development Tool)
- Microsoft SQL Server DB Instance Management (Development Tool)
- PostgreSQL DB Instance Management (Development Tool)
- DDS DB Instance Management (Development Tool)
- Enterprise Change Approval
- Intelligent O&M
- FAQs
- Change History
-
User Guide (Kuala Lumpur Region)
- Service Overview
- Getting Started
-
User Guide
- Permissions Management
- Logging in to a DB Instance
-
MySQL
- Account Management
- Database Management
- SQL Operations
- Table Management
- View Management
- Stored Procedure Management
- Event Management
- Trigger Management
- Function Management
- Data Import and Export
- Data Generator (Not Promoted)
- Tracking and Rolling Back Data (Not Promoted)
- Task Management
- Table Structure Comparison and Synchronization (Not Promoted)
- Intelligent O&M (New Version)
- Intelligent O&M
- RDS for SQL Server
- PostgreSQL
- DDS
- DDM
- Audit
-
FAQs
-
Managing connections
- What Should I Do If I Can't Connect to My RDS for MySQL Instance?
- What Should I Do If I Can't Connect to My ECS (MySQL) Instance?
- What Should I Do If I Can't Connect to My RDS for PostgreSQL Instance?
- What Should I Do If I Can't Connect to My ECS (PostgreSQL) Instance?
- What Should I Do If I Can't Connect to My DDS Instance?
- What Can I Do If a GaussDB(for MySQL) Instance Fails to Be Connected?
- What Should I Do If I Can't Connect to My GaussDB Instance?
- What Should I Do If I Can't Connect to My DDM Instance?
- How Do I View and Modify ECS Security Group Rules?
- How Do I View and Modify Firewall Rules?
- What Should I Do If My Connection Fails?
- Usage
-
Managing connections
- Change History
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Show all
Copied.
Lock Analysis
Intelligent O&M provides metadata lock, InnoDB lock wait, recent deadlock, and full deadlock analysis. This section describes how to perform lock analysis on an RDS for MySQL instance.
Prerequisites
You have created an RDS for MySQL instance.
Procedure
- Write test data to a table.
- Create test database das_test in the destination RDS for MySQL instance. For details, see Creating a Database.
- Log in to the RDS for MySQL database through DAS. For details, see Logging In to a Huawei Cloud DB Instance.
- Run the following SQL statement to create the shopping table in the das_test database:
CREATE TABLE shopping (
a int NOT NULL AUTO_INCREMENT,
b int,
c int,
PRIMARY KEY (a),
UNIQUE KEY u_k (b, c)
);
- Run the following command to write test data to the shopping table:
insert into shopping(b,c) values(1,1),(1,5),(1,9);
- Analyze and process metadata locks.
NOTE:
- Metadata locks are used to ensure consistency between DDL and DML operations. Executing DDL operations on a table generates metadata write locks. If there is a metadata lock, all subsequent SELECT, DML, and DDL operations on the table will be blocked, causing a backlog of connections.
- Metadata locks are displayed in real time, so you can quickly locate and terminate sessions holding metadata locks to restore blocked operations.
- This function is unavailable for DML locks. You can view and analyze them on the InnoDB Locks page.
- Up to 1,000 records can be displayed.
- Log in to the Huawei Cloud DB instance and execute a SQL statement to create session 1.
- Query data in the shopping table.
select a from shopping;
The following result is displayed:
Figure 1 Querying data in the test table - Start a transaction and update data in the shopping table. Do not submit the transaction.
BEGIN;
UPDATE shopping SET b = 3 WHERE a =1;
- Query data in the shopping table.
- Create session 2 and execute the following statement to add an index to the shopping table:
ALTER TABLE shopping ADD INDEX idx_name(b);
- Go to the DAS homepage. In the navigation pane, choose Intelligent O&M > Instance List.
- Locate the target instance, click Details. Click the Locks and Transactions, Locks, and Metadata Locks tabs in sequence. Metadata locks of the current instance are displayed.
Figure 2 Metadata locks
- Select the target session and click Kill Session.
Figure 3 Selecting the target metadata lock
- Refresh the metadata lock list. The query statement has been executed, and the DDL statement is being executed.
NOTE:
If the shopping table contains a small amount of data, the DDL statement will be executed successfully immediately after the session is killed.
Figure 4 Metadata lock list updated after the session is killed
- Analyze InnoDB lock waits.
NOTE:
- InnoDB lock waits generated before DML operations are displayed in real time. You can quickly locate the session waits and any blocks that happened when multiple sessions update the same piece of data at the same time. You can also terminate the source session that holds locks to restore blocked operations.
- This function is unavailable for DDL locks. You can view and analyze them on the Metadata Locks page.
- Log in to the Huawei Cloud DB instance and execute a SQL statement to create session 1.
- Query data in the shopping table.
select a from shopping;
The following result is displayed:
Figure 5 Querying data in the test table - Start a transaction and update data in the shopping table. Do not submit the transaction.
BEGIN;
UPDATE shopping SET b = 100 WHERE a < 5;
- Query data in the shopping table.
- Create session 2 and update the statement that has been updated in session 1:
- Create session 3 and update the statement that has been updated in session 1:
- Go to the DAS homepage. In the navigation pane, choose Intelligent O&M > Instance List.
- Locate the target instance, click Details. Click the Locks and Transactions, Locks, and InnoDB Locks tabs in sequence. InnoDB lock waits of the current instance are displayed.
Figure 6 InnoDB lock waits
- In session 1, run the following command to submit the transaction:
- Check the InnoDB lock wait. No lock wait is displayed on the page.
- Analyze a recent deadlock.
NOTE:
- DAS analyzes the latest deadlock log displayed in the output of SHOW ENGINE INNODB STATUS. If there are multiple deadlocks, only the latest one is analyzed.
- Enable innodb_deadlock_detect (only for RDS for MySQL 5.7).
- Log in to the Huawei Cloud DB instance and execute the following SQL statement to query data in the shopping table.
select a from shopping;
The following result is displayed:
Figure 7 Querying data in the test table - Use the SQL Query module to query sessions 1 and 2. Simulate a deadlock.
Table 1 Simulating a deadlock Session 1
Session 2
begin;
begin;
insert into shopping(b,c) values(1,8);
-
-
insert into shopping(b,c) values(1,8);
insert into shopping(b,c) values(1,6);
-
-
A deadlock is generated.
- Go to the DAS homepage. In the navigation pane, choose Intelligent O&M > Instance List.
- Locate the target instance, click Details. Click the Locks and Transactions, Locks, and Deadlock Analysis tabs in sequence. Click Create Lock Analysis, refresh the page, and check the list.
Figure 8 Recent deadlock
- Click View Details in the Operation column to view parsed deadlocks and original logs.
Figure 9 Details of a recent deadlock
- Analyze full deadlocks.
NOTE:
- DAS analyzes error logs at regular intervals, parses deadlock information, and performs comprehensive deadlock analysis.
- Dependency parameters:
- Enable innodb_deadlock_detect (only for RDS for MySQL 5.7).
- Enable innodb_print_all_deadlocks and set log_error_verbosity (only for RDS for MySQL of versions other than 5.7) to 3.
- Up to 10,000 records can be displayed.
- Log in to the DAS console.
- Click
in the upper left corner and select a region and project.
- Click
in the upper left corner. Choose Databases > Data Admin Service.
- In the navigation pane, choose Intelligent O&M > Instance List.
- Locate the target instance, click Details. Click the Locks and Transactions, Locks, and Full Deadlock Analysis tabs in sequence. Enable Full Deadlock Analysis.
- In the navigation pane, choose Development Tool.
You can also click Go to Development Tool on the overview page.
- Select the target database, click Log In in the Operation column, and run the following SQL statement to query data in the shopping table.
select a from shopping;
The following result is displayed:
Figure 10 Querying data in the test table - Use the SQL Query module to query sessions 1 and 2. Simulate a deadlock.
Table 2 Simulating a deadlock Session 1
Session 2
begin;
begin;
insert into shopping(b,c) values(1,8);
-
-
insert into shopping(b,c) values(1,8);
insert into shopping(b,c) values(1,6);
-
-
A deadlock is generated.
- View the full deadlock analysis list.
Figure 11 Full deadlock
- Click View Details in the Operation column to view parsed deadlocks and original logs.
Figure 12 Full deadlock details
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot