This file is indexed.

/usr/lib/mysql-testsuite/include/rpl_udf.inc is in percona-server-test-5.6 5.6.22-rel71.0-0ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#####################################################################
# Author: Chuck Bell                                                #
# Date: 2006-12-21                                                  #
# Purpose: To test that UDFs are replicated in both row based and   #
# statement based format. This tests work completed in WL#3629.     #
#                                                                   #
# This test is designed to exercise two of the three types of UDFs: #
# 1) UDFs via loadable libraries, and 2) UDFs with a SQL body.      #
#####################################################################

--source include/have_udf.inc

#
# To run this tests the "sql/udf_example.c" need to be compiled into
# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
# the library are.
#

connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings

#
# Test 1) Test UDFs via loadable libraries
#
--echo "*** Test 1) Test UDFs via loadable libraries ***
--echo "Running on the master"
--enable_info
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
--error ER_CANT_FIND_DL_ENTRY
eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
--replace_column 3 UDF_LIB
SELECT * FROM mysql.func ORDER BY name;
--disable_info

save_master_pos;
connection slave;
sync_with_master;

# Check to see that UDF CREATE statements were replicated
--echo "Running on the slave"
--enable_info
--replace_column 3 UDF_LIB
SELECT * FROM mysql.func ORDER BY name;
--disable_info

connection master;

# Use the UDFs to do something
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
--disable_warnings
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
SELECT * FROM t1 ORDER BY sum;
--enable_warnings
--disable_info

sync_slave_with_master;

# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT * FROM t1 ORDER BY sum;

# Check to see that the functions are available for execution on the slave
SELECT myfunc_int(25);
SELECT myfunc_double(75.00);
--disable_info

connection master;

# Drop the functions
--echo "Running on the master"
--enable_info
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_int;
SELECT * FROM mysql.func ORDER BY name;
--disable_info

sync_slave_with_master;

# Check to see if the UDFs were dropped on the slave
--echo "Running on the slave"
--enable_info
SELECT * FROM mysql.func ORDER BY name;
--disable_info

connection master;

# Cleanup
--echo "Running on the master"
--enable_info
DROP TABLE t1;
--disable_info

#
# Test 2) Test UDFs with SQL body
#
--echo "*** Test 2) Test UDFs with SQL body ***
--echo "Running on the master"
--enable_info
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i; 
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00; 
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info

sync_slave_with_master;

# Check to see that UDF CREATE statements were replicated
--echo "Running on the slave"
--enable_info
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info

connection master;

# Use the UDFs to do something
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
SELECT * FROM t1 ORDER BY sum;
--disable_info

sync_slave_with_master;

# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT * FROM t1 ORDER BY sum;
--disable_info

connection master;

# Modify the UDFs to add a comment
--echo "Running on the master"
--enable_info
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info

sync_slave_with_master;

# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;

# Check to see that the functions are available for execution on the slave
SELECT myfuncsql_int(25);
SELECT myfuncsql_double(75.00);
--disable_info

connection master;

# Drop the functions
--echo "Running on the master"
--enable_info
DROP FUNCTION myfuncsql_double;
DROP FUNCTION myfuncsql_int;
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info

sync_slave_with_master;

# Check to see if the UDFs were dropped on the slave
--echo "Running on the slave"
--enable_info
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info

connection master;

# Cleanup
--echo "Running on the master"
--enable_info
DROP TABLE t1;
--disable_info