SAP HANA System Replication - Operation Mode & Replication Mode

Hey Folks! Welcome back to Hana high availability blog series. In our last blog we checked out what is hana system replication and how it basically works. If you haven't gone through that blog, you can checkout link

In this blog we will be talking about the replication modes and operation modes in hana system replication. So let's get started.

When we setup the replication and register the secondary site, we need to decide the operation mode & replication mode we want to choose for replication. For now we won't focus on setting up replication as we'll cover it in our next blogs. 

Operation Modes in Hana System Replication:

There are three operation modes available in system replication: delta_datashipping, logreplay and logreplay_readaccess. Default operation mode is logreplay.

1. Delta_datashipping:

In this operation mode initially one full data shipping is done as part of replication setup and then a delta data shipping takes place occasionally in addition to continuous log shipping.The shipped logs are persisted on secondary but not replayed. They are only replayed during the takeover from the position of last arrived delta data shipment. Since the logs are not replayed continuously, it has lower memory footprint and can also be used as a non-prod system.

2. Logreplay

This mode is only supported in Hana 1.0 SPS 11 or above. In this operation mode initially one full data shipping is done as part of replication setup and then redo logs are continuously shipped and immediately replayed on arrival. This continuous log replay helps to take over immediately when primary system fails. 

In case of connection disruption, the primary system retains the logs that have not been shipped to secondary due to connectivity issue. The retention can be configured with maximum retention size. When it reaches the size limit, the logs are claimed and overwritten by new logs to prevent log full situation in primary. After this situation, full data shipping needs to be performed again.

Since the logs are replayed continuously, the secondary system has a higher memory footprint and can't be simultaneously used as a non-prod system.

3. Logreplay_readaccess

This mode is only supported in Hana 2.0 SPS 00 or above. This operation mode is just a extended version of logreplay which allows read access on the secondary system. Apart from this extra feature, everything is same as logreplay. 

We talked about different operation modes. Now let's check what are various replication modes that are used during replication.

Replication Modes in Hana System Replication:

1. SYNCMEM - Synchronous in-memory 

In this, the secondary database sends an acknowledgement to the primary system when the log has been received in the memory. Since the secondary doesn't have to wait for the data to be written on disk before sending acknowledgement, system performance is better. This is designed to be used in close proximity or server in same region.

When the connection to secondary system is lost, after a default wait time of 30sec, the primary system continues the transaction processing and retains logs on local disk.

Data loss can occur:
  • when primary and secondary site fails at same time, some data was in memory but not written to disk on either of them. After restart the data which was in memory would be lost.
  • when a takeover is executed while the secondary is unavailable. Data arrived on secondary would be outdated as compared to primary.

2. SYNC - Synchronous 

This mode is also mostly used in scenarios where the servers are in same region or in very close proximity. In this, the secondary database sends an acknowledgement to the primary system when the log has been received and written to disk.

When the connection to secondary system is lost, after 30sec the primary system continues the transaction processing and retains logs on local disk.

Since the logs are written to disk, there would be no data loss due to site failure. 

Data loss can occur:

  • when a takeover is executed while the secondary is unavailable. Data arrived on secondary would be outdated as compared to primary.

2.1 Full Sync - Extension of SYNC

This is an extension to sync mode. It considers log write successful when the log buffer is written in both primary & secondary site's disk. When the secondary system is disconnected (for example, because of network failure), the primary system suspends the transaction processing until the connection to the secondary system is reestablished.

No data loss occurs in this scenario. But write operations on primary can't happen if connection to secondary site is not working.

This option can be set using parameter [system_replication]/enable_full_sync

3. ASYNC - Asynchronous 

In this, the primary system doesn't have to wait for any acknowledgement from secondary. Since the secondary doesn't have to wait for any acknowledgement, system performance is better without any delay.
It is more vulnerable to data loss. Data changes maybe lost during takeover.

That was all about replication & operation modes. In our next blog we will go through replication setup & it's pre-requisites. 

Comments

  1. Hello, It's a good blog...it will be even better if you can include how to change the operation mode( logreplay to delta_datashipping and vice-versa)and what are the steps needed for it.

    ReplyDelete
    Replies
    1. Hi, thanks for supporting us. To change operation mode, you need to reconfigure replication with required operation mode. For setup config check https://www.letstalksap.com/2022/02/hana-system-replication-prerequisites.html

      Delete

Post a Comment