Skip to content

Commit ae2768c

Browse files
author
Sergei Golubchik
committed
WL#4738 streamline/simplify @@variable creation process
Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables Bug#20415 Output of mysqld --help --verbose is incomplete Bug#25430 variable not found in SELECT @@global.ft_max_word_len; Bug#32902 plugin variables don't know their names Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting! Bug#34829 No default value for variable and setting default does not raise error Bug#34834 ? Is accepted as a valid sql mode Bug#34878 Few variables have default value according to documentation but error occurs Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var. Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status Bug#40988 log_output_basic.test succeeded though syntactically false. Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails) Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled Bug#44797 plugins w/o command-line options have no disabling option in --help Bug#46314 string system variables don't support expressions Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken Bug#46586 When using the plugin interface the type "set" for options caused a crash. Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds Bug#49417 some complaints about mysqld --help --verbose output Bug#49540 DEFAULT value of binlog_format isn't the default value Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix) Bug#49644 init_connect and \0 Bug#49645 init_slave and multi-byte characters Bug#49646 mysql --show-warnings crashes when server dies
1 parent e3976aa commit ae2768c

File tree

739 files changed

+16130
-14786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

739 files changed

+16130
-14786
lines changed

.bzrignore

+2
Original file line numberDiff line numberDiff line change
@@ -3070,3 +3070,5 @@ libmysqld/rpl_handler.cc
30703070
libmysqld/debug_sync.cc
30713071
libmysqld/rpl_handler.cc
30723072
dbug/tests
3073+
libmysqld/sys_vars.cc
3074+
libmysqld/keycaches.cc

CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ FOREACH(SUBDIR ${STORAGE_SUBDIRS})
255255
SET(ENGINE_BUILD_TYPE "NONE")
256256
ENDIF(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
257257
IF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
258-
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${ENGINE_LOWER}_plugin")
258+
IF(MYSQL_PLUGIN_MANDATORY)
259+
SET (mysql_mandatory_plugins "${mysql_mandatory_plugins}builtin_${ENGINE_LOWER}_plugin,")
260+
ELSE(MYSQL_PLUGIN_MANDATORY)
261+
SET (mysql_optional_plugins "${mysql_optional_plugins}builtin_${ENGINE_LOWER}_plugin,")
262+
ENDIF(MYSQL_PLUGIN_MANDATORY)
259263
SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${ENGINE_LOWER})
260264
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
261265
SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
@@ -274,12 +278,12 @@ ENDFOREACH(SUBDIR ${STORAGE_SUBDIRS})
274278
# Special handling for partition(not really pluggable)
275279
IF(NOT WITHOUT_PARTITION_STORAGE_ENGINE)
276280
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_PARTITION_STORAGE_ENGINE")
277-
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin")
281+
SET (mysql_optional_plugins "${mysql_optional_plugins}builtin_partition_plugin,")
278282
ENDIF(NOT WITHOUT_PARTITION_STORAGE_ENGINE)
279283

280284
ADD_DEFINITIONS(${STORAGE_ENGINE_DEFS})
281285

282-
# Now write out our mysql_plugin_defs struct
286+
# Now write out our mysql_mandatory_plugins/mysql_optional_plugins structs
283287
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
284288
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)
285289

Makefile.am

-4
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@ test-bt-debug:
204204
@PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
205205
--skip-ndbcluster --skip-rpl --report-features $(EXP)
206206

207-
test-bt-debug-fast:
208-
209-
test-bt-debug-fast:
210-
211207
# Keep these for a while
212208
test-pl: test
213209
test-full-pl: test-full

