SAP HANA - Data persistence
Data persistence in SAP HANA
Keeping data in main memory brings up the question of what will happen in case of a loss
of power.
In database technology, atomicity, consistency, isolation, and durability (ACID)
is a set of requirements that guarantees that database transactions are processed reliably:
A transaction has to be atomic. That is, if part of a transaction fails, the entire transaction
has to fail and leave the database state unchanged.
The consistency of a database must be preserved by the transactions that it performs.
Isolation ensures that no transaction is able to interfere with another transaction.
Durability means that after a transaction has been committed it will remain committed.
While the first three requirements are not affected by the in-memory concept, durability is
a requirement that cannot be met by storing data in main memory alone. Main memory is
volatile storage. That is, it looses its content when it is out of electrical power. To make
data persistent, it has to reside on non-volatile storage, such as hard drives, SSD, or
Flash devices.
The storage used by a database to store data (in this case, main memory) is divided into
pages. When a transaction changes data, the corresponding pages are marked and written to
non-volatile storage in regular intervals. In addition, a database log captures all changes
made by transactions. Each committed transaction generates a log entry that is written to
non-volatile storage. This ensures that all transactions are permanent. Figure below illustrates
this using the example of SAP HANA. SAP HANA stores changed pages in savepoints, which
are asynchronously written to persistent storage in regular intervals (by default every 5
minutes). The log is written synchronously. That is, a transaction does not return before the
corresponding log entry has been written to persistent storage, in order to meet the durability
requirement, as described above.
After a power failure, the database can be restarted like a disk-based database. The
database pages are restored from the savepoints, and then the database logs are applied
(rolled forward) to restore the changes that were not captured in the savepoints. This
ensures that the database can be restored in memory to exactly the same state as before
the power failure.
Sap Hana Architecture
Sap Hana Database
SAP HANA - HINTS
Sap Hana -In memory key concepts
Comments
Post a Comment