SAP HANA - Persistent Layer
SAP HANA database persistence layer is responsible to manage logs for all the transactions to provide standard data back up and system restore function.
It ensures that database can be restored to the most recent committed state after a restart or after a system crash and transactions are executed completely or completely undone. SAP HANA Persistent Layer is part of Index server and it has data and transaction log volumes for HANA system and in-memory data is regularly saved to these volumes. There are services in HANA system that has their own persistence. It also provides save points and logs for all the database transactions from the last save point.
Why does SAP HANA database need a Persistent Layer?
Main memory is volatile therefore data is lost during a restart or power outage.
Data needs to be stored in persisted medium.
Backup & Restore is available.
It ensures that the database is restored to the most recent committed state after a restart and that transaction are either completely executed or completely undone.
Data and Transaction Log Volumes
Database can always be restored to its most recent state, to ensure these changes to data in the database are regularly copied to disk. Log files containing data changes and certain transaction events are also saved regularly to disk. Data and logs of a system are stored in Log volumes.
Data volumes stores SQL data and undo log information and also SAP HANA information modeling data. This information is stored in data pages, which are called Blocks. These blocks are written to data volumes at regular time interval, which is known as save point.
Log volumes store the information about data changes. Changes that are made between two log points are written to Log volumes and called log entries. They are saved to log buffer when transaction is committed.
In SAP HANA database, changed data is automatically saved from memory to disk. These regular intervals are called savepoints and by default they are set to occur every five minutes. Persistence Layer in SAP HANA database performs these savepoint at regular interval. During this operation changed data is written to disk and redo logs are also saved to disk as well.
The data belonging to a Savepoint tells consistent state of the data on disk and remains there until the next savepoint operation has completed. Redo log entries are written to the log volumes for all changes to persistent data. In the event of a database restart, data from the last completed savepoint can be read from the data volumes, and redo log entries written to the log volumes.
Frequency of savepoint can be configured by global.ini file. Savepoints can be initiated by other operations like database shut down or system restart. You can also run savepoint by executing the below command −
ALTER System SAVEPOINT
To save data and redo logs to log volumes, you should ensure that there is enough disk space available to capture these, otherwise the system will issue a disk full event and database will stop working.
During the HANA system installation, following default directories are created as the storage location for data and log volumes −
These directories are defined in global.ini file and can be changed at later stage.
Note that Savepoints do not affect the performance of transactions executed in HANA system. During a savepoint operation, transactions continue to run as normal. With HANA system running on proper hardware, impact of savepoints on the performance of system is negligible.