Open sean-ahn opened 6 years ago
현재 mySQL DB에서 지원해주고 있는 undo log에 대해서
undo logs는 a single transction에 대해서 모든 변동사항을 카피애서 기록한다. https://dev.mysql.com/doc/refman/5.7/en/innodb-undo-logs.html roll back pointer는 가장 최근에 일어난 db event에 대한 undo log를 가르키고 있고, 각각의 undo log는 자신의 이전 undo log를 가르키고 있다.
undo table이 존재. 기본적으로 undo log는 기존의 data base의 구조와 거의 동일한 형태로, sql서버에 같이 저장된다. 이를 분리된 위치에서도 관리 가능하며 그 크기에는 제한이 없다. 지금은 휘발적인 데이터로 취급. commit하면 undo log를 정리한다.
+. read view. read view는 어떤 버전의 기록을 보여줄 것이냐에 대한 설정이다. READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ 크게 세가지로 나뉘며, 보통은 세번째 것이 default로 지정되어있다.
n_sample
* (n_cols_in_uniq_i
+ n_cols_in_non_uniq_i
+ n_cols_in_pk
(1 +n_non_uniq_i
)) \ n_part
)n_sample
is the number of pages sampled (defined by innodb_stats_persistent_sample_pages)
n_cols_in_uniq_i
is total number of all columns in all unique indexes (not counting the primary key columns)
n_cols_in_non_uniq_i
is the total number of all columns in all nonunique indexes
n_cols_in_pk
is the number of columns in the primary key (if a primary key is not defined, InnoDB creates a single column primary key internally)
n_non_uniq_i
is the number of nonunique indexes in the table
n_part
is the number of partitions. If no partitions are defined, the table is considered to be a single partition.
references https://blog.jcole.us/2014/04/16/the-basics-of-the-innodb-undo-logging-and-history-system/ http://dolphhong.blogspot.kr/2015/02/mysql-56-undo-tablespace.html http://intomysql.blogspot.kr/2010/12/innodb-redoundo.html https://dev.mysql.com/doc/refman/5.7/en/innodb-undo-logs.html https://dev.mysql.com/doc/refman/5.7/en/innodb-analyze-table-complexity.html
바이너리 로그에는 데이터를 지금 또는 나중에 업데이트하는 모든 명령문이 기록되어 있다. 명령문은 데이터 수정을 가리키는 “이벤트(event)” 형태로 저장된다. 바이너리 로그는 각 명령문이 데이터를 업데이트하는 소비 시간 정보도 가지고 있다.
바이너리 로그는 이전의 업데이트 로그에서 사용했던 모든 정보를 보다 편리하고 트랜젝션-세이프 (transaction-safe) 형태로 가지고 있다.
현재 한계점: 테스트 시작 시 mysqldump
로 백업을 해야 함
목적: 테스트가 끝난 뒤 DB를 테스트 이전 상태로 돌아가게 함
질문: Recovery scheme을 공부해서 system에 undo. Redo 메세지를 보내서 예전 상태로 돌릴 수 있는가? (transaction이 commit되면 변경할 수 없음)
세부 목적: MySQL DB logging 에 대해 알아봄 Checkpoint signal 에 대해 알아봄 compensation operation 의 구현 방법을 알아봄
예시: DBMS가 가동되다가 중간에 죽는다면, 일반적으로 operation을 기록함 commit 하면 데이터를 못 바꾸게 되어 있음 (다른 transaction에 변경되면 안됨) operation 실행 전에 logging을 함 (undo 할 때 log를 가지고 돌아감)