본문 바로가기
Database/MYSQL

MySQL Error_code : 1756 slave_parallel_workers

by 반화넬 2021. 5. 10.
반응형

Yesterday I found a strange problem with a database online, and here I recorded the problem discovery and processing.

R&D colleagues reported that the data in a database has not been updated since 19:44 (the online service from the library is not applicable, only offline query and statistical data use). But log in to the slave library to find that the master-slave synchronization is normal, the two processes responsible for master-slave synchronization are yes, the master-slave delay is 0, and Slave_SQL_Running_State is Waiting for Slave Workers to free pending events

What does this state mean? View MySQL official website explained as follows:https://dev.mysql.com/doc/refman/5.7/en/slave-sql-thread-states.html

Waiting for Slave Workers to free pending events

This waiting action occurs when the total size of events being processed by Workers exceeds the size of theslave_pending_jobs_size_max system variable. The Coordinator resumes scheduling when the size drops below this limit. This state occurs only when slave_parallel_workers is set greater than 0.

The translation is as follows:

When will this wait state happen? This state will only be inslave_parallel_workersWhen the setting is not 0, whenThe total size of events handled by Workers exceeds system parametersslave_pending_jobs_size_maxWhen setting the value. When the size is lower than this value, the scheduler will resume scheduling.

View error log information

2019-09-02T20:45:40.060392+08:00 6 [ERROR] Slave SQL for channel '': ... The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details). Error_code: 1756

 

show variables like'%slave_pending_jobs_size_max%'; default is 16M

show variables like'max_allowed_packet'; is 512M

solve:

First modify the size of slave_pending_jobs_size_max to 128M

Stop slave

stop slave; has been waiting after the command is issued

Can only use kill -9 to kill the process; (because I am from the library, after stopping, it will not affect the business, and the specific situation will be dealt with)

Write slave_pending_jobs_size_max=128M into the configuration file.

Firstslave_parallel_workers=0 turned out to be 8

After starting MySQL, the status changes to show slave status\G

Slave_SQL_Running_State: becomes Waiting for dependent transaction to commit

Relay_Master_Log_File: Master-mysql-bin.001676

Exec_Master_Log_Pos: 798682256 has not been changed, indicating that the slave library has not played back the log of the master library,

 

출처 : www.programmersought.com/article/25363958139/

 


구글 번역본 


어제 온라인에서 데이터베이스에서 이상한 문제를 발견하고 여기에서 문제 발견 및 처리를 기록했습니다.

R & D 동료들은 데이터베이스의 데이터가 19:44 이후 업데이트되지 않았다고보고했습니다 (라이브러리의 온라인 서비스는 적용되지 않으며 오프라인 쿼리 및 통계 데이터 사용 만 가능). 그러나 슬레이브 라이브러리에 로그인하여 마스터-슬레이브 동기화가 정상이고, 마스터-슬레이브 동기화를 담당하는 두 프로세스가 예이고, 마스터-슬레이브 지연이 0이고, Slave_SQL_Running_State가 슬레이브 작업자가 보류중인 이벤트를 해제 할 때까지 기다리는 중임을 확인합니다.

이 상태는 무엇을 의미합니까? 다음과 같이 설명 된 MySQL 공식 웹 사이트보기 : https://dev.mysql.com/doc/refman/5.7/en/slave-sql-thread-states.html

Waiting for Slave Workers to free pending events

이 대기 작업은 작업자가 처리중인 총 이벤트 크기가 slave_pending_jobs_size_max 시스템 변수 의 크기를 초과 할 때 발생 합니다. 코디네이터는 크기가이 제한 아래로 떨어지면 일정을 다시 시작합니다. 이 상태는가 slave_parallel_workers 0보다 크게 설정된 경우에만 발생합니다  .

번역은 다음과 같습니다.

이 대기 상태는 언제 발생합니까? 이 상태는 slave_parallel_workersWhen the setting is not 0, when작업자가 처리하는 총 이벤트 크기가 시스템 매개 변수를 초과합니다.slave_pending_jobs_size_maxWhen setting the value. When the size is lower than this value, the scheduler will resume scheduling.

오류 로그 정보보기

2019-09-02T20 : 45 : 40.060392 + 08 : 00 6 [오류] 채널 ''에 대한 슬레이브 SQL : ... 슬레이브 코디네이터 및 작업자 스레드가 중지되어 데이터가 일관성없는 상태가 될 수 있습니다. 데이터 또는 정보 테이블 또는 DDL 쿼리에 비 트랜잭션 스토리지를 사용하면 문제가 발생할 수 있지만 다시 시작하면 일관성이 자동으로 복원됩니다. 이러한 경우 데이터를 검토해야합니다 (자세한 내용은 문서 참조). Error_code : 1756

 

'% slave_pending_jobs_size_max %'와 같은 변수 표시; 기본값은 16M입니다.

'max_allowed_packet'과 같은 변수 표시; 512M입니다.

풀다:

먼저 slave_pending_jobs_size_max의 크기를 128M으로 수정합니다.

슬레이브 중지

노예를 중지하십시오. 명령이 발행 된 후 대기했습니다.

프로세스를 종료하려면 kill -9 만 사용할 수 있습니다. (도서관 출신이기 때문에 멈춰도 영업에 영향을 미치지 않고 구체적인 상황에 대응)

구성 파일에 slave_pending_jobs_size_max = 128M을 씁니다.

Firstslave_parallel_workers=0 turned out to be 8

MySQL을 시작한 후 상태가 슬레이브 상태를 표시하도록 변경됩니다. \ G

Slave_SQL_Running_State : 종속 트랜잭션이 커밋되기를 기다리는 중이됩니다.

Relay_Master_Log_File : Master-mysql-bin.001676

Exec_Master_Log_Pos : 798682256이 변경되지 않았습니다. 이는 슬레이브 라이브러리가 마스터 라이브러리의 로그를 재생하지 않았 음을 나타냅니다.

 

반응형