Book Image

SAP HANA Cookbook

Book Image

SAP HANA Cookbook

Overview of this book

SAP HANA is a real-time applications platform that provides a multi-purpose, in-memory appliance. Decision makers in the organization can gain instant insight into business operations. Thus all the data available can be analysed and you can react to the changing business conditions rapidly to make decisions. The real-time platform not only empowers business users and top management to make decisions but also provides the capability to make decisions in real-time.A practical and comprehensive guide that helps you understand the power of SAP HANA’s real-time and in-memory capabilities. It also provides step-by-step instructions to exploit all the possible features of the SAP HANA database, enabling users to harness the full potential of this technology and its features.You will gain an understanding of real-time replications, effective data loading from various sources, how to load data, and how to create re-usable objects such as models and reports.Use this practical guide to enable or transform your business landscape by implementing SAP HANA to meet your business requirements. The book shows you how to load data from different types of systems, create models in SAP HANA, and consume data for decision-making. The book covers various tools at different stages creating models using SAP HANA Studio, and consuming data using reporting tools such as SAP BusinessObjects, SAP Lumira, and so on . This book also explains the in-depth architecture of SAP HANA to help you understand SAP HANA as an appliance, that is, a combination of hardware and software.The book covers the best practices to leverage SAP HANA’s in-memory technology to transform data into insightful information. It also covers technology landscaping, solution architecture, connectivity, data loading, and setting up the environment for modeling purpose (including setup of SAP HANA Studio).If you have an intention to start your career as SAP HANA Modeler, this book is the perfect start.  
Table of Contents (16 chapters)
SAP HANA Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the persistence layer


SAP HANA's persistence layer manages logging of all the transactions in order to provide standard backup and restore functions. Both the row stores and column stores interact with the persistence layer. It offers regular savepoints, and also logging of all database transaction since the last savepoint.

The persistence layer is responsible for the durability and atomicity of transactions. The persistence layer manages both data and log volumes on the disk, and also provides interfaces to read and write data that is leveraged by all the storage engines. This layer is built based on the persistency layer of MaxDB, SAP's traditional relational database. The persistency layer guarantees that the database is restored to the most recent committed state after a restart, and these transactions are either completely executed or completely rolled back. To accomplish this efficiently, it uses a blend of write-ahead logs, shadow paging, and savepoints.

To enable scalability in terms of data volumes and the number of application requests, the SAP HANA database supports scale-up and scale-out. Keeping data in the main memory brings up the question of what will happen in the case of a loss of power.

In database technology, atomicity, consistency, isolation, and durability (ACID) are a set of requirements that guarantees that the database transactions are processed reliably:

  • A transaction has to be atomic. This means the transaction should be either executed completely or fail completely. The database state should be unchanged, and the entire transaction has to fail if a part of it fails.

  • Consistency of a database must be unspoiled by the transactions that it performs.

  • Isolation ensures that all transactions are independent.

  • Durability means that there is no change in the state of a transaction, that is, a transaction will remain committed after it has been committed.

While the first three requirements are not affected by the in-memory database concepts, durability is the lone requirement that cannot be met by storing data in the main memory. The main memory is a volatile storage; its content will be cleared when power is switched off. To make data persistent, non-volatile storage (such as hard drives, SSD, or flash devices) have to be used.

Further reading

The storage used by a database to store data is divided into pages. When data changes occur due to transactions, the changed pages are marked and written to the non-volatile storage at regular intervals. In addition to this, all changes made by the transactions are captured by database log. All the committed transactions generate a log entry, and these are written to non-volatile storage. This confirms that all transactions are stored permanently. The following diagram illustrates this using the example of SAP HANA. All the changed pages are saved in the form of savepoints, which are asynchronously written to persistent storage at regular intervals (by default, every five minutes). The log is written synchronously, that is, transaction does not return before the corresponding log entry that has been written to the persistent storage.

After a power failure, the database can be restarted like a disk-based database. Database pages from the savepoints are restored, 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 the memory to exactly the same state as it was before the power failure.

The SAP in-memory database holds the bulk of its data in the memory for maximum performance. It still depends on persistent storage to provide a fallback in case of failure. The log captures all changes done by the database transactions (redo logs).

Data and undo log information (parts of data) are automatically saved to the disk at regular savepoints. The log is also saved to the disk continuously and synchronously after each commit of a database transaction (waiting for the end of a disk write operation).

The database can be restarted after a power failure, just like a disk-based database:

  • The system is normally restarted (lazy reloading of tables to keep the restart time short)

  • The system returns to its last consistent state (by replaying the redo log since the last savepoint)

For more information, refer to the following link:

http://scn.sap.com/community/developer-center/hana/blog/2012/08/14/in-a-relationship-with-hana--part-2