Below is the list of changes that have just been committed into a local
4.1 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-01-25 12:04:59-05:00, cmiller@stripped +4 -0
Bug#25177: New error codes without error message
Someone violated the programming rule "Don't repeat yourself" when
writing the perror program, so one site fell terribly out of synch
with the other site.
This unifies them, generating a header from the canonical source.
extra/Makefile.am@stripped, 2007-01-25 12:04:58-05:00, cmiller@stripped +11 -0
Create or update a new header for the perror program. The header
contains the canonical list of HA error codes, so that it is never
out of synch with the server.
extra/perror.c@stripped, 2007-01-25 12:04:58-05:00, cmiller@stripped +11 -38
Read the HA errors from the generated header file.
extra/perror_ha.h@stripped, 2007-01-25 12:04:58-05:00, cmiller@stripped +42 -0
Include the header so that 'sed' isn't required to build.
extra/perror_ha.h@stripped, 2007-01-25 12:04:58-05:00, cmiller@stripped +0 -0
include/my_base.h@stripped, 2007-01-25 12:04:58-05:00, cmiller@stripped +42 -36
Update comments wording and spelling, and make a special format in
the comment that is read and used to generate a header file for
the perror program.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: cmiller
# Host: zippy.cornsilk.net
# Root: /home/cmiller/work/mysql/bug10143/my41-bug10143
--- 1.18/extra/Makefile.am 2007-01-25 12:05:02 -05:00
+++ 1.19/extra/Makefile.am 2007-01-25 12:05:02 -05:00
@@ -24,3 +24,14 @@ bin_PROGRAMS = replace comp_err perror
# Don't update the files from bitkeeper
%::SCCS/s.%
+
+perror.c: perror_ha.h
+
+perror_ha.h: ../include/my_base.h
+ @ECHO@ "/* DO N""OT ED""IT. This file is aut""omatic""ally generated from special comments in $< */" > $@
+ @ECHO@ "#include \"$<\"" >> $@
+ @ECHO@ "typedef struct ha_errors { int errcode; const char *msg; } HA_ERRORS;" >> $@
+ @ECHO@ "static HA_ERRORS ha_errlist_server[]= { " >> $@
+ @SED@ -n -e's!#define\s\(\w\w*\)\s*[0-9]*\s*/\*\s*\("[^"]*"\)\s*\*/! { \1, \2 },!p; t' < $< >> $@
+ @ECHO@ " { 0,NullS }," >> $@
+ @ECHO@ "};" >> $@
--- 1.39/extra/perror.c 2007-01-25 12:05:02 -05:00
+++ 1.40/extra/perror.c 2007-01-25 12:05:02 -05:00
@@ -27,6 +27,8 @@
#include "../ndb/src/ndbapi/ndberror.c"
#endif
+#include "perror_ha.h"
+
static my_bool verbose, print_all_codes;
#ifdef HAVE_NDBCLUSTER_DB
@@ -59,44 +61,9 @@ static struct my_option my_long_options[
};
-typedef struct ha_errors {
- int errcode;
- const char *msg;
-} HA_ERRORS;
-
-static HA_ERRORS ha_errlist[]=
+static HA_ERRORS ha_errlist_extras[]=
{
- { 120,"Didn't find key on read or update" },
- { 121,"Duplicate key on write or update" },
- { 123,"Someone has changed the row since it was read (while the table was locked to prevent it)" },
- { 124,"Wrong index given to function" },
- { 126,"Index file is crashed" },
- { 127,"Record-file is crashed" },
- { 128,"Out of memory" },
- { 130,"Incorrect file format" },
- { 131,"Command not supported by database" },
- { 132,"Old database file" },
- { 133,"No record read before update" },
- { 134,"Record was already deleted (or record file crashed)" },
- { 135,"No more room in record file" },
- { 136,"No more room in index file" },
- { 137,"No more records (read after end of file)" },
- { 138,"Unsupported extension used for table" },
- { 139,"Too big row"},
- { 140,"Wrong create options"},
- { 141,"Duplicate unique key or constraint on write or update"},
- { 142,"Unknown character set used"},
- { 143,"Conflicting table definitions in sub-tables of MERGE table"},
- { 144,"Table is crashed and last repair failed"},
- { 145,"Table was marked as crashed and should be repaired"},
- { 146,"Lock timed out; Retry transaction"},
- { 147,"Lock table is full; Restart program with a larger locktable"},
- { 148,"Updates are not allowed under a read only transactions"},
- { 149,"Lock deadlock; Retry transaction"},
- { 150,"Foreign key constraint is incorrectly formed"},
- { 151,"Cannot add a child row"},
- { 152,"Cannot delete a parent row"},
{ -30999, "DB_INCOMPLETE: Sync didn't finish"},
{ -30998, "DB_KEYEMPTY: Key/data deleted or never created"},
{ -30997, "DB_KEYEXIST: The key/data pair already exists"},
@@ -178,7 +145,11 @@ static const char *get_ha_error_msg(int
{
HA_ERRORS *ha_err_ptr;
- for (ha_err_ptr=ha_errlist ; ha_err_ptr->errcode ;ha_err_ptr++)
+ for (ha_err_ptr=ha_errlist_server ; ha_err_ptr->errcode ;ha_err_ptr++)
+ if (ha_err_ptr->errcode == code)
+ return ha_err_ptr->msg;
+
+ for (ha_err_ptr=ha_errlist_extras ; ha_err_ptr->errcode ;ha_err_ptr++)
if (ha_err_ptr->errcode == code)
return ha_err_ptr->msg;
return NullS;
@@ -207,7 +178,9 @@ int main(int argc,char *argv[])
printf("%3d = %s\n",code,sys_errlist[code]);
}
}
- for (ha_err_ptr=ha_errlist ; ha_err_ptr->errcode ;ha_err_ptr++)
+ for (ha_err_ptr=ha_errlist_server ; ha_err_ptr->errcode ;ha_err_ptr++)
+ printf("%3d = %s\n",ha_err_ptr->errcode,ha_err_ptr->msg);
+ for (ha_err_ptr=ha_errlist_extras ; ha_err_ptr->errcode ;ha_err_ptr++)
printf("%3d = %s\n",ha_err_ptr->errcode,ha_err_ptr->msg);
}
else
--- 1.66/include/my_base.h 2007-01-25 12:05:02 -05:00
+++ 1.67/include/my_base.h 2007-01-25 12:05:02 -05:00
@@ -256,42 +256,48 @@ enum ha_base_keytype {
/* Errorcodes given by functions */
/* opt_sum_query() assumes these codes are > 1 */
-#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
-#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
-#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
-#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
-#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
-#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
-#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */
-#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */
-#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
-#define HA_ERR_OLD_FILE 132 /* old databasfile */
-#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
-#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */
-#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */
-#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */
-#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */
-#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */
-#define HA_ERR_TO_BIG_ROW 139 /* Too big row */
-#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
-#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
-#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
-#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */
-#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
-#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
-#define HA_ERR_LOCK_WAIT_TIMEOUT 146
-#define HA_ERR_LOCK_TABLE_FULL 147
-#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */
-#define HA_ERR_LOCK_DEADLOCK 149
-#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */
-#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */
-#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */
-#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */
-#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */
-#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
-#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
-#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
-#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
+/* ATTENTION!
+ The format '#define HA_' and a number and a quoted comment
+ is parsed by sed and used to create a struct that 'perror' source uses.
+ Don't deviate from it
+*/
+#define HA_ERR_KEY_NOT_FOUND 120 /* "Didn't find key on read or update" */
+#define HA_ERR_FOUND_DUPP_KEY 121 /* "Duplicate key on write" */
+#define HA_ERR_RECORD_CHANGED 123 /* "Someone has changed the row since it was read (while the table was locked to prevent it)" */
+#define HA_ERR_WRONG_INDEX 124 /* "Wrong index given to function" */
+#define HA_ERR_CRASHED 126 /* "Index file is crashed" */
+#define HA_ERR_WRONG_IN_RECORD 127 /* "Record file is crashed" */
+#define HA_ERR_OUT_OF_MEM 128 /* "Out of memory" */
+#define HA_ERR_NOT_A_TABLE 130 /* "Incorrect file format" */
+#define HA_ERR_WRONG_COMMAND 131 /* "Command not supported by database" */
+#define HA_ERR_OLD_FILE 132 /* "Old database file" */
+#define HA_ERR_NO_ACTIVE_RECORD 133 /* "No record read before update" */
+#define HA_ERR_RECORD_DELETED 134 /* "Record was already deleted (or record file crashed)" */
+#define HA_ERR_RECORD_FILE_FULL 135 /* "No more room in record file" */
+#define HA_ERR_INDEX_FILE_FULL 136 /* "No more room in index file" */
+#define HA_ERR_END_OF_FILE 137 /* "No more records (read after end of file)" */
+#define HA_ERR_UNSUPPORTED 138 /* "Unsupported extension used for table" */
+#define HA_ERR_TO_BIG_ROW 139 /* "Too big row" */
+#define HA_WRONG_CREATE_OPTION 140 /* "Wrong create option" */
+#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* "Duplicate unique key or constraint on write or update" */
+#define HA_ERR_UNKNOWN_CHARSET 142 /* "Unknown character set used" */
+#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* "Conflicting table definitions in sub-tables of MERGE table" */
+#define HA_ERR_CRASHED_ON_REPAIR 144 /* "Table is crashed and last repair failed" */
+#define HA_ERR_CRASHED_ON_USAGE 145 /* "Table was marked as crashed and should be repaired" */
+#define HA_ERR_LOCK_WAIT_TIMEOUT 146 /* "Lock timed out; Retry transaction" */
+#define HA_ERR_LOCK_TABLE_FULL 147 /* "Lock table is full; Restart program with a larger locktable" */
+#define HA_ERR_READ_ONLY_TRANSACTION 148 /* "Updates are not allowed under read only transactions" */
+#define HA_ERR_LOCK_DEADLOCK 149 /* "Lock deadlock; Retry transaction" */
+#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* "Foreign key constraint is incorrectly formed" */
+#define HA_ERR_NO_REFERENCED_ROW 151 /* "Cannot add a child row" */
+#define HA_ERR_ROW_IS_REFERENCED 152 /* "Cannot delete a parent row" */
+#define HA_ERR_NO_SAVEPOINT 153 /* "No savepoint with that name" */
+#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* "Non unique key block size" */
+#define HA_ERR_NO_SUCH_TABLE 155 /* "The table does not exist in engine" */
+#define HA_ERR_TABLE_EXIST 156 /* "The table existed in storage engine" */
+#define HA_ERR_NO_CONNECTION 157 /* "Could not connect to storage engine" */
+#define HA_ERR_NULL_IN_SPATIAL 158 /* "NULLs are not supported in spatial index" */
+/* If you create a new line, put in quotes the description you want to be read by 'perror' */
/* Other constants */
--- New file ---
+++ extra/perror_ha.h 07/01/25 12:04:58
/* DO NOT EDIT. This file is automatically generated from special comments in ../include/my_base.h */
#include "../include/my_base.h"
typedef struct ha_errors { int errcode; const char *msg; } HA_ERRORS;
static HA_ERRORS ha_errlist_server[]= {
{ HA_ERR_KEY_NOT_FOUND, "Didn't find key on read or update" },
{ HA_ERR_FOUND_DUPP_KEY, "Duplicate key on write" },
{ HA_ERR_RECORD_CHANGED, "Someone has changed the row since it was read (while the table was locked to prevent it)" },
{ HA_ERR_WRONG_INDEX, "Wrong index given to function" },
{ HA_ERR_CRASHED, "Index file is crashed" },
{ HA_ERR_WRONG_IN_RECORD, "Record file is crashed" },
{ HA_ERR_OUT_OF_MEM, "Out of memory" },
{ HA_ERR_NOT_A_TABLE, "Incorrect file format" },
{ HA_ERR_WRONG_COMMAND, "Command not supported by database" },
{ HA_ERR_OLD_FILE, "Old database file" },
{ HA_ERR_NO_ACTIVE_RECORD, "No record read before update" },
{ HA_ERR_RECORD_DELETED, "Record was already deleted (or record file crashed)" },
{ HA_ERR_RECORD_FILE_FULL, "No more room in record file" },
{ HA_ERR_INDEX_FILE_FULL, "No more room in index file" },
{ HA_ERR_END_OF_FILE, "No more records (read after end of file)" },
{ HA_ERR_UNSUPPORTED, "Unsupported extension used for table" },
{ HA_ERR_TO_BIG_ROW, "Too big row" },
{ HA_WRONG_CREATE_OPTION, "Wrong create option" },
{ HA_ERR_FOUND_DUPP_UNIQUE, "Duplicate unique key or constraint on write or update" },
{ HA_ERR_UNKNOWN_CHARSET, "Unknown character set used" },
{ HA_ERR_WRONG_MRG_TABLE_DEF, "Conflicting table definitions in sub-tables of MERGE table" },
{ HA_ERR_CRASHED_ON_REPAIR, "Table is crashed and last repair failed" },
{ HA_ERR_CRASHED_ON_USAGE, "Table was marked as crashed and should be repaired" },
{ HA_ERR_LOCK_WAIT_TIMEOUT, "Lock timed out; Retry transaction" },
{ HA_ERR_LOCK_TABLE_FULL, "Lock table is full; Restart program with a larger locktable" },
{ HA_ERR_READ_ONLY_TRANSACTION, "Updates are not allowed under read only transactions" },
{ HA_ERR_LOCK_DEADLOCK, "Lock deadlock; Retry transaction" },
{ HA_ERR_CANNOT_ADD_FOREIGN, "Foreign key constraint is incorrectly formed" },
{ HA_ERR_NO_REFERENCED_ROW, "Cannot add a child row" },
{ HA_ERR_ROW_IS_REFERENCED, "Cannot delete a parent row" },
{ HA_ERR_NO_SAVEPOINT, "No savepoint with that name" },
{ HA_ERR_NON_UNIQUE_BLOCK_SIZE, "Non unique key block size" },
{ HA_ERR_NO_SUCH_TABLE, "The table does not exist in engine" },
{ HA_ERR_TABLE_EXIST, "The table existed in storage engine" },
{ HA_ERR_NO_CONNECTION, "Could not connect to storage engine" },
{ HA_ERR_NULL_IN_SPATIAL, "NULLs are not supported in spatial index" },
{ 0,NullS },
};
| Thread |
|---|
| • bk commit into 4.1 tree (cmiller:1.2609) BUG#25177 | Chad MILLER | 25 Jan |