Recoverable Network Protocol (RNP) is the protocol that re-establishes a connection with the Advanced SQL Engine following a network error or a SQL Engine failure. RNP can recover from network errors and re-execute a command or continue retrieving a result set after reconnect. However after a SQL Engine 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 SQL Engine 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 SQL Engine 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.
The TdConnectionStringBuilder.Recovery property enables RNP and Redrive, if the feature is available from the SQL Engine. 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:
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 SQL Engine and/or to redrive the command during SQL Engine or network failures.
These properties support RNP and Redrive and affect the internal algorithms that are used to retry network errors and to reconnect to the SQL Engine. 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.
These properties support the algorithm that is used to connect to the SQL Engine 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. |
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.
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 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.
The TdConnection.State will transition from Open
to Connecting
while a connection has been lost due to a network error or a SQL Engine failure when the following is true:
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.
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 SQL Engine 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.
Redrive and Opening Connections
TdConnectionStringBuilder Recovery and the Profile Name
Redrive and RNP Restrictions
Enabling Redrive in QueryBand
Recoverable Network Protocol and Redrive Performance Considerations and Best Practices
TdConnection RecoveryEvent Supporting Reconnection