SAP HANA SPS10- Asynchronous Table Replication (ATR)
-
Upload
sap-technology -
Category
Technology
-
view
229 -
download
5
Transcript of SAP HANA SPS10- Asynchronous Table Replication (ATR)
1© 2014 SAP AG or an SAP affiliate company. All rights reserved.
SAP HANA SPS 10 - What’s New? Asynchronous Table Replication (ATR)
SAP HANA Product Management June, 2015
(Delta from SPS 09 to SPS 10)
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 2Public
Agenda
Motivation
Key Principles
Setup an ATR-Landscape
Query on Replica Tables
Additional Remarks
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 3Public
Motivation
The main objective of ATR is to balance OLTP and OLAP workload within a HANA scale-out system
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 4Public
Key Principles
Replication on Table-Level
A selected list of 1…n tables can be defined as replicated tables
Asynchronous Replication
Write operations on replicated tables are propagated to their replicas asynchronously
Source write transaction commits without waiting for its propagation to the replica
Transactional Replication
Cross-node transactional consistency is guaranteed by preserving the source transaction boundary and their
commit order on log replay at the replica side
Fast Replication
Propagation delay is minimized by parallel log replay by multiple replayer threads at the replica side
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 5Public
Setup an ATR-Landscape for OLTP and OLAP workload
Steps to setup an ATR-Landscape:
Create Replica Schema → Create Replica Tables → Activate Replication
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 6Public
Create Replica Tables and Table Placement
Create Replica Tables
CREATE SCHEMA REP_SCHEMA;
CREATE TABLE REP_SCHEMA.TAB1 LIKE SRC_SCHEMA.TAB1 ASYNCHRONOUS REPLICA;
ALTER TABLE SRC_SCHEMA.TAB1 ADD ASYNCHRONOUS REPLICA;
creates replica table on any replica node and add an additional replica on another available replica node
Table Placement
Option 1: Table placement rule– ALTER SYSTEM ALTER configuration ('global.ini','SYSTEM') SET ('table_placement','repl_volumes')='6,7,8' WITH RECONFIGURE;
– ALTER SYSTEM ALTER TABLE PLACEMENT (SCHEMA_NAME => 'REP_SCHEMA') SET (LOCATION => 'repl_volumes');
Option 2: Explicit Table Location – CREATE TABLE REP_SCHEMA.TAB1 LIKE SRC_SCHEMA.TAB1 ASYNCHRONOUS REPLICA AT 'host1:port1';
– ALTER TABLE SRC_SCHEMA.TAB1 ADD ASYNCHRONOUS REPLICA AT 'host2:port2';
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 7Public
Activation and Dropping Replica Tables
Activate /Deactivate Replication
all tables
– ALTER SYSTEM ENABLE ALL ASYNCHRONOUS TABLE REPLICAS
– ALTER TABLE SRC_SCHEMA.TAB2 ENABLE ASYNCHRONOUS REPLICA;
single tables (works only, if global replication is already enabled)
– ALTER SYSTEM DISABLE ALL ASYNCHRONOUS TABLE REPLICAS;
– ALTER TABLE SRC_SCHEMA.TAB1 DISABLE ASYNCHRONOUS REPLICA;
Drop Replication – DROP SCHEMA REP_SCHEMA CASCADE;
– ALTER TABLE SRC_SCHEMA.TAB1 DROP REPLICA AT ALL LOCATIONS;
– ALTER TABLE SRC_SCHEMA.TAB1 DROP REPLICA AT '<replica host>:<replica port>';
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 8Public
Monitoring Replica Tables
Monitoring Views
M_ASYNCHRONOUS_TABLE_REPLICAS
– contains the accumulated replica information for all replicated tables in the HANA system
M_ASYNCHRONOUS_TABLE_REPLICAS_RESET
– contains the accumulated replica information since the last reset of the view M_ASYNCHRONOUS_TABLE_REPLICAS
– this view also contains a timestamp field RESET_TIME, which indicates the last time the data was reset
– ALTER SYSTEM RESET MONITORING VIEW SYS.M_ASYNCHRONOUS_TABLE_REPLICAS_RESET
Check Replica Tables
– SELECT * FROM M_ASYNCHRONOUS_TABLE_REPLICAS WHERE SOURCE_SCHEMA_NAME = SRC_SCHEMA AND SOURCE_TABLE_NAME = TAB1
– Shows all replica tables created in for SRC_SCHEMA.TAB1
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 9Public
Query on Replica Tables
General remarks
If a client is connected, the statements are routed to the source tables by default, because the asynchronous replica might have an outdated state compared to the
source table
If the explicit schema name of the replica tables is given, the statements are routed to the replicas accordingly
Round-Robin
If there are multiple replica tables for one source table, one of the replica table is picked to service the query in the round-robin manner
SELECT * FROM REP_SCHEMA.TAB1;
Explicit connection
You can make an explicit connection to the location of a specific replica table
SELECT * FROM REP_SCHEMA.TAB1 with hint(route_to(4));
Here '4' means the volume-id of indexserver
Get the volume-id of a table replica:
SELECT V.VOLUME_ID, C.SCHEMA_NAME, C.TABLE_NAME, C.PART_ID, C.RECORD_COUNT FROM M_VOLUMES V, M_CS_TABLES C
WHERE V.HOST = C.HOST and V.PORT = C.PORT AND SCHEMA_NAME = 'REP_SCHEMA' AND TABLE_NAME LIKE '%TAB1%';
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 10Public
Additional Remarks
• Asynchronous table replication works only for CS-tables within a single HANA scale-out landscape. It cannot be used for replicating a table across two different HANA
landscapes or between HANA and other DBMS instances, like system replication or SLT replication
• Asynchronous table replication works also for partitioned tables, where the replica’s partitions will be created like source partitions’ node distribution
• Source table and its replica cannot be located to the same node
• Replica table cannot be created on master indexserver.
• Only one identical replica table can exist on a replica node (same for partitioned tables)
• The following table types cannot be set as a replication table: History table, Flexible table, Temporary table, Proxy table and Extended Storage table
• A source table and its replica table should have identical table structure (same for partitioned tables)
• Write operations and DDL operations cannot be executed directly on a replica table (such access will return an error
• Replication activation can take longer time for big source tables in SPS10. Further optimizations will come in the next SPS. Meanwhile, export (from source table) and
import (into replica table) is recommended to create . (detailed procedure is described in '2. Special Handling for Big CS Source Table')
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 11Public
Disclaimer
This presentation outlines our general product direction and should not be relied on in making
a purchase decision. This presentation is not subject to your license agreement or any other
agreement with SAP.
SAP has no obligation to pursue any course of business outlined in this presentation or to
develop or release any functionality mentioned in this presentation. This presentation and
SAP’s strategy and possible future developments are subject to change and may be changed
by SAP at any time for any reason without notice.
This document is provided without a warranty of any kind, either express or implied, including
but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or
non-infringement. SAP assumes no responsibility for errors or omissions in this document,
except if such damages were caused by SAP intentionally or grossly negligent.
© 2015 SAP SE or an SAP affiliate company. All rights reserved.
Thank you
Contact information
Rüdiger Karl
SAP HANA Product Management