client/mysql.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extern "C" {
100100
#define vidattr(A) {} // Can't get this to work
101101
#endif
102102

103-
#ifdef FN_NO_CASE_SENCE
103+
#ifdef FN_NO_CASE_SENSE
104104
#define cmp_database(cs,A,B) my_strcasecmp((cs), (A), (B))
105105
#else
106106
#define cmp_database(cs,A,B) strcmp((A),(B))
@@ -3652,7 +3652,7 @@ static void print_warnings()
36523652
mysql_store_result_for_lazy(&result);
36533653

36543654
/* Bail out when no warnings */
3655-
if (!(num_rows= mysql_num_rows(result)))
3655+
if (!result || !(num_rows= mysql_num_rows(result)))
36563656
goto end;
36573657

36583658
cur= mysql_fetch_row(result);

client/mysqltest.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ do_result_format_version(struct st_command *command)
22272227
long version;
22282228
static DYNAMIC_STRING ds_version;
22292229
const struct command_arg result_format_args[] = {
2230-
"version", ARG_STRING, TRUE, &ds_version, "Version to use",
2230+
{"version", ARG_STRING, TRUE, &ds_version, "Version to use"}
22312231
};
22322232

22332233
DBUG_ENTER("do_result_format_version");
@@ -6154,6 +6154,8 @@ void init_win_path_patterns()
61546154
"$MYSQL_TMP_DIR",
61556155
"$MYSQLTEST_VARDIR",
61566156
"$MASTER_MYSOCK",
6157+
"$MYSQL_SHAREDIR",
6158+
"$MYSQL_LIBDIR",
61576159
"./test/" };
61586160
int num_paths= sizeof(paths)/sizeof(char*);
61596161
int i;
@@ -7102,7 +7104,7 @@ int util_query(MYSQL* org_mysql, const char* query){
71027104
cur_con->util_mysql= mysql;
71037105
}
71047106

7105-
return mysql_query(mysql, query);
7107+
DBUG_RETURN(mysql_query(mysql, query));
71067108
}
71077109

71087110

@@ -7740,6 +7742,7 @@ int main(int argc, char **argv)
77407742
cur_file->file_name= my_strdup("<stdin>", MYF(MY_WME));
77417743
cur_file->lineno= 1;
77427744
}
7745+
var_set_string("MYSQLTEST_FILE", cur_file->file_name);
77437746
init_re();
77447747
ps_protocol_enabled= ps_protocol;
77457748
sp_protocol_enabled= sp_protocol;

config/ac-macros/plugins.m4

