rp_replay

Description

Replays SQL statements after the connection is established to the failover server and before a new client request is accepted using that connection. Use rp_replay to specify to the connection before the failover occurs the SQL statements to be replayed.

Syntax

rp_replay spid, action, name, sql, canfail

Parameters

spid

Either an OpenSwitch process ID, or NULL.

action

The action to be performed on the SQL statements. Action can be ADD, DELETE, CLEAR, or SHOW. If the action is CLEAR, the name parameter must be NULL; if the action is SHOW, the name parameter can be NULL. See the Usage section for more information.

name

The name of the SQL statement, which must be unique within a thread

sql

A SQL statement. The maximum length of the SQL statement is 2048 bytes. Supply this parameter when the action is ADD.

canfail

Checks whether or not the statement is allowed to fail. If you do not supply this parameter, canfail has a value of zero (0). If canfail is 1, the connection is still considered properly failed over even if the statement did not execute on the remote server. Supply this parameter only when the action is ADD.

Examples

Example 1

Creates multiple rp_replay SQL statements for spid 8.

1> rp_replay 8, "add", "a1", "create table temp1(a int, b char)", 0
2> go
(return status = 0)

1> rp_replay 8, "add", "a2", "insert into temp1 values (15, 'w')", 1
2> go
(return status = 0)

1> rp_replay 8, "add", "a3", "insert into temp1 values (17, 'x')", 0
2> go
(return status = 0)

1> rp_replay 8, "add", "a4", "insert into temp1 values (22, 'y')", 0
2> go
(return status = 0)

1> rp_replay 8, "add", "a5", "insert into temp1 values (78, 'z')", 0
2> go
(return status = 0)

Example 2

Displays the rp_replay SQL statement for “a2” and spid 8.

1> rp_replay 8, "show", "a2"
2> go

Returns:

spid      SQL_Name      SQL_Statement                          canfail
--------  ------------  -------------------------------------  -------
8         a2            insert into temp1 values (15, 'w')     1
(return status = 0)

Example 3

Displays the rp_replay SQL statements for spid 8.

1> rp_replay 8, "show", NULL
2> go

Returns:

spid      SQL_Name      SQL_Statement                          canfail
--------  ------------  -------------------------------------  -------
8         a1            create table temp1(a int, b char)      0
8         a2            insert into temp1 values (15, 'w')     1
8         a3            insert into temp1 values (17, 'x')     0
8         a4            insert into temp1 values (22, 'y')     0
8         a5            insert into temp1 values (78, 'z')     0
(return status = 0)

Example 4

Displays all rp_replay SQL statements for “a1.”

1> rp_replay NULL, "show", "a1"
2> go

Results:

spid      SQL_Name      SQL_Statement                          canfail
--------  ------------  -------------------------------------  -------
8         a1            create table temp1(a int, b char)      0
11        a1            insert into temp1 values (97, 'q')     0
(return status = 0)

Example 5

Adds the same re_replay SQL statement to all spids that are currently active in the OpenSwitch server.

1> rp_replay NULL, "add", "a7", "set textsize 17889", 1
2> go
(return status = 0)

1> rp_replay NULL, "show", "a7"
2> go

Returns:

spid      SQL_Name      SQL_Statement                          canfail
--------  ------------  -------------------------------------  -------
8         a7            set textsize 17889                      1
11        a7            set textsize 17889                      1
(return status = 0)

Example 6

Displays all SQL statements for all spids.

1> rp_replay NULL, "show", NULL
2> go

Returns:

spid        SQL_Name              SQL_Statement                    canfail
-------------------------------------------------------------------------
8             a1             create table temp1(a int, b char)        0
8             a2             insert into temp1 values (15, 'w')       1
8             a3             insert into temp1 values (17, 'x')       0
8             a4             insert into temp1 values (22, 'y')       0
8             a5             insert into temp1 values (78, 'z')       0
8             a7             set textsize 17889                       1
11            a1             insert into temp1 values (97, 'q')       0
11            a2             insert into temp1 values (98,  'r')      1
11            a8             insert into temp1 values (100, 's')      0
11            a9             delete from temp1 where a = 22           0
11            a10            set textsize 32567                       0
11            a3             set rowcount 2                           1
11            a7             set textsize 17889                       1
(return status = 0)

Usage


Messages