15.00 - Example - Parallel Transporter

Teradata Parallel Transporter Operator Programmer Guide

prodname
Parallel Transporter
vrm_release
15.00
category
Programming Reference
featnum
B035-2435-034K

Example

Table 5 shows a simplified example of using the multiphase coordination protocol with three instances of the Load operator running in a master-slave relationship. In this execution, the slave operators behave as if they are in an idle mode while the master operator establishes the processing environment. Independent parallel processing then begins when all operators reach the synchronization point.

Upon execution, the Teradata PT processor invokes each operator in the parallel execution plan using the Initiate, Execute, Checkpoint, Restart, or Terminate functions. In return, each operator returns its status with either a SamePhase, NextPhase, or EndMethod response.

Method processing continues in the first phase until each instance of the operator has returned a NextPhase status, which signifies the end of the first phase and the beginning of the second. This phase processing continues, with no limit to the number of phases allowed, until each instance of the operator has returned an EndMethod status.

The entire process repeats for each method, with the SamePhase, NextPhase, and EndMethod status returns providing the synchronization points for the multiphase coordination.

Note: The multiphase coordination protocol is also available for operators that are not master/slave oriented. As indicated, the phase coordination process is implemented and controlled by the operators themselves, not by the Teradata PT processor. Under this protocol, operators are free to coordinate operations among themselves by using the appropriate status returns to guide the Teradata PT processor.

 

Table 5: Using Multiphase Coordination Protocol  

Method

Phase

Master Operator Object

Slave 1 Operator Object

Slave 2 Operator Object

Initiate

1

Allocate global variables

Create/connect a Teradata SQL session

Create/connect a Teradata SQL session

 

 

Create/connect a Teradata SQL session for obtaining the LSN parcel

Return NextPhase

Return NextPhase

 

 

Extract LSN from the LSN parcel

 

 

 

 

Save LSN as a global variable

 

 

 

 

Create/connect a Teradata SQL session

 

 

 

 

Return NextPhase

 

 

 

2

Create/connect Load sessions using the LSN global variable

Create/connect Load sessions using the LSN global variable

Create/connect Load sessions using the LSN global variable

 

 

Return NextPhase

Return EndMethod

Return EndMethod

 

3

Issue Begin Loading

 

 

 

 

Return EndMethod

 

 

Execute

1

Read record from a data source

Read a record from a data source

Read a record from a data source

 

 

IF end-of-file, return NextPhase

ELSE return SamePhase

IF end-of-file, return EndMethod

ELSE return SamePhase

IF end-of-file, return EndMethod

ELSE return SamePhase

 

2

Issue End Loading (if specified by the user)

 

 

 

 

Return EndMethod

 

 

Checkpoint

1

Write statistics to Global Variable

Write statistics to Global Variable

Write statistics to Global Variable

 

 

Return NextPhase

Return EndMethod

Return EndMethod

 

2

Write checkpoint records to the restart log file

 

 

 

 

Return EndMethod

 

 

Restart

1

Process checkpoint records

Process checkpoint records

Process checkpoint records

 

 

Return NextPhase

Return EndMethod

Return EndMethod

 

2

Write a restart record to the restart log file to indicate end-of-restart

 

 

 

 

Return EndMethod

 

 

Terminate

1

Disconnect Load sessions

Disconnect Load sessions

Disconnect Load Sessions

 

 

Return NextPhase

Return NextPhase

Return NextPhase

 

2

Disconnect Teradata SQL session

Disconnect Teradata SQL session

Disconnect Teradata SQL session

 

 

Deallocate Global Variables

Return EndMethod

Return EndMethod

 

 

Return EndMethod