Loading...
MySQL 9.5 Reference Manual 9.5의 7.11 The LOCK_ORDER Tool의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
MySQL server는 mutex, rwlock(prlock 및 sxlock 포함), condition, 파일과 같은 수많은 내부 잠금 및 잠금 관련 프리미티브를 사용하는 멀티스레드 애플리케이션입니다. server 내부에서는 새로운 기능 구현 및 성능 향상을 위한 코드 리팩터링에 따라 잠금 관련 객체 집합이 변경됩니다. 잠금 프리미티브를 사용하는 모든 멀티스레드 애플리케이션과 마찬가지로, 여러 잠금이 동시에 보유되는 동안 실행 중에 교착 상태가 발생할 위험이 항상 존재합니다. MySQL의 경우 교착 상태의 영향은 치명적이며, 서비스가 완전히 중단됩니다.
잠금 획득 교착 상태를 감지하고, 런타임 실행이 교착 상태가 없도록 보장하기 위해, MySQL은 LOCK_ORDER 툴링을 지원합니다. 이를 통해 server 설계의 일부로 잠금 순서 의존성 그래프를 정의하고, 잠금 획득이 비순환적(acyclic)이며 실행 경로가 해당 그래프를 준수하는지 확인하기 위한 server 런타임 체크를 수행할 수 있습니다.
이 섹션은 LOCK_ORDER tool 사용에 대해 기본적인 수준에서만 정보를 제공합니다. 전체 세부 정보는 MySQL Server Doxygen documentation의 Lock Order 섹션을 참조하십시오. 해당 문서는
https://dev.mysql.com/doc/index-other.html
에서 확인할 수 있습니다.
LOCK_ORDER tool은 server를 디버깅하기 위한 것이며, 프로덕션 용도가 아닙니다.
LOCK_ORDER tool을 사용하려면 다음 절차를 따르십시오:
LOCK_ORDER 툴링이 포함되도록 CMake 옵션인 -DWITH_LOCK_ORDER=ON으로 구성합니다.참고
WITH_LOCK_ORDER 옵션이 활성화된 경우, MySQL 빌드에는 flex 프로그램이 필요합니다.
LOCK_ORDER tool을 활성화하여 server를 실행하려면, server 시작 시 lock_order 시스템 변수를 활성화합니다. LOCK_ORDER 구성을 위한 다른 시스템 변수도 여러 개 제공됩니다.
MySQL 테스트 스위트 동작의 경우, mysql-test-run.pl에는 테스트 케이스 실행 중에 LOCK_ORDER tool을 활성화할지 여부를 제어하는 --lock-order 옵션이 있습니다.
이후에 설명하는 시스템 변수는 MySQL이 LOCK_ORDER 툴링을 포함하도록 빌드되었다는 가정하에 LOCK_ORDER tool의 동작을 구성합니다. 기본 변수는 런타임에 LOCK_ORDER tool을 활성화할지 여부를 나타내는 lock_order입니다:
lock_order가 비활성화된 경우(기본값), 다른 LOCK_ORDER 시스템 변수는 아무런 효과도 갖지 않습니다.
lock_order가 활성화된 경우, 다른 시스템 변수는 어떤 LOCK_ORDER 기능을 활성화할지 구성합니다.
참고
일반적으로는 LOCK_ORDER tool이 mysql-test-run.pl을 --lock-order 옵션과 함께 실행하여 구성되도록 의도되어 있으며, mysql-test-run.pl이 LOCK_ORDER 시스템 변수를 적절한 값으로 설정합니다.
모든 LOCK_ORDER 시스템 변수는 server 시작 시 설정되어야 합니다. 런타임에는 값 조회만 가능하며 변경할 수 없습니다.
일부 시스템 변수는 lock_order_debug_loop와 lock_order_trace_loop와 같이 쌍으로 존재합니다. 이러한 쌍의 경우, 연관된 조건이 발생했을 때 변수는 다음과 같이 구분됩니다:
_debug_ 변수가 활성화되어 있으면 디버그 어서션이 발생합니다.
_trace_ 변수가 활성화되어 있으면 로그에 에러가 출력됩니다.
Table 7.13 LOCK_ORDER System Variable Summary
| Variable Name | Variable Type | Variable Scope |
|---|---|---|
| lock_order | Boolean | Global |
| lock_order_debug_loop | Boolean | Global |
| lock_order_debug_missing_arc | Boolean | Global |
| lock_order_debug_missing_key | Boolean | Global |
| lock_order_debug_missing_unlock | Boolean | Global |
| lock_order_dependencies | File name | Global |
| lock_order_extra_dependencies | File name | Global |
| lock_order_output_directory | Directory name | Global |
| lock_order_print_txt | Boolean | Global |
| lock_order_trace_loop | Boolean | Global |
| lock_order_trace_missing_arc | Boolean | Global |
| lock_order_trace_missing_key | Boolean | Global |
| lock_order_trace_missing_unlock | Boolean | Global |
| Variable Name | Variable Type | Variable Scope |
|---|
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order[={OFF |
| System Variable | lock_order |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
런타임에 LOCK_ORDER tool을 활성화할지 여부입니다. lock_order가 비활성화된 경우(기본값), 다른 LOCK_ORDER 시스템 변수는 아무런 효과도 갖지 않습니다. lock_order가 활성화된 경우, 다른 시스템 변수는 어떤 LOCK_ORDER 기능을 활성화할지 구성합니다.
lock_order가 활성화된 경우, server가 잠금 순서 그래프에 선언되지 않은 잠금 획득 시퀀스를 만나면 에러가 발생합니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-debug-loop[={OFF |
| System Variable | lock_order_debug_loop |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
잠금 순서 그래프에서 루프로 표시된 의존성을 만났을 때 LOCK_ORDER tool이 디버그 어서션 실패를 발생시킬지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-debug-missing-arc[={OFF |
| System Variable | lock_order_debug_missing_arc |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
잠금 순서 그래프에 선언되지 않은 의존성을 만났을 때 LOCK_ORDER tool이 디버그 어서션 실패를 발생시킬지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-debug-missing-key[={OFF |
| System Variable | lock_order_debug_missing_key |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
LOCK_ORDER tool이 Performance Schema로 적절히 인스트루먼트되지 않은 객체를 만났을 때 디버그 어서션 실패를 발생시킬지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-debug-missing-unlock[={OFF |
| System Variable | lock_order_debug_missing_unlock |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
LOCK_ORDER tool이 여전히 보유 중인 상태에서 destroy되는 잠금을 만났을 때 디버그 어서션 실패를 발생시킬지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | --lock-order-dependencies=file_name |
| System Variable | lock_order_dependencies |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | File name |
| Default Value | empty string |
server 잠금 순서 의존성 그래프를 정의하는 lock_order_dependencies.txt 파일의 경로입니다.
의존성을 지정하지 않아도 됩니다. 이 경우 비어 있는 의존성 그래프가 사용됩니다.
| Property | Value |
|---|---|
| Command-Line Format | --lock-order-extra-dependencies=file_name |
| System Variable | lock_order_extra_dependencies |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | File name |
| Default Value | empty string |
잠금 순서 의존성 그래프에 대한 추가 의존성을 포함하는 파일의 경로입니다. 이는 기본 server 의존성 그래프( lock_order_dependencies.txt 파일에 정의됨)를 서드파티 코드의 동작을 설명하는 추가 의존성으로 보완하는 데 유용합니다. (대안은 lock_order_dependencies.txt 자체를 수정하는 것이지만, 이는 권장되지 않습니다.)
이 변수가 설정되지 않으면 보조 파일은 사용되지 않습니다.
| Property | Value |
|---|---|
| Command-Line Format | --lock-order-output-directory=dir_name |
| System Variable | lock_order_output_directory |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Directory name |
| Default Value | empty string |
LOCK_ORDER tool이 로그를 기록하는 디렉터리입니다. 이 변수가 설정되지 않으면 기본값은 현재 디렉터리입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-print-txt[={OFF |
| System Variable | lock_order_print_txt |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
LOCK_ORDER tool이 잠금 순서 그래프 분석을 수행하고 텍스트 보고서를 출력할지 여부입니다. 보고서에는 감지된 잠금 획득 사이클이 모두 포함됩니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-trace-loop[={OFF |
| System Variable | lock_order_trace_loop |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
LOCK_ORDER tool이 잠금 순서 그래프에서 루프로 표시된 의존성을 만났을 때 로그 파일에 트레이스를 출력할지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-trace-missing-arc[={OFF |
| System Variable | lock_order_trace_missing_arc |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | ON |
LOCK_ORDER tool이 잠금 순서 그래프에 선언되지 않은 의존성을 만났을 때 로그 파일에 트레이스를 출력할지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-trace-missing-key[={OFF |
| System Variable | lock_order_trace_missing_key |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | OFF |
LOCK_ORDER tool이 Performance Schema로 적절히 인스트루먼트되지 않은 객체를 만났을 때 로그 파일에 트레이스를 출력할지 여부입니다.
| Property | Value |
|---|---|
| Command-Line Format | `--lock-order-trace-missing-unlock[={OFF |
| System Variable | lock_order_trace_missing_unlock |
| Scope | Global |
| Dynamic | No |
SET_VAR Hint Applies | No |
| Type | Boolean |
| Default Value | ON |
LOCK_ORDER tool이 여전히 보유 중인 상태에서 destroy되는 잠금을 만났을 때 로그 파일에 트레이스를 출력할지 여부입니다.
7.10 Debugging a MySQL Client
7.12 The DBUG Package