HANA log segments and its states
LOG SEGMENT AND ITS STATES
If you are trying to understand the states of log segments in HANA, the below series will help you out. Before going deeper below are the basics to understand what a log segment in HANA is actually is.
1.What is a log segment ? To put in my own simple words, It has the record of the transactions that have been committed in memory and has reached the log volume file system as log segments and is yet to reach the data volumes which only happens after a save point .
If the log segments inside log volumes encounters a savepoint
- Data from log segments gets transferred to data volumes after a log segment backup in case of log_mode=normal and enable_auto_log_backup=yes.
- Data from log segment gets transferred to data volumes and will be overwritten in cyclic fashion without a log backup when log_mode=overwrite
After either one of the above ,The log segments turns to Free state and is available for re-use now.
Note: Log segments are different from log backups. To put in a different words, When the log segments encounters a savepoint the data it has gets transferred to data volumes .Whether the log segment should be backed up before overwriting or directly overwritten purely depends on the parameter log_mode =(normal / Overwrite)
2.What are the states of log segments in HANA ? We have 5 different states for log segment :Writing,Closed,Truncated,BackedUp,Free
You can find the same in 3 ways .
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
3.From OS level:
|Writing||Currently writing to this segment.|
|Closed||Segment is closed by the writer.|
|Truncated||Truncated, but not yet backed up. Backup will remove it.|
|BackedUp||Segment is already backed up, but a savepoint has not yet been written. Therefore it needs to be kept for instance recovery.|
Segment is free for reuse.
Thanks for reading!
Like and leave a comment if it was useful!
Follow for more such posts! 🙂