MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndberror.c
1 /*
2  Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 
19 #include <ndb_global.h>
20 
21 #include <my_base.h>
22 #include <ndberror.h>
23 #include <m_string.h>
24 
25 #include "../mgmsrv/ndb_mgmd_error.h"
26 
27 #include "NdbQueryBuilderImpl.hpp"
28 
29 typedef struct ErrorBundle {
30  int code;
31  int mysql_code;
32  ndberror_classification classification;
33  const char * message;
34 } ErrorBundle;
35 
40 #define ST_S ndberror_st_success
41 #define ST_P ndberror_st_permanent
42 #define ST_T ndberror_st_temporary
43 #define ST_U ndberror_st_unknown
44 
45 #define NE ndberror_cl_none
46 #define AE ndberror_cl_application
47 #define CE ndberror_cl_configuration
48 #define ND ndberror_cl_no_data_found
49 #define CV ndberror_cl_constraint_violation
50 #define SE ndberror_cl_schema_error
51 #define UD ndberror_cl_user_defined
52 
53 #define IS ndberror_cl_insufficient_space
54 #define TR ndberror_cl_temporary_resource
55 #define NR ndberror_cl_node_recovery
56 #define OL ndberror_cl_overload
57 #define TO ndberror_cl_timeout_expired
58 #define NS ndberror_cl_node_shutdown
59 
60 #define UR ndberror_cl_unknown_result
61 
62 #define IE ndberror_cl_internal_error
63 #define NI ndberror_cl_function_not_implemented
64 #define UE ndberror_cl_unknown_error_code
65 
66 #define OE ndberror_cl_schema_object_already_exists
67 
68 #define IT ndberror_cl_internal_temporary
69 
70 /* default mysql error code for unmapped codes */
71 #define DMEC -1
72 
73 static const char* empty_string = "";
74 
75 /*
76  * Error code ranges are reserved for respective block
77  *
78  * 200 - TC
79  * 300 - DIH
80  * 400 - LQH
81  * 600 - ACC
82  * 700 - DICT
83  * 800 - TUP
84  * 900 - TUX
85  * 1200 - LQH
86  * 1300 - BACKUP
87  * 1400 - SUMA
88  * 1500 - LGMAN
89  * 1600 - TSMAN
90  * 1700 - QMGR
91  * 4000 - API
92  * 4100 - ""
93  * 4200 - ""
94  * 4300 - ""
95  * 4400 - ""
96  * 4500 - ""
97  * 4600 - ""
98  * 4700 - "" Event
99  * 4800 - API, QueryBuilder
100  * 5000 - Management server
101  */
102 
103 static
104 const
105 ErrorBundle ErrorCodes[] = {
109  { 0, 0, NE, "No error" },
110 
114  { 626, HA_ERR_KEY_NOT_FOUND, ND, "Tuple did not exist" },
115 
119  { 630, HA_ERR_FOUND_DUPP_KEY, CV, "Tuple already existed when attempting to insert" },
120  { 839, DMEC, CV, "Illegal null attribute" },
121  { 840, DMEC, CV, "Trying to set a NOT NULL attribute to NULL" },
122  { 893, HA_ERR_FOUND_DUPP_KEY, CV, "Constraint violation e.g. duplicate value in unique index" },
123 
127  { 286, DMEC, NR, "Node failure caused abort of transaction" },
128  { 250, DMEC, NR, "Node where lock was held crashed, restart scan transaction" },
129  { 499, DMEC, NR, "Scan take over error, restart scan transaction" },
130  { 1204, DMEC, NR, "Temporary failure, distribution changed" },
131  { 4002, DMEC, NR, "Send to NDB failed" },
132  { 4010, DMEC, NR, "Node failure caused abort of transaction" },
133  { 4025, DMEC, NR, "Node failure caused abort of transaction" },
134  { 4027, DMEC, NR, "Node failure caused abort of transaction" },
135  { 4028, DMEC, NR, "Node failure caused abort of transaction" },
136  { 4029, DMEC, NR, "Node failure caused abort of transaction" },
137  { 4031, DMEC, NR, "Node failure caused abort of transaction" },
138  { 4033, DMEC, NR, "Send to NDB failed" },
139  { 4115, DMEC, NR,
140  "Transaction was committed but all read information was not "
141  "received due to node crash" },
142  { 4119, DMEC, NR, "Simple/dirty read failed due to node failure" },
143  { 20016, DMEC, NR, "Query aborted due to node failure" },
144 
148  { 280, DMEC, NS, "Transaction aborted due to node shutdown" },
149  /* This scan trans had an active fragment scan in a LQH which have crashed */
150  { 270, DMEC, NS, "Transaction aborted due to node shutdown" },
151  { 1223, DMEC, NS, "Read operation aborted due to node shutdown" },
152  { 4023, DMEC, NS, "Transaction aborted due to node shutdown" },
153  { 4030, DMEC, NS, "Transaction aborted due to node shutdown" },
154  { 4034, DMEC, NS, "Transaction aborted due to node shutdown" },
155 
156 
157 
161  { 4007, DMEC, UR, "Send to ndbd node failed" },
162  { 4008, DMEC, UR, "Receive from NDB failed" },
163  { 4009, HA_ERR_NO_CONNECTION, UR, "Cluster Failure" },
164  { 4012, DMEC, UR,
165  "Request ndbd time-out, maybe due to high load or communication problems"},
166  { 4013, DMEC, UR, "Request timed out in waiting for node failure"},
167  { 4024, DMEC, UR,
168  "Time-out, most likely caused by simple read or cluster failure" },
169 
173  { 217, DMEC, TR, "217" },
174  { 218, DMEC, TR, "Out of LongMessageBuffer" },
175  { 219, DMEC, TR, "219" },
176  { 233, DMEC, TR,
177  "Out of operation records in transaction coordinator (increase MaxNoOfConcurrentOperations)" },
178  { 275, DMEC, TR, "Out of transaction records for complete phase (increase MaxNoOfConcurrentTransactions)" },
179  { 279, DMEC, TR, "Out of transaction markers in transaction coordinator" },
180  { 414, DMEC, TR, "414" },
181  { 418, DMEC, TR, "Out of transaction buffers in LQH" },
182  { 419, DMEC, TR, "419" },
183  { 245, DMEC, TR, "Too many active scans" },
184  { 488, DMEC, TR, "Too many active scans" },
185  { 489, DMEC, TR, "Too many active scans" },
186  { 490, DMEC, TR, "Too many active scans" },
187  { 805, DMEC, TR, "Out of attrinfo records in tuple manager" },
188  { 830, DMEC, TR, "Out of add fragment operation records" },
189  { 873, DMEC, TR, "Out of attrinfo records for scan in tuple manager" },
190  { 899, DMEC, IE, "Internal error: rowid already allocated" },
191  { 1217, DMEC, TR, "Out of operation records in local data manager (increase MaxNoOfLocalOperations)" },
192  { 1218, DMEC, TR, "Send Buffers overloaded in NDB kernel" },
193  { 1220, DMEC, TR, "REDO log files overloaded (increase FragmentLogFileSize)" },
194  { 1234, DMEC, TR, "REDO log files overloaded (increase disk hardware)" },
195  { 1222, DMEC, TR, "Out of transaction markers in LQH" },
196  { 4021, DMEC, TR, "Out of Send Buffer space in NDB API" },
197  { 4022, DMEC, TR, "Out of Send Buffer space in NDB API" },
198  { 4032, DMEC, TR, "Out of Send Buffer space in NDB API" },
199  { 1501, DMEC, TR, "Out of undo space" },
200  { 288, DMEC, TR, "Out of index operations in transaction coordinator (increase MaxNoOfConcurrentIndexOperations)" },
201  { 289, DMEC, TR, "Out of transaction buffer memory in TC (increase TransactionBufferMemory)" },
202  { 780, DMEC, TR, "Too many schema transactions" },
203  { 783, DMEC, TR, "Too many schema operations" },
204  { 785, DMEC, TR, "Schema object is busy with another schema transaction" },
205  { 291, DMEC, TR, "Out of scanfrag records in TC (increase MaxNoOfLocalScans)" },
206 
210  { 623, HA_ERR_RECORD_FILE_FULL, IS, "623" },
211  { 624, HA_ERR_RECORD_FILE_FULL, IS, "624" },
212  { 625, HA_ERR_INDEX_FILE_FULL, IS, "Out of memory in Ndb Kernel, hash index part (increase IndexMemory)" },
213  { 633, HA_ERR_INDEX_FILE_FULL, IS, "Table fragment hash index has reached maximum possible size" },
214  { 640, DMEC, IS, "Too many hash indexes (should not happen)" },
215  { 826, HA_ERR_RECORD_FILE_FULL, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" },
216  { 827, HA_ERR_RECORD_FILE_FULL, IS, "Out of memory in Ndb Kernel, table data (increase DataMemory)" },
217  { 902, HA_ERR_RECORD_FILE_FULL, IS, "Out of memory in Ndb Kernel, ordered index data (increase DataMemory)" },
218  { 903, HA_ERR_INDEX_FILE_FULL, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" },
219  { 904, HA_ERR_INDEX_FILE_FULL, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" },
220  { 905, DMEC, IS, "Out of attribute records (increase MaxNoOfAttributes)" },
221  { 1601, HA_ERR_RECORD_FILE_FULL, IS, "Out extents, tablespace full" },
222  { 1602, DMEC, IS,"No datafile in tablespace" },
223 
227  { 266, HA_ERR_LOCK_WAIT_TIMEOUT, TO, "Time-out in NDB, probably caused by deadlock" },
228  { 274, HA_ERR_LOCK_WAIT_TIMEOUT, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */
229  { 296, HA_ERR_LOCK_WAIT_TIMEOUT, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */
230  { 297, HA_ERR_LOCK_WAIT_TIMEOUT, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout, temporary!! */
231  { 237, HA_ERR_LOCK_WAIT_TIMEOUT, TO, "Transaction had timed out when trying to commit it" },
232 
236  { 701, DMEC, OL, "System busy with other schema operation" },
237  { 711, DMEC, OL, "System busy with node restart, schema operations not allowed" },
238  { 410, DMEC, OL, "REDO log files overloaded (decrease TimeBetweenLocalCheckpoints or increase NoOfFragmentLogFiles)" },
239  { 677, DMEC, OL, "Index UNDO buffers overloaded (increase UndoIndexBuffer)" },
240  { 891, DMEC, OL, "Data UNDO buffers overloaded (increase UndoDataBuffer)" },
241  { 1221, DMEC, OL, "REDO buffers overloaded (increase RedoBuffer)" },
242  { 4006, DMEC, OL, "Connect failure - out of connection objects (increase MaxNoOfConcurrentTransactions)" },
243 
244 
245  /*
246  * Internal Temporary
247  */
248  { 702, DMEC, IT, "Request to non-master" },
249  { 787, DMEC, IT, "Schema transaction aborted" },
250 
254  { 896, DMEC, IE, "Tuple corrupted - wrong checksum or column data in invalid format" },
255  { 901, DMEC, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" },
256  { 202, DMEC, IE, "202" },
257  { 203, DMEC, IE, "203" },
258  { 207, DMEC, IE, "207" },
259  { 208, DMEC, IE, "208" },
260  { 209, DMEC, IE, "Communication problem, signal error" },
261  { 220, DMEC, IE, "220" },
262  { 230, DMEC, IE, "230" },
263  { 232, DMEC, IE, "232" },
264  { 238, DMEC, IE, "238" },
265  { 271, DMEC, IE, "Simple Read transaction without any attributes to read" },
266  { 272, DMEC, IE, "Update operation without any attributes to update" },
267  { 276, DMEC, IE, "276" },
268  { 277, DMEC, IE, "277" },
269  { 278, DMEC, IE, "278" },
270  { 287, DMEC, IE, "Index corrupted" },
271  { 290, DMEC, IE, "Corrupt key in TC, unable to xfrm" },
272  { 293, DMEC, IE, "Inconsistent trigger state in TC block" },
273  { 292, DMEC, IE, "Inconsistent index state in TC block" },
274  { 631, DMEC, IE, "631" },
275  { 632, DMEC, IE, "632" },
276  { 706, DMEC, IE, "Inconsistency during table creation" },
277  { 781, DMEC, IE, "Invalid schema transaction key from NDB API" },
278  { 782, DMEC, IE, "Invalid schema transaction id from NDB API" },
279  { 784, DMEC, TR, "Invalid schema transaction state" },
280  { 788, DMEC, TR, "Missing schema operation at takeover of schema transaction" },
281  { 809, DMEC, IE, "809" },
282  { 812, DMEC, IE, "812" },
283  { 833, DMEC, IE, "833" },
284  { 871, DMEC, IE, "871" },
285  { 882, DMEC, IE, "882" },
286  { 883, DMEC, IE, "883" },
287  { 887, DMEC, IE, "887" },
288  { 888, DMEC, IE, "888" },
289  { 890, DMEC, IE, "890" },
290  { 4000, DMEC, IE, "MEMORY ALLOCATION ERROR" },
291  { 4001, DMEC, IE, "Signal Definition Error" },
292  { 4005, DMEC, IE, "Internal Error in NdbApi" },
293  { 4011, DMEC, IE, "Internal Error in NdbApi" },
294  { 4107, DMEC, IE, "Simple Transaction and Not Start" },
295  { 4108, DMEC, IE, "Faulty operation type" },
296  { 4109, DMEC, IE, "Faulty primary key attribute length" },
297  { 4110, DMEC, IE, "Faulty length in ATTRINFO signal" },
298  { 4111, DMEC, IE, "Status Error in NdbConnection" },
299  { 4113, DMEC, IE, "Too many operations received" },
300  { 4320, DMEC, IE, "Cannot use the same object twice to create table" },
301  { 4321, DMEC, IE, "Trying to start two schema transactions" },
302  { 4344, DMEC, IE, "Only DBDICT and TRIX can send requests to TRIX" },
303  { 4345, DMEC, IE, "TRIX block is not available yet, probably due to node failure" },
304  { 4346, DMEC, IE, "Internal error at index create/build" },
305  { 4347, DMEC, IE, "Bad state at alter index" },
306  { 4348, DMEC, IE, "Inconsistency detected at alter index" },
307  { 4349, DMEC, IE, "Inconsistency detected at index usage" },
308  { 4350, DMEC, IE, "Transaction already aborted" },
309  { 4351, DMEC, TO, "Timeout/deadlock during index build" },
310  { 294, DMEC, IE, "Unlocked operation has out of range index" },
311  { 295, DMEC, IE, "Unlocked operation has invalid state" },
312  { 298, DMEC, IE, "Invalid distribution key" },
313  { 416, DMEC, IE, "Bad state handling unlock request" },
314 
318  { 281, HA_ERR_NO_CONNECTION, AE, "Operation not allowed due to cluster shutdown in progress" },
319  { 299, DMEC, AE, "Operation not allowed or aborted due to single user mode" },
320  { 261, DMEC, AE,
321  "DML count in transaction exceeds config parameter MaxDMLOperationsPerTransaction" },
322  { 763, DMEC, AE, "DDL is not supported with mixed data-node versions" },
323  { 823, DMEC, AE, "Too much attrinfo from application in tuple manager" },
324  { 829, DMEC, AE, "Corrupt data received for insert/update" },
325  { 831, DMEC, AE, "Too many nullable/bitfields in table definition" },
326  { 850, DMEC, AE, "Too long or too short default value"},
327  { 851, DMEC, AE, "Maximum 8052 bytes of FIXED columns supported"
328  ", use varchar or COLUMN_FORMAT DYNMIC instead" },
329  { 876, DMEC, AE, "876" },
330  { 877, DMEC, AE, "877" },
331  { 878, DMEC, AE, "878" },
332  { 879, DMEC, AE, "879" },
333  { 880, DMEC, AE, "Tried to read too much - too many getValue calls" },
334  { 884, DMEC, AE, "Stack overflow in interpreter" },
335  { 885, DMEC, AE, "Stack underflow in interpreter" },
336  { 886, DMEC, AE, "More than 65535 instructions executed in interpreter" },
337  { 897, DMEC, AE, "Update attempt of primary key via ndbcluster internal api (if this occurs via the MySQL server it is a bug, please report)" },
338  { 892, DMEC, AE, "Unsupported type in scan filter" },
339  { 1233, DMEC, AE, "Table read-only" },
340  { 4256, DMEC, AE, "Must call Ndb::init() before this function" },
341  { 4257, DMEC, AE, "Tried to read too much - too many getValue calls" },
342  { 320, DMEC, AE, "Invalid no of nodes specified for new nodegroup" },
343  { 321, DMEC, AE, "Invalid nodegroup id" },
344  { 322, DMEC, AE, "Invalid node(s) specified for new nodegroup, node already in nodegroup" },
345  { 323, DMEC, AE, "Invalid nodegroup id, nodegroup already existing" },
346  { 324, DMEC, AE, "Invalid node(s) specified for new nodegroup, no node in nodegroup is started" },
347  { 417, DMEC, AE, "Bad operation reference - double unlock" },
348 
352  { 242, DMEC, AE, "Zero concurrency in scan"},
353  { 244, DMEC, AE, "Too high concurrency in scan"},
354  { 269, DMEC, AE, "No condition and attributes to read in scan"},
355  { 874, DMEC, AE, "Too much attrinfo (e.g. scan filter) for scan in tuple manager" },
356  { 4600, DMEC, AE, "Transaction is already started"},
357  { 4601, DMEC, AE, "Transaction is not started"},
358  { 4602, DMEC, AE, "You must call getNdbOperation before executeScan" },
359  { 4603, DMEC, AE, "There can only be ONE operation in a scan transaction" },
360  { 4604, DMEC, AE, "takeOverScanOp, to take over a scanned row one must explicitly request keyinfo on readTuples call" },
361  { 4605, DMEC, AE, "You may only call readTuples() once for each operation"},
362  { 4607, DMEC, AE, "There may only be one operation in a scan transaction"},
363  { 4608, DMEC, AE, "You can not takeOverScan unless you have used openScanExclusive"},
364  { 4609, DMEC, AE, "You must call nextScanResult before trying to takeOverScan"},
365  { 4232, DMEC, AE, "Parallelism can only be between 1 and 240" },
366 
371  { 4713, DMEC, SE, "Column defined in event does not exist in table"},
372 
377  { 4707, DMEC, AE, "Too many event have been defined"},
378  { 4708, DMEC, AE, "Event name is too long"},
379  { 4709, DMEC, AE, "Can't accept more subscribers"},
380  { 746, DMEC, OE, "Event name already exists"},
381  { 747, DMEC, IS, "Out of event records"},
382  { 748, DMEC, TR, "Busy during read of event table"},
383  { 4710, DMEC, AE, "Event not found"},
384  { 4711, DMEC, AE, "Creation of event failed"},
385  { 4712, DMEC, AE, "Stopped event operation does not exist. Already stopped?"},
386 
391  { 4731, DMEC, IE, "Event not found"},
392 
396  { 306, DMEC, IE, "Out of fragment records in DIH" },
397  { 311, DMEC, AE, "Undefined partition used in setPartitionId" },
398  { 703, DMEC, SE, "Invalid table format" },
399  { 704, DMEC, SE, "Attribute name too long" },
400  { 705, DMEC, SE, "Table name too long" },
401  { 707, DMEC, SE, "No more table metadata records (increase MaxNoOfTables)" },
402  { 708, DMEC, SE, "No more attribute metadata records (increase MaxNoOfAttributes)" },
403  { 709, HA_ERR_NO_SUCH_TABLE, SE, "No such table existed" },
404  { 710, DMEC, SE, "Internal: Get by table name not supported, use table id." },
405  { 721, HA_ERR_TABLE_EXIST, OE, "Schema object with given name already exists" },
406  { 723, HA_ERR_NO_SUCH_TABLE, SE, "No such table existed" },
407  { 736, DMEC, SE, "Unsupported array size" },
408  { 737, HA_WRONG_CREATE_OPTION, SE, "Attribute array size too big" },
409  { 738, HA_WRONG_CREATE_OPTION, SE, "Record too big" },
410  { 739, HA_WRONG_CREATE_OPTION, SE, "Unsupported primary key length" },
411  { 740, HA_WRONG_CREATE_OPTION, SE, "Nullable primary key not supported" },
412  { 741, DMEC, SE, "Unsupported alter table" },
413  { 743, HA_WRONG_CREATE_OPTION, SE, "Unsupported character set in table or index" },
414  { 744, DMEC, SE, "Character string is invalid for given character set" },
415  { 745, HA_WRONG_CREATE_OPTION, SE, "Distribution key not supported for char attribute (use binary attribute)" },
416  { 771, HA_WRONG_CREATE_OPTION, AE, "Given NODEGROUP doesn't exist in this cluster" },
417  { 772, HA_WRONG_CREATE_OPTION, IE, "Given fragmentType doesn't exist" },
418  { 749, HA_WRONG_CREATE_OPTION, IE, "Primary Table in wrong state" },
419  { 779, HA_WRONG_CREATE_OPTION, SE, "Invalid undo buffer size" },
420  { 791, HA_WRONG_CREATE_OPTION, SE, "Too many total bits in bitfields" },
421  { 795, DMEC, IE, "Out of LongMessageBuffer in DICT" },
422  { 764, HA_WRONG_CREATE_OPTION, SE, "Invalid extent size" },
423  { 789, HA_WRONG_CREATE_OPTION, AE, "Logfile group not found" },
424  { 765, DMEC, SE, "Out of filegroup records" },
425  { 750, IE, SE, "Invalid file type" },
426  { 751, DMEC, SE, "Out of file records" },
427  { 752, DMEC, SE, "Invalid file format" },
428  { 753, IE, SE, "Invalid filegroup for file" },
429  { 754, IE, SE, "Invalid filegroup version when creating file" },
430  { 755, HA_WRONG_CREATE_OPTION, SE, "Invalid tablespace" },
431  { 756, DMEC, SE, "Index on disk column is not supported" },
432  { 757, DMEC, SE, "Varsize bitfield not supported" },
433  { 758, DMEC, SE, "Tablespace has changed" },
434  { 759, DMEC, SE, "Invalid tablespace version " },
435  { 760, DMEC, SE, "File already exists", },
436  { 761, DMEC, SE, "Unable to drop table as backup is in progress" },
437  { 762, DMEC, SE, "Unable to alter table as backup is in progress" },
438  { 766, DMEC, SE, "Cant drop file, no such file" },
439  { 767, DMEC, SE, "Cant drop filegroup, no such filegroup" },
440  { 768, DMEC, SE, "Cant drop filegroup, filegroup is used" },
441  { 769, DMEC, SE, "Drop undofile not supported, drop logfile group instead" },
442  { 770, DMEC, SE, "Cant drop file, file is used" },
443  { 774, DMEC, SE, "Invalid schema object for drop" },
444  { 790, HA_WRONG_CREATE_OPTION, SE, "Invalid hashmap" },
445  { 793, DMEC, AE, "Object definition too big" },
446  { 241, HA_ERR_TABLE_DEF_CHANGED, SE, "Invalid schema object version" },
447  { 283, HA_ERR_NO_SUCH_TABLE, SE, "Table is being dropped" },
448  { 284, HA_ERR_TABLE_DEF_CHANGED, SE, "Table not defined in transaction coordinator" },
449  { 285, DMEC, SE, "Unknown table error in transaction coordinator" },
450  { 881, DMEC, SE, "Unable to create table, out of data pages (increase DataMemory) " },
451  { 906, DMEC, SE, "Unsupported attribute type in index" },
452  { 907, DMEC, SE, "Unsupported character set in table or index" },
453  { 908, DMEC, IS, "Invalid ordered index tree node size" },
454  { 909, DMEC, IE, "No free index scan op" },
455  { 910, HA_ERR_NO_SUCH_TABLE, SE, "Index is being dropped" },
456  { 913, DMEC, AE, "Invalid index for index state update" },
457  { 914, DMEC, IE, "Invalid index stats request" },
458  { 915, DMEC, TR, "No free index stats op" },
459  { 916, DMEC, IE, "Invalid index stats sys tables" },
460  { 917, DMEC, IE, "Invalid index stats sys tables data" },
461  { 918, DMEC, TR, "Cannot prepare index stats update" },
462  { 919, DMEC, TR, "Cannot execute index stats update" },
463  { 1224, HA_WRONG_CREATE_OPTION, SE, "Too many fragments" },
464  { 1225, DMEC, SE, "Table not defined in local query handler" },
465  { 1226, DMEC, SE, "Table is being dropped" },
466  { 1227, HA_WRONG_CREATE_OPTION, SE, "Invalid schema version" },
467  { 1228, DMEC, SE, "Cannot use drop table for drop index" },
468  { 1229, DMEC, SE, "Too long frm data supplied" },
469  { 1231, DMEC, SE, "Invalid table or index to scan" },
470  { 1232, DMEC, SE, "Invalid table or index to scan" },
471 
472  { 1502, DMEC, IE, "Filegroup already exists" },
473  { 1503, DMEC, SE, "Out of filegroup records" },
474  { 1504, DMEC, SE, "Out of logbuffer memory" },
475  { 1505, DMEC, IE, "Invalid filegroup" },
476  { 1506, DMEC, IE, "Invalid filegroup version" },
477  { 1507, DMEC, IE, "File no already inuse" },
478  { 1508, DMEC, SE, "Out of file records" },
479  { 1509, DMEC, SE, "File system error, check if path,permissions etc" },
480  { 1510, DMEC, IE, "File meta data error" },
481  { 1511, DMEC, IE, "Out of memory" },
482  { 1512, DMEC, SE, "File read error" },
483  { 1513, DMEC, IE, "Filegroup not online" },
484  { 1514, DMEC, SE, "Currently there is a limit of one logfile group" },
485  { 1515, DMEC, SE, "Currently there is a 4G limit of one undo/data-file in 32-bit host" },
486  { 1516, DMEC, SE, "File too small" },
487 
488  { 773, DMEC, SE, "Out of string memory, please modify StringMemory config parameter" },
489  { 775, DMEC, SE, "Create file is not supported when Diskless=1" },
490  { 776, DMEC, AE, "Index created on temporary table must itself be temporary" },
491  { 777, DMEC, AE, "Cannot create a temporary index on a non-temporary table" },
492  { 778, DMEC, AE, "A temporary table or index must be specified as not logging" },
493  { 786, DMEC, NR, "Schema transaction aborted due to node-failure" },
494  { 792, DMEC, SE, "Default value for primary key column not supported" },
495  { 794, DMEC, AE, "Schema feature requires data node upgrade" },
496 
500  { 4003, DMEC, NI, "Function not implemented yet" },
501 
506  { 1300, DMEC, IE, "Undefined error" },
507  { 1301, DMEC, IE, "Backup issued to not master (reissue command to master)" },
508  { 1302, DMEC, AE, "A backup is already running" },
509  { 1303, DMEC, IS, "Out of resources" },
510  { 1304, DMEC, IE, "Sequence failure" },
511  { 1305, DMEC, IE, "Backup definition not implemented" },
512  { 1306, DMEC, AE, "Backup not supported in diskless mode (change Diskless)" },
513 
514  { 1321, DMEC, UD, "Backup aborted by user request" },
515  { 1322, DMEC, IE, "Backup already completed" },
516  { 1323, DMEC, IE, "1323" },
517  { 1324, DMEC, IE, "Backup log buffer full" },
518  { 1325, DMEC, IE, "File or scan error" },
519  { 1326, DMEC, IE, "Backup abortet due to node failure" },
520  { 1327, DMEC, IE, "1327" },
521 
522  { 1340, DMEC, IE, "Backup undefined error" },
523  { 1342, DMEC, AE, "Backup failed to allocate buffers (check configuration)" },
524  { 1343, DMEC, AE, "Backup failed to setup fs buffers (check configuration)" },
525  { 1344, DMEC, AE, "Backup failed to allocate tables (check configuration)" },
526  { 1345, DMEC, AE, "Backup failed to insert file header (check configuration)" },
527  { 1346, DMEC, AE, "Backup failed to insert table list (check configuration)" },
528  { 1347, DMEC, AE, "Backup failed to allocate table memory (check configuration)" },
529  { 1348, DMEC, AE, "Backup failed to allocate file record (check configuration)" },
530  { 1349, DMEC, AE, "Backup failed to allocate attribute record (check configuration)" },
531  { 1350, DMEC, TR, "Backup failed: file already exists (use 'START BACKUP <backup id>')" },
532  { 1329, DMEC, AE, "Backup during software upgrade not supported" },
533 
538  { 1700, DMEC, IE, "Undefined error" },
539  { 1701, DMEC, AE, "Node already reserved" },
540  { 1702, DMEC, AE, "Node already connected" },
541  { 1703, DMEC, IT, "Node failure handling not completed" },
542  { 1704, DMEC, AE, "Node type mismatch" },
543 
544  /*
545  * Index stats error codes
546  */
547  { 4714, DMEC, AE, "Index stats sys tables " NDB_INDEX_STAT_PREFIX " do not exist" },
548  { 4715, DMEC, AE, "Index stats for specified index do not exist" },
549  { 4716, DMEC, AE, "Index stats methods usage error" },
550  { 4717, DMEC, AE, "Index stats cannot allocate memory" },
551  { 4718, DMEC, IE, "Index stats samples data or memory cache is invalid" },
552  { 4719, DMEC, IE, "Index stats internal error" },
553  { 4720, DMEC, AE, "Index stats sys tables " NDB_INDEX_STAT_PREFIX " partly missing or invalid" },
554 
558  { 720, DMEC, AE, "Attribute name reused in table definition" },
559  { 1405, DMEC, NR, "Subscriber manager busy with node recovery" },
560  { 1407, DMEC, SE, "Subscription not found in subscriber manager" },
561  { 1411, DMEC, TR, "Subscriber manager busy with adding/removing a subscriber" },
562  { 1412, DMEC, IS, "Can't accept more subscribers, out of space in pool" },
563  { 1413, DMEC, TR, "Subscriber manager busy with adding the subscription" },
564  { 1414, DMEC, TR, "Subscriber manager has subscribers on this subscription" },
565  { 1415, DMEC, SE, "Subscription not unique in subscriber manager" },
566  { 1416, DMEC, IS, "Can't accept more subscriptions, out of space in pool" },
567  { 1417, DMEC, SE, "Table in suscription not defined, probably dropped" },
568  { 1418, DMEC, SE, "Subscription dropped, no new subscribers allowed" },
569  { 1419, DMEC, SE, "Subscription already dropped" },
570 
571  { 1420, DMEC, TR, "Subscriber manager busy with adding/removing a table" },
572  { 1421, DMEC, SE, "Partially connected API in NdbOperation::execute()" },
573  { 1422, DMEC, SE, "Out of subscription records" },
574  { 1423, DMEC, SE, "Out of table records in SUMA" },
575  { 1424, DMEC, SE, "Out of MaxNoOfConcurrentSubOperations" },
576  { 1425, DMEC, SE, "Subscription being defined...while trying to stop subscriber" },
577  { 1426, DMEC, SE, "No such subscriber" },
578  { 1427, DMEC, NR, "Api node died, when SUB_START_REQ reached node "},
579  { 1428, DMEC, IE, "No replica to scan on this node (internal index stats error)" },
580 
581  { 4004, DMEC, AE, "Attribute name or id not found in the table" },
582 
583  { 4100, DMEC, AE, "Status Error in NDB" },
584  { 4101, DMEC, AE, "No connections to NDB available and connect failed" },
585  { 4102, DMEC, AE, "Type in NdbTamper not correct" },
586  { 4103, DMEC, AE, "No schema connections to NDB available and connect failed" },
587  { 4104, DMEC, AE, "Ndb Init in wrong state, destroy Ndb object and create a new" },
588  { 4105, DMEC, AE, "Too many Ndb objects" },
589  { 4106, DMEC, AE, "All Not NULL attribute have not been defined" },
590  { 4114, DMEC, AE, "Transaction is already completed" },
591  { 4116, DMEC, AE, "Operation was not defined correctly, probably missing a key" },
592  { 4117, DMEC, AE, "Could not start transporter, configuration error"},
593  { 4118, DMEC, AE, "Parameter error in API call" },
594  { 4300, DMEC, AE, "Tuple Key Type not correct" },
595  { 4301, DMEC, AE, "Fragment Type not correct" },
596  { 4302, DMEC, AE, "Minimum Load Factor not correct" },
597  { 4303, DMEC, AE, "Maximum Load Factor not correct" },
598  { 4304, DMEC, AE, "Maximum Load Factor smaller than Minimum" },
599  { 4305, DMEC, AE, "K value must currently be set to 6" },
600  { 4306, DMEC, AE, "Memory Type not correct" },
601  { 4307, DMEC, AE, "Invalid table name" },
602  { 4308, DMEC, AE, "Attribute Size not correct" },
603  { 4309, DMEC, AE, "Fixed array too large, maximum 64000 bytes" },
604  { 4310, DMEC, AE, "Attribute Type not correct" },
605  { 4311, DMEC, AE, "Storage Mode not correct" },
606  { 4312, DMEC, AE, "Null Attribute Type not correct" },
607  { 4313, DMEC, AE, "Index only storage for non-key attribute" },
608  { 4314, DMEC, AE, "Storage Type of attribute not correct" },
609  { 4315, DMEC, AE, "No more key attributes allowed after defining variable length key attribute" },
610  { 4316, DMEC, AE, "Key attributes are not allowed to be NULL attributes" },
611  { 4317, DMEC, AE, "Too many primary keys defined in table" },
612  { 4318, DMEC, AE, "Invalid attribute name or number" },
613  { 4319, DMEC, AE, "createAttribute called at erroneus place" },
614  { 4322, DMEC, AE, "Attempt to define distribution key when not prepared to" },
615  { 4323, DMEC, AE, "Distribution Key set on table but not defined on first attribute" },
616  { 4324, DMEC, AE, "Attempt to define distribution group when not prepared to" },
617  { 4325, DMEC, AE, "Distribution Group set on table but not defined on first attribute" },
618  { 4326, DMEC, AE, "Distribution Group with erroneus number of bits" },
619  { 4327, DMEC, AE, "Distribution key is only supported on part of primary key" },
620  { 4328, DMEC, AE, "Disk memory attributes not yet supported" },
621  { 4329, DMEC, AE, "Variable stored attributes not yet supported" },
622  { 4340, DMEC, AE, "Result or attribute record must be a base table ndbrecord, not an index ndbrecord" },
623 
624  { 4400, DMEC, AE, "Status Error in NdbSchemaCon" },
625  { 4401, DMEC, AE, "Only one schema operation per schema transaction" },
626  { 4402, DMEC, AE, "No schema operation defined before calling execute" },
627  { 4410, DMEC, AE, "Schema transaction is already started" },
628  { 4411, DMEC, AE, "Schema transaction not possible until upgrade complete" },
629 
630  { 4501, DMEC, AE, "Insert in hash table failed when getting table information from Ndb" },
631  { 4502, DMEC, AE, "GetValue not allowed in Update operation" },
632  { 4503, DMEC, AE, "GetValue not allowed in Insert operation" },
633  { 4504, DMEC, AE, "SetValue not allowed in Read operation" },
634  { 4505, DMEC, AE, "NULL value not allowed in primary key search" },
635  { 4506, DMEC, AE, "Missing getValue/setValue when calling execute" },
636  { 4507, DMEC, AE, "Missing operation request when calling execute" },
637  { 4508, DMEC, AE, "GetValue not allowed for NdbRecord defined operation" },
638  { 4509, DMEC, AE, "Non SF_MultiRange scan cannot have more than one bound" },
639  { 4510, DMEC, AE, "User specified partition id not allowed for scan takeover operation" },
640  { 4511, DMEC, AE, "Blobs not allowed in NdbRecord delete result record" },
641  { 4512, DMEC, AE, "Incorrect combination of OperationOptions optionsPresent, extraGet/SetValues ptr and numExtraGet/SetValues" },
642  { 4513, DMEC, AE, "Only one scan bound allowed for non-NdbRecord setBound() API" },
643  { 4514, DMEC, AE, "Can only call setBound/equal() for an NdbIndexScanOperation" },
644  { 4515, DMEC, AE, "Method not allowed for NdbRecord, use OperationOptions or ScanOptions structure instead" },
645  { 4516, DMEC, AE, "Illegal instruction in interpreted program" },
646  { 4517, DMEC, AE, "Bad label in branch instruction" },
647  { 4518, DMEC, AE, "Too many instructions in interpreted program" },
648  { 4519, DMEC, AE, "NdbInterpretedCode::finalise() not called" },
649  { 4520, DMEC, AE, "Call to undefined subroutine" },
650  { 4521, DMEC, AE, "Call to undefined subroutine, internal error" },
651  { 4522, DMEC, AE, "setBound() called twice for same key" },
652  { 4523, DMEC, AE, "Pseudo columns not supported by NdbRecord" },
653  { 4524, DMEC, AE, "NdbInterpretedCode is for different table" },
654  { 4535, DMEC, AE, "Attempt to set bound on non key column" },
655  { 4536, DMEC, AE, "NdbScanFilter constructor taking NdbOperation is not supported for NdbRecord" },
656  { 4537, DMEC, AE, "Wrong API. Use NdbInterpretedCode for NdbRecord operations" },
657  { 4538, DMEC, AE, "NdbInterpretedCode instruction requires that table is set" },
658  { 4539, DMEC, AE, "NdbInterpretedCode not supported for operation type" },
659  { 4540, DMEC, AE, "Attempt to pass an Index column to createRecord. Use base table columns only" },
660  /* 4541 No longer generated */
661  { 4542, DMEC, AE, "Unknown partition information type" },
662  { 4543, DMEC, AE, "Duplicate partitioning information supplied" },
663  { 4544, DMEC, AE, "Wrong partitionInfo type for table" },
664  { 4545, DMEC, AE, "Invalid or Unsupported PartitionInfo structure" },
665  { 4546, DMEC, AE, "Explicit partitioning info not allowed for table and operation" },
666  { 4547, DMEC, AE, "RecordSpecification has overlapping offsets" },
667  { 4548, DMEC, AE, "RecordSpecification has too many elements" },
668  { 4549, DMEC, AE, "getLockHandle only supported for primary key read with a lock" },
669  { 4550, DMEC, AE, "Cannot releaseLockHandle until operation executed" },
670  { 4551, DMEC, AE, "NdbLockHandle already released" },
671  { 4552, DMEC, AE, "NdbLockHandle does not belong to transaction" },
672  { 4553, DMEC, AE, "NdbLockHandle original operation not executed successfully" },
673  { 4554, DMEC, AE, "NdbBlob can only be closed from Active state" },
674  { 4555, DMEC, AE, "NdbBlob cannot be closed with pending operations" },
675 
676  { 4200, DMEC, AE, "Status Error when defining an operation" },
677  { 4201, DMEC, AE, "Variable Arrays not yet supported" },
678  { 4202, DMEC, AE, "Set value on tuple key attribute is not allowed" },
679  { 4203, DMEC, AE, "Trying to set a NOT NULL attribute to NULL" },
680  { 4204, DMEC, AE, "Set value and Read/Delete Tuple is incompatible" },
681  { 4205, DMEC, AE, "No Key attribute used to define tuple" },
682  { 4206, DMEC, AE, "Not allowed to equal key attribute twice" },
683  { 4207, DMEC, AE, "Key size is limited to 4092 bytes" },
684  { 4208, DMEC, AE, "Trying to read a non-stored attribute" },
685  { 4209, DMEC, AE, "Length parameter in equal/setValue is incorrect" },
686  { 4210, DMEC, AE, "Ndb sent more info than the length he specified" },
687  { 4211, DMEC, AE, "Inconsistency in list of NdbRecAttr-objects" },
688  { 4212, DMEC, AE, "Ndb reports NULL value on Not NULL attribute" },
689  { 4213, DMEC, AE, "Not all data of an attribute has been received" },
690  { 4214, DMEC, AE, "Not all attributes have been received" },
691  { 4215, DMEC, AE, "More data received than reported in TCKEYCONF message" },
692  { 4216, DMEC, AE, "More than 8052 bytes in setValue cannot be handled" },
693  { 4217, DMEC, AE, "It is not allowed to increment any other than unsigned ints" },
694  { 4218, DMEC, AE, "Currently not allowed to increment NULL-able attributes" },
695  { 4219, DMEC, AE, "Maximum size of interpretative attributes are 64 bits" },
696  { 4220, DMEC, AE, "Maximum size of interpretative attributes are 64 bits" },
697  { 4221, DMEC, AE, "Trying to jump to a non-defined label" },
698  { 4222, DMEC, AE, "Label was not found, internal error" },
699  { 4223, DMEC, AE, "Not allowed to create jumps to yourself" },
700  { 4224, DMEC, AE, "Not allowed to jump to a label in a different subroutine" },
701  { 4225, DMEC, AE, "All primary keys defined, call setValue/getValue"},
702  { 4226, DMEC, AE, "Bad number when defining a label" },
703  { 4227, DMEC, AE, "Bad number when defining a subroutine" },
704  { 4228, DMEC, AE, "Illegal interpreter function in scan definition" },
705  { 4229, DMEC, AE, "Illegal register in interpreter function definition" },
706  { 4230, DMEC, AE, "Illegal state when calling getValue, probably not a read" },
707  { 4231, DMEC, AE, "Illegal state when calling interpreter routine" },
708  { 4233, DMEC, AE, "Calling execute (synchronous) when already prepared asynchronous transaction exists" },
709  { 4234, DMEC, AE, "Illegal to call setValue in this state" },
710  { 4235, DMEC, AE, "No callback from execute" },
711  { 4236, DMEC, AE, "Trigger name too long" },
712  { 4237, DMEC, AE, "Too many triggers" },
713  { 4238, DMEC, AE, "Trigger not found" },
714  { 4239, DMEC, AE, "Trigger with given name already exists"},
715  { 4240, DMEC, AE, "Unsupported trigger type"},
716  { 4241, DMEC, AE, "Index name too long" },
717  { 4242, DMEC, AE, "Too many indexes" },
718  { 4243, DMEC, AE, "Index not found" },
719  { 4244, HA_ERR_TABLE_EXIST, OE, "Index or table with given name already exists" },
720  { 4247, DMEC, AE, "Illegal index/trigger create/drop/alter request" },
721  { 4248, DMEC, AE, "Trigger/index name invalid" },
722  { 4249, DMEC, AE, "Invalid table" },
723  { 4250, DMEC, AE, "Invalid index type or index logging option" },
724  { 4251, HA_ERR_FOUND_DUPP_UNIQUE, AE, "Cannot create unique index, duplicate keys found" },
725  { 4252, DMEC, AE, "Failed to allocate space for index" },
726  { 4253, DMEC, AE, "Failed to create index table" },
727  { 4254, DMEC, AE, "Table not an index table" },
728  { 4255, DMEC, AE, "Hash index attributes must be specified in same order as table attributes" },
729  { 4258, DMEC, AE, "Cannot create unique index, duplicate attributes found in definition" },
730  { 4259, DMEC, AE, "Invalid set of range scan bounds" },
731  { 4260, DMEC, UD, "NdbScanFilter: Operator is not defined in NdbScanFilter::Group"},
732  { 4261, DMEC, UD, "NdbScanFilter: Column is NULL"},
733  { 4262, DMEC, UD, "NdbScanFilter: Condition is out of bounds"},
734  { 4263, DMEC, IE, "Invalid blob attributes or invalid blob parts table" },
735  { 4264, DMEC, AE, "Invalid usage of blob attribute" },
736  { 4265, DMEC, AE, "The method is not valid in current blob state" },
737  { 4266, DMEC, AE, "Invalid blob seek position" },
738  { 4267, DMEC, IE, "Corrupted blob value" },
739  { 4268, DMEC, IE, "Error in blob head update forced rollback of transaction" },
740  { 4269, DMEC, IE, "No connection to ndb management server" },
741  { 4270, DMEC, IE, "Unknown blob error" },
742  { 4335, DMEC, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" },
743  { 4271, DMEC, AE, "Invalid index object, not retrieved via getIndex()" },
744  { 4272, DMEC, AE, "Table definition has undefined column" },
745  { 4273, DMEC, IE, "No blob table in dict cache" },
746  { 4274, DMEC, IE, "Corrupted main table PK in blob operation" },
747  { 4275, DMEC, AE, "The blob method is incompatible with operation type or lock mode" },
748  { 4276, DMEC, AE, "Missing NULL ptr in end of keyData list" },
749  { 4277, DMEC, AE, "Key part len is to small for column" },
750  { 4278, DMEC, AE, "Supplied buffer to small" },
751  { 4279, DMEC, AE, "Malformed string" },
752  { 4280, DMEC, AE, "Inconsistent key part length" },
753  { 4281, DMEC, AE, "Too many keys specified for key bound in scanIndex" },
754  { 4282, DMEC, AE, "range_no not strictly increasing in ordered multi-range index scan" },
755  { 4283, DMEC, AE, "key_record in index scan is not an index ndbrecord" },
756  { 4284, DMEC, AE, "Cannot mix NdbRecAttr and NdbRecord methods in one operation" },
757  { 4285, DMEC, AE, "NULL NdbRecord pointer" },
758  { 4286, DMEC, AE, "Invalid range_no (must be < 4096)" },
759  { 4287, DMEC, AE, "The key_record and attribute_record in primary key operation do not belong to the same table" },
760  { 4288, DMEC, AE, "Blob handle for column not available" },
761  { 4289, DMEC, AE, "API version mismatch or wrong sizeof(NdbDictionary::RecordSpecification)" },
762  { 4290, DMEC, AE, "Missing column specification in NdbDictionary::RecordSpecification" },
763  { 4291, DMEC, AE, "Duplicate column specification in NdbDictionary::RecordSpecification" },
764  { 4292, DMEC, AE, "NdbRecord for tuple access is not an index key NdbRecord" },
765  { 4341, DMEC, AE, "Not all keys read when using option SF_OrderBy" },
766  { 4293, DMEC, AE, "Error returned from application scanIndex() callback" },
767  { 4294, DMEC, AE, "Scan filter is too large, discarded" },
768  { 4295, DMEC, AE, "Column is NULL in Get/SetValueSpec structure" },
769  { 4296, DMEC, AE, "Invalid AbortOption" },
770  { 4297, DMEC, AE, "Invalid or unsupported OperationOptions structure" },
771  { 4298, DMEC, AE, "Invalid or unsupported ScanOptions structure" },
772  { 4299, DMEC, AE, "Incorrect combination of ScanOption flags, extraGetValues ptr and numExtraGetValues" },
773  { 2810, DMEC, TR, "No space left on the device" },
774  { 2811, DMEC, TR, "Error with file permissions, please check file system" },
775  { 2815, DMEC, TR, "Error in reading files, please check file system" },
776  { 920, DMEC, AE, "Row operation defined after refreshTuple()" },
777 
781  { QRY_REQ_ARG_IS_NULL, DMEC, AE,
782  "Required argument is NULL" },
783  { QRY_TOO_FEW_KEY_VALUES, DMEC, AE,
784  "All required 'key' values was not specified" },
785  { QRY_TOO_MANY_KEY_VALUES, DMEC, AE,
786  "Too many 'key' or 'bound' values was specified" },
787  { QRY_OPERAND_HAS_WRONG_TYPE, DMEC, AE,
788  "Incompatible datatype specified in operand argument" },
789  { QRY_CHAR_OPERAND_TRUNCATED, DMEC, AE,
790  "Character operand was right truncated" },
791  { QRY_NUM_OPERAND_RANGE, DMEC, AE,
792  "Numeric operand out of range" },
793  { QRY_MULTIPLE_PARENTS, DMEC, AE,
794  "Multiple 'parents' specified in linkedValues for this operation" },
795  { QRY_UNKONWN_PARENT, DMEC, AE,
796  "Unknown 'parent' specified in linkedValue" },
797  { QRY_UNKNOWN_COLUMN, DMEC, AE,
798  "Unknown 'column' specified in linkedValue" },
799  { QRY_UNRELATED_INDEX, DMEC, AE,
800  "Specified 'index' does not belong to specified 'table'" },
801  { QRY_WRONG_INDEX_TYPE, DMEC, AE,
802  "Wrong type of index specified for this operation"},
803  { QRY_OPERAND_ALREADY_BOUND, DMEC, AE,
804  "Can't use same operand value to specify different column values" },
805  { QRY_DEFINITION_TOO_LARGE, DMEC, AE,
806  "Query definition too large." },
807  { QRY_RESULT_ROW_ALREADY_DEFINED, DMEC, AE,
808  "Result row already defined for NdbQueryOperation."},
809  { QRY_HAS_ZERO_OPERATIONS, DMEC, AE,
810  "Query defintion should have at least one operation."},
811  { QRY_IN_ERROR_STATE, DMEC, AE,
812  "A previous query operation failed, which you missed to catch."},
813  { QRY_ILLEGAL_STATE, DMEC, AE,
814  "Query is in illegal state for this operation."},
815  { QRY_WRONG_OPERATION_TYPE, DMEC, AE,
816  "This method cannot be invoked on this type of operation (lookup/scan/"
817  "index scan)."},
818  { QRY_SCAN_ORDER_ALREADY_SET, DMEC, AE,
819  "Index scan order was already set in query definition."},
820  { QRY_PARAMETER_HAS_WRONG_TYPE, DMEC, AE,
821  "Parameter value has an incompatible datatype" },
822  { QRY_CHAR_PARAMETER_TRUNCATED, DMEC, AE,
823  "Character Parameter was right truncated" },
824  { QRY_MULTIPLE_SCAN_SORTED, DMEC, AE,
825  "Query with multiple scans may not be sorted." },
826  { QRY_SEQUENTIAL_SCAN_SORTED, DMEC, AE,
827  "Parallelism cannot be restricted for sorted scans." },
828  { QRY_BATCH_SIZE_TOO_SMALL, DMEC, AE,
829  "Batch size for sub scan cannot be smaller than number of fragments." },
830 
831  { NO_CONTACT_WITH_PROCESS, DMEC, AE,
832  "No contact with the process (dead ?)."},
833  { WRONG_PROCESS_TYPE, DMEC, AE,
834  "The process has wrong type. Expected a DB process."},
835  { SEND_OR_RECEIVE_FAILED, DMEC, AE,
836  "Send to process or receive failed."},
837  { INVALID_ERROR_NUMBER, DMEC, AE,
838  "Invalid error number. Should be >= 0."},
839  { INVALID_TRACE_NUMBER, DMEC, AE,
840  "Invalid trace number."},
841  { INVALID_BLOCK_NAME, DMEC, AE,
842  "Invalid block name"},
843  { NODE_SHUTDOWN_IN_PROGESS, DMEC, AE,
844  "Node shutdown in progress" },
845  { SYSTEM_SHUTDOWN_IN_PROGRESS, DMEC, AE,
846  "System shutdown in progress" },
847  { NODE_SHUTDOWN_WOULD_CAUSE_SYSTEM_CRASH, DMEC, AE,
848  "Node shutdown would cause system crash" },
849  { UNSUPPORTED_NODE_SHUTDOWN, DMEC, AE,
850  "Unsupported multi node shutdown. Abort option required." },
851  { NODE_NOT_API_NODE, DMEC, AE,
852  "The specified node is not an API node." },
853  { OPERATION_NOT_ALLOWED_START_STOP, DMEC, AE,
854  "Operation not allowed while nodes are starting or stopping."},
855  { NO_CONTACT_WITH_DB_NODES, DMEC, AE,
856  "No contact with database nodes" }
857 };
858 
859 static
860 const
861 int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle);
862 
863 typedef struct ErrorStatusMessage {
864  ndberror_status status;
865  const char * message;
867 
869  ndberror_status status;
870  ndberror_classification classification;
871  const char * message;
873 
877 static
878 const
879 ErrorStatusMessage StatusMessageMapping[] = {
880  { ST_S, "Success"},
881  { ST_P, "Permanent error"},
882  { ST_T, "Temporary error"},
883  { ST_U ,"Unknown result"}
884 };
885 
886 static
887 const
888 int NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage);
889 
890 static
891 const
892 ErrorStatusClassification StatusClassificationMapping[] = {
893  { ST_S, NE, "No error"},
894  { ST_P, AE, "Application error"},
895  { ST_P, CE, "Configuration or application error"},
896  { ST_P, ND, "No data found"},
897  { ST_P, CV, "Constraint violation"},
898  { ST_P, SE, "Schema error"},
899  { ST_P, UD, "User defined error"},
900  { ST_P, IS, "Insufficient space"},
901 
902  { ST_T, TR, "Temporary Resource error"},
903  { ST_T, NR, "Node Recovery error"},
904  { ST_T, OL, "Overload error"},
905  { ST_T, TO, "Timeout expired"},
906  { ST_T, NS, "Node shutdown"},
907  { ST_T, IT, "Internal temporary"},
908 
909  { ST_U , UR, "Unknown result error"},
910  { ST_U , UE, "Unknown error code"},
911 
912  { ST_P, IE, "Internal error"},
913  { ST_P, NI, "Function not implemented"}
914 };
915 
916 static
917 const
918 int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification);
919 
920 
921 void
922 ndberror_update(ndberror_struct * error){
923 
924  int found = 0;
925  int i;
926 
927  for(i = 0; i<NbErrorCodes; i++){
928  if(ErrorCodes[i].code == error->code){
929  error->classification = ErrorCodes[i].classification;
930  error->message = ErrorCodes[i].message;
931  error->mysql_code = ErrorCodes[i].mysql_code;
932  found = 1;
933  break;
934  }
935  }
936 
937  if(!found){
938  error->classification = UE;
939  error->message = "Unknown error code";
940  error->mysql_code = DMEC;
941  }
942 
943  found = 0;
944  for(i = 0; i<NbClassification; i++){
945  if(StatusClassificationMapping[i].classification == error->classification){
946  error->status = StatusClassificationMapping[i].status;
947  found = 1;
948  break;
949  }
950  }
951  if(!found){
952  error->status = ST_U;
953  }
954 }
955 
956 
957 const char *ndberror_status_message(ndberror_status status)
958 {
959  int i;
960  for (i= 0; i < NbStatus; i++)
961  if (StatusMessageMapping[i].status == status)
962  return StatusMessageMapping[i].message;
963  return empty_string;
964 }
965 
966 const char *ndberror_classification_message(ndberror_classification classification)
967 {
968  int i;
969  for (i= 0; i < NbClassification; i++)
970  if (StatusClassificationMapping[i].classification == classification)
971  return StatusClassificationMapping[i].message;
972  return empty_string;
973 }
974 
975 int ndb_error_string(int err_no, char *str, int size)
976 {
977  ndberror_struct error;
978  int len;
979 
980  assert(size > 1);
981  if(size <= 1)
982  return 0;
983  error.code = err_no;
984  ndberror_update(&error);
985 
986  len =
987  my_snprintf(str, size-1, "%s: %s: %s", error.message,
988  ndberror_status_message(error.status),
989  ndberror_classification_message(error.classification));
990  str[size-1]= '\0';
991 
992  if (error.classification != UE)
993  return len;
994  return -len;
995 }