1. Log segments ?
- It has the record of the transaction that have been committed in memory
메모리에 커밋된 트랜제션들의 기록으로 정의 할 수 있다.
- Log volume consists of multiple log segments.
다수의 log segment는 Log volume을 이룬다
- The amount of segments depends on the changes, log and save point interval.
세그먼트의 크기는 변경, 로그 모드, 세이브 포인트 간격과 연관이 있다.
- If the log segment inside log volumes encounters a save point, the following actions occur.
로그 볼륨 내 로그 세그먼트가 save point에 도달하면 아래와 같은 동작이 진행 된다.
1) Data from log segments gets transferred to data volumes after a log segment backup, in cases of log_mode=normal and enable_auto_backup=yes.
만약, log_mode=normal 이고 enable_auto_backup=yes 이면 로그 백업이 수행되고 관련된 데이터는 data volumes으로 전송 된다.
2) Data from log segment gets transferred to data volumes and will be overwritten in cyclic fashion without a log backup when log_mode=overwrite.
만약, log_mode=overwrite 이면 로그 백업 없이 이와 관련된 data는 data volume으로 전송 된다.
2. Log status
- log segment 상태 순서 : Writing -> Closed -> Truncated -> Backup -> Free -> Writing
- Log volume 영역이 가득 찰 경우, HANA DB는 동작할 수 없는 Hang 상태가 될 수 있기 때문에, Log Back up을 진행해주는 것이 권장된다.
Status | Description |
Writing | The log segment is currently being written. -> log segment에 쓰여지고 있는 상태로 하나의 log segment는 반드시 write 상태여야 한다. |
Closed | The log segment is closed by the writer. -> log segment에 쓰기가 종료된 상태. |
Truncated | The log segment is not yet backed up. Backup will remove it. -> log segment가 백업 되지 않은 상태. |
BackedUp | The log segment has been backed up, but a savepoint has not yet been written. -> log segment가 백업 됐지만, 세이브 포인트가 지정되지 않아 복구를 위해 보관돼야 하는 상태. |
Free | The log segment has been backed up, it is not required for restart and can be reused. -> log segment가 백업 됐고, 재사용 할 수 있는 상태 |
✓ DB에서 Log segments의 상태를 조회 하는 방법
select b.host, b.service_name, a.state, count(*)
from "PUBLIC"."M_LOG_SEGMENTS" a
join "PUBLIC"."M_SERVICES" b on (a.host = b.host AND a.port = b.port)
group by b.host, b.service_name, a.state;
✓ OS에서 Log segments의 상태를 조회 하는 방법
sidadm@hostname:/usr/sap/SID/SYS/global/hdb/custom/config > hdblogdiag seglist /hana/log/SID/mnt0001/hdb00001 | grep -i status | wc -l
sidadm@hostname:/usr/sap/SID/SYS/global/hdb/custom/config > hdblogdiag seglist /hana/log/SID/mnt0001/hdb00002 | grep -i status | wc -l
sidadm@hostname:/usr/sap/SID/SYS/global/hdb/custom/config > hdblogdiag seglist /hana/log/SID/mnt0001/hdb00003 | grep -i status | wc -l
Ex ) sidadm@hostname:/usr/sap/SID/SYS/global/hdb/custom/config > hdblogdiag seglist /hana/log/SID/mnt0001/hdb00003 | grep -i Free | wc -l
3. Log Mode
- 'log_mode' 파라미터를 통해 log segment의 재검색 방식을 조정할 수 있다.
1) log_mode = overwrite
- Log segment Full 상태가 되면, Log segment의 상태가 Closed로 바뀌고 save point 지정 후 재사용이 가능해진다.
- Log backup이 수행되지 않기 때문에 PROD (운영) System에서는 권장되지 않는다.
2) log_mode = normal
- Automatic Log backup이 활성화 된 경우 자동으로 Log backup이 된다.
- save point 이후 Log segment가 백업 되면, Log segment의 상태가 Free가 되어 새로운 Log를 Write할 수 있다.
- 'basepath_logbackup' 파라미터를 사용해 log를 백업 할 path / directory 설정 가능
🙋♂️ 궁금한 점이나 잘못된 내용을 댓글로 적어주시면 감사하겠습니다 !!
'SAP > HANA' 카테고리의 다른 글
# [HANA] HANA DB Startup sequence ( HANA DB 실행 순서 ) (0) | 2023.02.10 |
---|---|
# [HANA] HANA DB - Used Memory (0) | 2023.01.02 |
# [HANA] HANA DB - Memory Architecture (0) | 2022.12.29 |
# [HANA] savepoint (0) | 2022.12.21 |
# [HANA] Multitenant Database (0) | 2022.12.05 |