[MySQL][ERROR] MySQL 8.0 셧다운되지 않음 Waiting for change buffer merge to complete number of bytes of change buffer just merged

hwwwa·2025년 2월 27일

오류상황

MySQL 8.0 에서 마이너버전 inplace 업그레이드를 진행하기 위해 slow shutdown 을 아래와 같이 수행하였다.

SET GLOBAL innodb_fast_shutdown=0;
systemctl stop mysqld

하지만 아래와 같은 로그만 반복적으로 남으며 3일째 셧다운이 완료되지 않았다 ;;

[Note] [MY-012874] [InnoDB] Waiting for change buffer merge to complete number of bytes of change buffer just merged: 81584
[Note] [MY-013073] [InnoDB] Waiting for master to exit.

원인

에러 메세지의 의미는 slow shutdown으로 인한 정상적인 메시지이며, change buffer 내의 page들을 계속 merge 하는 작업하는 작업이 shutdown 동안 계속 발생하였다는 의미이다.

innodb_fast_shutdown=0일 때 change buffer는 full merging이 발생할 수 있지만,

문제점은 change buffer merge되는 페이지크기가 70~80KB 로 매우 작은 수치로 이 작업에 대한 시간이 3일 내내 수행되며 매우 길어지고 있는 상태인 점이다.

이는 시스템의 영향을 받을 확률이 클 것으로 의심된다.

의심되는 문제점
1. disk IO 이슈
2. disk performance 문제
3. MySQL 8.0 버그

change buffer merge에 대한 내용은 아래 공식 도큐먼트를 참고 👇
https://dev.mysql.com/doc/refman/8.0/en/faqs-innodb-change-buffer.html#faq-innodb-change-buffer-merging

하지만 나의 경우에 disk 관련된 문제는 없었다. 오히려 셧다운을 시도하는 기간동안 disk를 거의 사용하지 않았다.

또한 동일한 스펙의 장비가 3대가 있는데, 2대는 멀쩡하게 셧다운되었고 마지막 1대에서만 이런 문제가 발생하였다.

해결방안

  1. innodb_fast_shudown=1 으로 옵션을 변경하여 slow shutdown을 사용하지 않도록 한다.
  2. innodb_io_capacity 값을 증가시키기 (8.4 부터는 10000이 디폴트가 되었다)

Inplace 업그레이드에 관한 도큐먼트를 확인해보면 0도 사용해도 된다고 하는데 왜 나한테만 이런 일이..?
https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html

If you normally run your MySQL server configured with innodb_fast_shutdown set to 2 (cold shutdown), 
configure it to perform a fast or slow shutdown by executing either of these statements:

SET GLOBAL innodb_fast_shutdown = 1; -- fast shutdown
SET GLOBAL innodb_fast_shutdown = 0; -- slow shutdown

어쨌든 셧다운되지 않던 프로세스는 강제킬하고, innodb_fast_shudown=1 옵션으로 무사히 inplace upgrade 성공하였다!

0개의 댓글