@@ -23,7 +23,215 @@ ndb_optimized_node_selection 3
23
23
show variables like 'ndb_optimized_node_selection';
24
24
Variable_name Value
25
25
ndb_optimized_node_selection 1
26
- set global ndb_optimized_node_selection=3 ;
26
+ SET @@ global. ndb_optimized_node_selection = @global_start_value ;
27
27
SELECT @@global.ndb_optimized_node_selection;
28
28
@@global.ndb_optimized_node_selection
29
29
3
30
+ Test behaviours within each variant
31
+ create table t1 (a int primary key, b int) engine=ndb comment="NDB_TABLE=READ_BACKUP=0";
32
+ insert into t1 values (0,0), (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9);
33
+ create table basecounts (node_id int primary key, transcount int) engine=innodb;
34
+ set ndb_optimized_node_selection=0;
35
+ show variables like 'ndb_optimized_node_selection';
36
+ Variable_name Value
37
+ ndb_optimized_node_selection 0
38
+ READ PRIMARY o-n-s 0 case Hinted autocommit select by pk
39
+ node_id balance
40
+ 1 HALF
41
+ 2 HALF
42
+ READ PRIMARY o-n-s 0 case Unhinted table scan
43
+ node_id balance
44
+ 1 HALF
45
+ 2 HALF
46
+ READ PRIMARY o-n-s 0 case Autocommit update by pk
47
+ node_id balance
48
+ 1 HALF
49
+ 2 HALF
50
+ set ndb_optimized_node_selection=1;
51
+ show variables like 'ndb_optimized_node_selection';
52
+ Variable_name Value
53
+ ndb_optimized_node_selection 1
54
+ READ PRIMARY o-n-s 1 case Hinted autocommit select by pk
55
+ node_id balance
56
+ 1 HALF
57
+ 2 HALF
58
+ READ PRIMARY o-n-s 1 case Unhinted table scan
59
+ node_id balance
60
+ 1 HALF
61
+ 2 HALF
62
+ READ PRIMARY o-n-s 1 case Autocommit update by pk
63
+ node_id balance
64
+ 1 HALF
65
+ 2 HALF
66
+ set ndb_optimized_node_selection=2;
67
+ show variables like 'ndb_optimized_node_selection';
68
+ Variable_name Value
69
+ ndb_optimized_node_selection 2
70
+ READ PRIMARY o-n-s 2 case Hinted autocommit select by pk
71
+ node_id balance
72
+ 1 NONE
73
+ 2 ALL
74
+ READ PRIMARY o-n-s 2 case Unhinted table scan
75
+ node_id balance
76
+ 1 HALF
77
+ 2 HALF
78
+ READ PRIMARY o-n-s 2 case Autocommit update by pk
79
+ node_id balance
80
+ 1 NONE
81
+ 2 ALL
82
+ set ndb_optimized_node_selection=3;
83
+ show variables like 'ndb_optimized_node_selection';
84
+ Variable_name Value
85
+ ndb_optimized_node_selection 3
86
+ READ PRIMARY o-n-s 3 case Hinted autocommit select by pk
87
+ node_id balance
88
+ 1 NONE
89
+ 2 ALL
90
+ READ PRIMARY o-n-s 3 case Unhinted table scan
91
+ node_id balance
92
+ 1 HALF
93
+ 2 HALF
94
+ READ PRIMARY o-n-s 3 case Autocommit update by pk
95
+ node_id balance
96
+ 1 NONE
97
+ 2 ALL
98
+ drop table basecounts;
99
+ drop table t1;
100
+ create table t1 (a int primary key, b int) engine=ndb comment="NDB_TABLE=READ_BACKUP=1";
101
+ insert into t1 values (0,0), (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9);
102
+ create table basecounts (node_id int primary key, transcount int) engine=innodb;
103
+ set ndb_optimized_node_selection=0;
104
+ show variables like 'ndb_optimized_node_selection';
105
+ Variable_name Value
106
+ ndb_optimized_node_selection 0
107
+ READ BACKUP o-n-s 0 case Hinted autocommit select by pk
108
+ node_id balance
109
+ 1 HALF
110
+ 2 HALF
111
+ READ BACKUP o-n-s 0 case Unhinted table scan
112
+ node_id balance
113
+ 1 HALF
114
+ 2 HALF
115
+ READ BACKUP o-n-s 0 case Autocommit update by pk
116
+ node_id balance
117
+ 1 HALF
118
+ 2 HALF
119
+ set ndb_optimized_node_selection=1;
120
+ show variables like 'ndb_optimized_node_selection';
121
+ Variable_name Value
122
+ ndb_optimized_node_selection 1
123
+ READ BACKUP o-n-s 1 case Hinted autocommit select by pk
124
+ node_id balance
125
+ 1 HALF
126
+ 2 HALF
127
+ READ BACKUP o-n-s 1 case Unhinted table scan
128
+ node_id balance
129
+ 1 HALF
130
+ 2 HALF
131
+ READ BACKUP o-n-s 1 case Autocommit update by pk
132
+ node_id balance
133
+ 1 HALF
134
+ 2 HALF
135
+ set ndb_optimized_node_selection=2;
136
+ show variables like 'ndb_optimized_node_selection';
137
+ Variable_name Value
138
+ ndb_optimized_node_selection 2
139
+ READ BACKUP o-n-s 2 case Hinted autocommit select by pk
140
+ node_id balance
141
+ 1 HALF
142
+ 2 HALF
143
+ READ BACKUP o-n-s 2 case Unhinted table scan
144
+ node_id balance
145
+ 1 HALF
146
+ 2 HALF
147
+ READ BACKUP o-n-s 2 case Autocommit update by pk
148
+ node_id balance
149
+ 1 HALF
150
+ 2 HALF
151
+ set ndb_optimized_node_selection=3;
152
+ show variables like 'ndb_optimized_node_selection';
153
+ Variable_name Value
154
+ ndb_optimized_node_selection 3
155
+ READ BACKUP o-n-s 3 case Hinted autocommit select by pk
156
+ node_id balance
157
+ 1 HALF
158
+ 2 HALF
159
+ READ BACKUP o-n-s 3 case Unhinted table scan
160
+ node_id balance
161
+ 1 HALF
162
+ 2 HALF
163
+ READ BACKUP o-n-s 3 case Autocommit update by pk
164
+ node_id balance
165
+ 1 HALF
166
+ 2 HALF
167
+ drop table basecounts;
168
+ drop table t1;
169
+ create table t1 (a int primary key, b int) engine=ndb comment="NDB_TABLE=FULLY_REPLICATED=1";
170
+ insert into t1 values (0,0), (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9);
171
+ create table basecounts (node_id int primary key, transcount int) engine=innodb;
172
+ set ndb_optimized_node_selection=0;
173
+ show variables like 'ndb_optimized_node_selection';
174
+ Variable_name Value
175
+ ndb_optimized_node_selection 0
176
+ FULLY REPLICATED o-n-s 0 case Hinted autocommit select by pk
177
+ node_id balance
178
+ 1 HALF
179
+ 2 HALF
180
+ FULLY REPLICATED o-n-s 0 case Unhinted table scan
181
+ node_id balance
182
+ 1 HALF
183
+ 2 HALF
184
+ FULLY REPLICATED o-n-s 0 case Autocommit update by pk
185
+ node_id balance
186
+ 1 HALF
187
+ 2 HALF
188
+ set ndb_optimized_node_selection=1;
189
+ show variables like 'ndb_optimized_node_selection';
190
+ Variable_name Value
191
+ ndb_optimized_node_selection 1
192
+ FULLY REPLICATED o-n-s 1 case Hinted autocommit select by pk
193
+ node_id balance
194
+ 1 HALF
195
+ 2 HALF
196
+ FULLY REPLICATED o-n-s 1 case Unhinted table scan
197
+ node_id balance
198
+ 1 HALF
199
+ 2 HALF
200
+ FULLY REPLICATED o-n-s 1 case Autocommit update by pk
201
+ node_id balance
202
+ 1 HALF
203
+ 2 HALF
204
+ set ndb_optimized_node_selection=2;
205
+ show variables like 'ndb_optimized_node_selection';
206
+ Variable_name Value
207
+ ndb_optimized_node_selection 2
208
+ FULLY REPLICATED o-n-s 2 case Hinted autocommit select by pk
209
+ node_id balance
210
+ 1 HALF
211
+ 2 HALF
212
+ FULLY REPLICATED o-n-s 2 case Unhinted table scan
213
+ node_id balance
214
+ 1 HALF
215
+ 2 HALF
216
+ FULLY REPLICATED o-n-s 2 case Autocommit update by pk
217
+ node_id balance
218
+ 1 HALF
219
+ 2 HALF
220
+ set ndb_optimized_node_selection=3;
221
+ show variables like 'ndb_optimized_node_selection';
222
+ Variable_name Value
223
+ ndb_optimized_node_selection 3
224
+ FULLY REPLICATED o-n-s 3 case Hinted autocommit select by pk
225
+ node_id balance
226
+ 1 HALF
227
+ 2 HALF
228
+ FULLY REPLICATED o-n-s 3 case Unhinted table scan
229
+ node_id balance
230
+ 1 HALF
231
+ 2 HALF
232
+ FULLY REPLICATED o-n-s 3 case Autocommit update by pk
233
+ node_id balance
234
+ 1 HALF
235
+ 2 HALF
236
+ drop table basecounts;
237
+ drop table t1;
0 commit comments