Send feedback on this topic.
Teradata.Client.Provider
Redrive And Recoverable Network Protocol
.NET Data Provider for Teradata > Developer's Guide > Working with the Teradata Database Features > Redrive And Recoverable Network Protocol

Recoverable Network Protocol (RNP) is the protocol that re-establishes a connection with the Teradata database following a network error or a database failure. RNP can recover from network errors and re-execute a command or continue retrieving a result set after reconnect. However after a database restart, the spool files are not preserved so a command cannot be re-executed or continued.

Redrive requires RNP and will attempt to resubmit a command that was active during the network error or database failure that caused a reconnection. Teradata will return information that determines if a command is elgible to be redriven. When Redrive is enabled, the spool files that are generated during a command execution on the database are preserved. This enables the commands to be redriven automatically by the Data Provider. The Redrive and RNP Restrictions page contains some of the limitations in redriving commands.

Enabling RNP and Redrive

The TdConnectionStringBuilder.Recovery property enables RNP and Redrive, if the feature is available from the database. There are options to select RNP, Redrive (which includes RNP), Off and Default. The default setting allows the Teradata Active System Management (TASM) Redrive setting to control Redrive support.

Redrive and RNP differ primarily in two aspects:

  1. First Redrive requires extra overhead from the database to track and manage requests to be redriven. There may be some performance penalty associated with Redrive.
  2. Secondly, Redrive offers the capability of restarting and continuing commands across a Teradata database restart. Spool files are deleted during a database restart using RNP while Redrive maintains spool files across a database restart assisting the database during Redrive operations.

A consideration of enabling Redrive and RNP for an application is the expected failure response. Applications that require a fail fast behavior, such as web pages, may want to disable this feature by selecting TdConnectionStringBuilder.Recovery Off. The .NET Data Provider Visual Studio integrated applications disable Recovery for this reason. Users would not want their graphical user interface delayed for the time required to restart the Teradata Database and/or to redrive the command during database or network failures.

ConnectionString Settings Found in the Application Configuration File Supporting RNP and Redrive

These properties support RNP and Redrive and affect the internal algorithms that are used to retry network errors and to reconnect to the database. These properties are described in TdConnectionStringBuilder.Properties and in the Configuration File Provider Section. The properties include:

Property Description
CommandTimeout This sets the default CommandTimeout
RecoveryTimeout The additional time provided (if applicable) to reconnect when enabled by TdConnectionStringBuilder.Recovery
RecoveryCommandTimeoutOverride   Enables a command with a finite CommandTimeout to supply A RecoveryTimeout value for reconnection. When RecoveryCommandTimeoutOverride is false, only the remaining CommandTimeout is used to reconnect.
RecoveryStartInterval The period of time to delay between attempts to retry a command or to reconnect. The RecoveryIntervalFactor may be used to modify the RecoveryStartInterval between each successive retry or reconnection attempt.
RecoveryIntervalFactor This additive factor modifies the RecoveryStartInterval for each successive attempt to retry a reconnection.
RecoveryMaximumInterval This represents the maximum interval time in seconds, used to limit the retry interval time adjusted by the RecoveryIntervalFactor.

Each of these recovery properties and the CommandTimeout are used in an internal algorithm to retry reconnection attempts. The Explanations and Applicability of the Recovery Properties describes these properties and their application in the internal reconnection algorithm.

ConnectionString Settings Found in the Application Configuration File Supporting Connections

These properties support the algorithm that is used to connect to the database and to retry network errors encountered during connection. These properties are described in TdConnectionStringBuilder.Properties and in the Configuration File Provider Section. The properties include:

Property Description
ConnectionTimeout This sets the default ConnectionTimeout.
ConnectMaxRetryCount The maximum number of attempts of a retryable error during TdConnection.Open. When this count is exceeded, an error is returned to the application.

Managing Recovery with a Custom Profile Name

Another TdConnectionStringBuilder property ProfileName is used to define custom profiles containing a collection of the TdConnectionStringBuilder properties that are supported in the application configuration file. The TdConnectionStringBuilder Recovery and the Profile Name describes the TdConnectionStringBuilder.Recovery and TdConnectionStringBuilder.ProfileName properties.

Configuration File Support

All of the TdConnectionStringBuilder properties above, are also supported from an application configuration file. This enables these properties to be changed in an application without recompiling the application. The properties are grouped together in profiles and the profile name that is used during the application execution is determined from the TdConnectionStringBuilder.ProfileName. If the ProfileName is not found, an error indicating an invalid connection string attribute will be returned. More details on the priority of the TdConnectionStringBuilder properties and how they are defined is found in the Configuration File Provider Section.

The RecoveryTimeout and the RecoverConnection Event

The TdConnection.RecoverConnection event will be raised when RNP or Redrive is enabled and the Data Provider has started a reconnection. The RecoveryConnection event will also be raised during subsequent attempts to reconnect after a predefined delay period. The RecoveryStartInterval defines the starting delay period and is adjusted by the RecoveryIntervalFactor, until the RecoveryMaximumInterval is reached.

The RecoverConnection event enables an application to either extend the original RecoveryTimeout, change the defined RecoveryTimeout or to terminate a reconnection that may be not completing in a timely manner, by supplying a TdRecoveryEventArgs.RecoveryTimeout of 0.

TdConnection Connecting State

The TdConnection.State will transition from Open to Connecting while a connection has been lost due to a network error or a database failure when the following is true:

  1. RNP or Redrive is enabled
  2. The Teradata Database supports either of these features

If neither RNP or Redrive is enabled the Data Provider will transition to the TdConnection.State of Broken. Once the TdConnection.State Broken is the current state, it must be closed in order to re-open the connection.

Cancelling Reconnection

While the Data Provider is attempting to reconnect and the TdConnection.State is Connecting, an application may desire to cancel the attempt at reconnection. To cancel reconnection supply a TdRecoveryEventArgs.RecoveryTimeout of 0 to the TdConnection.RecoverConnection event. The current connection will be destroyed and cleaned up later by the database after a Teradata Gateway timeout value (default is 20 minutes). Once the reconnection is cancelled, the TdConnection.State will transition to Broken. To re-use this connection, the connection must be closed after it transitions to Broken. TdConnection.Close must not be executed from within the TdConnection.RecoverConnection event and it must be closed after the TdConnection.State has transitioned to Broken in order to re-use this connection.

During reconnection a delay in retrying reconnection is introduced to reduce excessive network traffic. The application configuration file property (if using a ProfileName) or the TdConnectionStringBuilder RecoveryMaximumInterval will limit the maximum delay period between reconnection attempts. The cancellation of reconnection may be delayed the current interval delay time starting with the RecoveryStartInterval and limited by the RecoveryMaximumInterval before the cancellation is acknowledged within the Data Provider.

In This Section

Redrive and Opening Connections
TdConnectionStringBuilder Recovery and the Profile Name
Redrive and RNP Restrictions

See Also

Enabling Redrive in QueryBand
Recoverable Network Protocol and Redrive Performance Considerations and Best Practices
TdConnection RecoveryEvent Supporting Reconnection