+5-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,11 @@ dnl Although this is "pretty", it breaks libmysqld build
460460
])
461461
])
462462
])
463-
mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]"
463+
m4_ifdef([$9],[
464+
mysql_mandatory_plugins="$mysql_mandatory_plugins [builtin_]$2[_plugin],"
465+
],[
466+
mysql_optional_plugins="$mysql_optional_plugins [builtin_]$2[_plugin],"
467+
])
464468
[with_plugin_]$2=yes
465469
AC_MSG_RESULT([yes])
466470
m4_ifdef([$11],[

configure.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -2875,7 +2875,7 @@ case $SYSTEM_TYPE in
28752875
fi
28762876

28772877
# if there is no readline, but we want to build with readline, we fail
2878-
if [test "$want_to_use_readline" = "yes"] && [test ! -d "./cmd-line-utils/readline"]
2878+
if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"]
28792879
then
28802880
AC_MSG_ERROR([This commercially licensed MySQL source package can't
28812881
be built with libreadline. Please use --with-libedit to use
@@ -3015,8 +3015,8 @@ AC_SUBST(server_scripts)
30153015

30163016
AC_SUBST(mysql_plugin_dirs)
30173017
AC_SUBST(mysql_plugin_libs)
3018-
AC_SUBST(mysql_plugin_defs)
3019-
3018+
AC_SUBST(mysql_optional_plugins)
3019+
AC_SUBST(mysql_mandatory_plugins)
30203020

30213021
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
30223022
# We support client-only builds by "--without-server", but not vice versa,

include/config-netware.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extern "C" {
100100
#define USE_OLD_FUNCTIONS 1
101101

102102
/* no case sensitivity */
103-
#define FN_NO_CASE_SENCE 1
103+
#define FN_NO_CASE_SENSE 1
104104

105105
/* the thread alarm is not used */
106106
#define DONT_USE_THR_ALARM 1

include/config-win.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,8 @@ inline ulonglong double2ulonglong(double d)
318318
#define strcasecmp stricmp
319319
#define strncasecmp strnicmp
320320

321-
#ifdef NOT_USED
322321
#define HAVE_SNPRINTF /* Gave link error */
323-
#define _snprintf snprintf
324-
#endif
322+
#define snprintf _snprintf
325323

326324
#ifdef _MSC_VER
327325
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
@@ -360,7 +358,7 @@ inline ulonglong double2ulonglong(double d)
360358
#define FN_ROOTDIR "\\"
361359
#define FN_DEVCHAR ':'
362360
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
363-
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
361+
#define FN_NO_CASE_SENSE /* Files are not case-sensitive */
364362
#define OS_FILE_LIMIT UINT_MAX /* No limit*/
365363

366364
#define DO_NOT_REMOVE_THREAD_WRAPPERS

include/ft_global.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ extern "C" {
2828
#define HA_FT_MAXBYTELEN 254
2929
#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)
3030

31+
#define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|"
32+
3133
typedef struct st_ft_info FT_INFO;
3234
struct _ft_vft
3335
{
@@ -51,7 +53,7 @@ extern const char *ft_precompiled_stopwords[];
5153
extern ulong ft_min_word_len;
5254
extern ulong ft_max_word_len;
5355
extern ulong ft_query_expansion_limit;
54-
extern char ft_boolean_syntax[15];
56+
extern const char *ft_boolean_syntax;
5557
extern struct st_mysql_ftparser ft_default_parser;
5658

5759
int ft_init_stopwords(void);

include/keycache.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ typedef struct st_key_cache
8787
initializing the key cache.
8888
*/
8989

90-
ulonglong param_buff_size; /* size the memory allocated for the cache */
91-
ulong param_block_size; /* size of the blocks in the key cache */
92-
ulong param_division_limit; /* min. percentage of warm blocks */
93-
ulong param_age_threshold; /* determines when hot block is downgraded */
90+
ulonglong param_buff_size; /* size the memory allocated for the cache */
91+
ulonglong param_block_size; /* size of the blocks in the key cache */
92+
ulonglong param_division_limit; /* min. percentage of warm blocks */
93+
ulonglong param_age_threshold; /* determines when hot block is downgraded */
9494

9595
/* Statistics variables. These are reset in reset_key_cache_counters(). */
9696
ulong global_blocks_changed; /* number of currently dirty blocks */

include/m_string.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ extern char *str2int(const char *src,int radix,long lower,long upper,
215215
long *val);
216216
longlong my_strtoll10(const char *nptr, char **endptr, int *error);
217217
#if SIZEOF_LONG == SIZEOF_LONG_LONG
218-
#define longlong2str(A,B,C) int2str((A),(B),(C),1)
218+
#define ll2str(A,B,C,D) int2str((A),(B),(C),(D))
219219
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
220220
#undef strtoll
221221
#define strtoll(A,B,C) strtol((A),(B),(C))
@@ -228,14 +228,15 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error);
228228
#endif
229229
#else
230230
#ifdef HAVE_LONG_LONG
231-
extern char *longlong2str(longlong val,char *dst,int radix);
231+
extern char *ll2str(longlong val,char *dst,int radix, int upcase);
232232
extern char *longlong10_to_str(longlong val,char *dst,int radix);
233233
#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO))
234234
extern longlong strtoll(const char *str, char **ptr, int base);
235235
extern ulonglong strtoull(const char *str, char **ptr, int base);
236236
#endif
237237
#endif
238238
#endif
239+
#define longlong2str(A,B,C) ll2str((A),(B),(C),1)
239240

240241
/* my_vsnprintf.c */
241242

@@ -260,6 +261,13 @@ typedef struct st_mysql_lex_string LEX_STRING;
260261
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
261262
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
262263

264+
struct st_mysql_const_lex_string
265+
{
266+
const char *str;
267+
size_t length;
268+
};
269+
typedef struct st_mysql_const_lex_string LEX_CSTRING;
270+
263271
/* SPACE_INT is a word that contains only spaces */
264272
#if SIZEOF_INT == 4
265273
#define SPACE_INT 0x20202020

include/my_base.h

-11
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,6 @@ enum ha_base_keytype {
275275
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
276276
#define HA_USES_BLOCK_SIZE ((uint) 32768)
277277
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
278-
#if MYSQL_VERSION_ID < 0x50200
279-
/*
280-
Key has a part that can have end space. If this is an unique key
281-
we have to handle it differently from other unique keys as we can find
282-
many matching rows for one key (because end space are not compared)
283-
*/
284-
#define HA_END_SPACE_KEY 0 /* was: 4096 */
285-
#else
286-
#error HA_END_SPACE_KEY is obsolete, please remove it
287-
#endif
288-
289278

290279
/* These flags can be added to key-seg-flag */
291280

include/my_getopt.h

+35-16
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ C_MODE_START
3232
#define GET_ENUM 12
3333
#define GET_SET 13
3434
#define GET_DOUBLE 14
35+
#define GET_FLAGSET 15
3536

3637
#define GET_ASK_ADDR 128
3738
#define GET_TYPE_MASK 127
@@ -42,24 +43,40 @@ struct st_typelib;
4243

4344
struct my_option
4445
{
45-
const char *name; /* Name of the option */
46-
int id; /* unique id or short option */
47-
const char *comment; /* option comment, for autom. --help */
48-
uchar **value; /* The variable value */
49-
uchar **u_max_value; /* The user def. max variable value */
50-
struct st_typelib *typelib; /* Pointer to possible values */
51-
ulong var_type;
52-
enum get_opt_arg_type arg_type;
53-
longlong def_value; /* Default value */
54-
longlong min_value; /* Min allowed value */
55-
longlong max_value; /* Max allowed value */
56-
longlong sub_size; /* Subtract this from given value */
57-
long block_size; /* Value should be a mult. of this */
58-
void *app_type; /* To be used by an application */
46+
const char *name; /**< Name of the option. name=NULL
47+
marks the end of the my_option[]
48+
array.
49+
*/
50+
int id; /**< For 0<id<255 it's means one
51+
character for a short option
52+
(like -A), if >255 no short option
53+
is created, but a long option still
54+
can be identified uniquely in the
55+
my_get_one_option() callback.
56+
If an opton needs neither special
57+
treatment in the my_get_one_option()
58+
nor one-letter short equivalent
59+
use id=0
60+
*/
61+
const char *comment; /**< option comment, for autom. --help.
62+
if it's NULL the option is not
63+
visible in --help.
64+
*/
65+
uchar **value; /**< A pointer to the variable value */
66+
uchar **u_max_value; /**< The user def. max variable value */
67+
struct st_typelib *typelib; /**< Pointer to possible values */
68+
ulong var_type; /**< GET_BOOL, GET_ULL, etc */
69+
enum get_opt_arg_type arg_type; /**< e.g. REQUIRED_ARG or OPT_ARG */
70+
longlong def_value; /**< Default value */
71+
longlong min_value; /**< Min allowed value (for numbers) */
72+
longlong max_value; /**< Max allowed value (for numbers) */
73+
longlong sub_size; /**< Unused */
74+
long block_size; /**< Value should be a mult. of this (for numbers) */
75+
void *app_type; /**< To be used by an application */
5976
};
6077

61-
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
62-
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
78+
typedef my_bool (*my_get_one_option) (int, const struct my_option *, char * );
79+
typedef void (*my_error_reporter) (enum loglevel level, const char *format, ... );
6380

6481
extern char *disabled_my_option;
6582
extern my_bool my_getopt_print_errors;
@@ -78,6 +95,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
7895
my_bool *fix);
7996
longlong getopt_ll_limit_value(longlong, const struct my_option *,
8097
my_bool *fix);
98+
double getopt_double_limit_value(double num, const struct my_option *optp,
99+
my_bool *fix);
81100
my_bool getopt_compare_strings(const char *s, const char *t, uint length);
82101

83102
C_MODE_END

0 commit comments

Comments
 (0)