Skip to Content
Technical Articles
Author's profile photo Rajarajeswari Kaliyaperumal

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 .

1.Via SQL:

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

2.Via Studio:

3.From OS level:

 

State Description
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.
Free

Segment is free for reuse.

 

Thanks for reading!
Like and leave a comment if it was useful!
Follow for more such posts! 🙂

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice Blog !!

      A query indeed for the below point mentioned.

      "Data from log segments gets transferred to data volumes after a log segment backup"

      In general, the savepoint is triggered every 300 seconds and the automatic log backup are scheduled to run every 15 minutes in Production environment.

      So, if the data from the log segments are transferred to log volumes in a savepoint operation, your point above mentions that it is transferred post log segment backup. Can you please clarify?

      So ingenerally the data would move to data volumes every five minutes and what happens post-backup is my query.

      Regards,

      HANA Associate.

      Author's profile photo Narendar Gudimilla
      Narendar Gudimilla

      All the committed values in the memory gets persisted in the data-volume per service as per the savepoint in every 5 mins[defaults]. Also, after every AUTO-LOG-BACKUP, the transactions recorded in logseg are transferred to data volume. The latter is not a savepoint-based activity. That will be fired if the log-segment is full / log-area is full / interval timeout is hit. Apart from this, the committed data from the in-memory RAM also pushed into data through Consistent Check Locks into Data volume and is a 2 phase activity.

      Besides this, DATA-BACKUPS also invoke a savepoint. Not a log backup.

      Hope you got the difference 🙂

      Author's profile photo Rajeev Kumar
      Rajeev Kumar

      Hello Rajarajeswari Kaliyaperuumal,

      Nice blog. Well written.

      I have once doubt. I have seen RetainedFree status as well of log segments. Can you please help me with this particular status.

      Also, When you answer on my doubts, kindly update your other blog as well - Playing around with Log segment states of log volumes in HANA | SAP Blogs

       

      Thank you.

      Author's profile photo Gabriel Bertrand
      Gabriel Bertrand

      Dear Rajarajeshwari,  is there any parameter that controls how many logsegment*.dat files are created in the log volume or it just creates as many as it can until the filesystem fills up.  Recently while performing Redistribution after adding host, noticed the log volume was almost getting filled up and the number of log segments are more than what is was before the start of the activity. Does it mean , too many changes were happening in memory before it is persisted in data file and also before the save point interval of 5 mins and so it was creating more log segments. Any insight on this one and how to handle this one (between adjusting save point interval and log backup time).  Thanks

      Gabriel