Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb
This commit is contained in:
joreland@mysql.com 2004-08-01 17:03:58 +02:00
commit 2e95d812c3
78 changed files with 1743 additions and 657 deletions

View file

@ -7,11 +7,6 @@ extra_flags="$pentium_cflags $fast_cflags -g"
extra_configs="$pentium_configs"
#strip=yes
#extra_configs="$extra_configs --with-innodb --with-berkeley-db \
# --with-embedded-server --enable-thread-safe-client \
# --with-openssl --with-vio --with-raid --with-ndbcluster"
# removed per discussion with Brian and Sanja because it makes Bootstrap
# fail
extra_configs="$extra_configs --with-innodb --with-berkeley-db \
--with-embedded-server --enable-thread-safe-client \
--with-openssl --with-vio --with-raid --with-ndbcluster"

View file

@ -9,7 +9,7 @@ cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs"
# We want to test isam when building with valgrind
extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-isam --with-embedded-server --with-openssl"
extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-isam --with-embedded-server --with-openssl --with-vio --with-raid --with-ndbcluster"
. "$path/FINISH.sh"

View file

@ -61,6 +61,7 @@ hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
ingo@mysql.com
jan@hundin.mysql.fi
jani@a80-186-24-72.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi

View file

@ -19,8 +19,15 @@
AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE README COPYING zlib
SUBDIRS = . include @docs_dirs@ \
EXTRA_DIST = INSTALL-SOURCE README COPYING
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests \
netware @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
DIST_SUBDIRS = . include @docs_dirs@ zlib \
@readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests SSL\

View file

@ -167,32 +167,116 @@ then
fi
])
AC_DEFUN(MYSQL_CHECK_ZLIB_WITH_COMPRESS, [
save_LIBS="$LIBS"
LIBS="-l$1 $LIBS"
AC_CACHE_CHECK([if libz with compress], mysql_cv_compress,
[AC_TRY_RUN([#include <zlib.h>
#ifdef __cplusplus
extern "C"
#endif
int main(int argv, char **argc)
{
return 0;
}
int link_test()
{
return compress(0, (unsigned long*) 0, "", 0);
}
], mysql_cv_compress=yes, mysql_cv_compress=no)])
if test "$mysql_cv_compress" = "yes"
then
AC_DEFINE([HAVE_COMPRESS], [1], [ZLIB and compress])
else
LIBS="$save_LIBS"
fi
dnl Define zlib paths to point at bundled zlib
AC_DEFUN([MYSQL_USE_BUNDLED_ZLIB], [
ZLIB_INCLUDES="-I\$(top_srcdir)/zlib"
ZLIB_LIBS="\$(top_builddir)/zlib/libz.la"
zlib_dir="zlib"
AC_SUBST([zlib_dir])
mysql_cv_compress="yes"
])
dnl Auxiliary macro to check for zlib at given path
AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
save_INCLUDES="$INCLUDES"
save_LIBS="$LIBS"
INCLUDES="$INCLUDES $ZLIB_INCLUDES"
LIBS="$LIBS $ZLIB_LIBS"
AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>],
[int link_test() { return compress(0, (unsigned long*) 0, "", 0); }],
[mysql_cv_compress="yes"
AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"])
])
INCLUDES="$save_INCLUDES"
LIBS="$save_LIBS"
])
dnl MYSQL_CHECK_ZLIB_WITH_COMPRESS
dnl ------------------------------------------------------------------------
dnl @synopsis MYSQL_CHECK_ZLIB_WITH_COMPRESS
dnl
dnl Provides the following configure options:
dnl --with-zlib-dir=DIR
dnl Possible DIR values are:
dnl - "no" - the macro will disable use of compression functions
dnl - "bundled" - means use zlib bundled along with MySQL sources
dnl - empty, or not specified - the macro will try default system
dnl library (if present), and in case of error will fall back to
dnl bundled zlib
dnl - zlib location prefix - given location prefix, the macro expects
dnl to find the library headers in $prefix/include, and binaries in
dnl $prefix/lib. If zlib headers or binaries weren't found at $prefix, the
dnl macro bails out with error.
dnl
dnl If the library was found, this function #defines HAVE_COMPRESS
dnl and configure variables ZLIB_INCLUDES (i.e. -I/path/to/zlib/include) and
dnl ZLIB_LIBS (i. e. -L/path/to/zlib/lib -lz).
AC_DEFUN([MYSQL_CHECK_ZLIB_WITH_COMPRESS], [
AC_MSG_CHECKING([for zlib compression library])
case $SYSTEM_TYPE in
dnl This is a quick fix for Netware if AC_TRY_LINK for some reason
dnl won't work there. Uncomment in case of failure and on Netware
dnl we'll always assume that zlib is present
dnl *netware* | *modesto*)
dnl AC_MSG_RESULT(ok)
dnl AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
dnl ;;
*)
AC_ARG_WITH([zlib-dir],
AC_HELP_STRING([--with-zlib-dir=DIR],
[Provide MySQL with a custom location of
compression library. Given DIR, zlib binary is
assumed to be in $DIR/lib and header files
in $DIR/include.]),
[mysql_zlib_dir=${withval}],
[mysql_zlib_dir=""])
case "$mysql_zlib_dir" in
"no")
mysql_cv_compress="no"
AC_MSG_RESULT([disabled])
;;
"bundled")
MYSQL_USE_BUNDLED_ZLIB
AC_MSG_RESULT([using bundled zlib])
;;
"")
ZLIB_INCLUDES=""
ZLIB_LIBS="-lz"
MYSQL_CHECK_ZLIB_DIR
if test "$mysql_cv_compress" = "no"; then
MYSQL_USE_BUNDLED_ZLIB
AC_MSG_RESULT([system-wide zlib not found, using one bundled with MySQL])
fi
;;
*)
if test -f "$mysql_zlib_dir/lib/libz.a" -a \
-f "$mysql_zlib_dir/include/zlib.h"; then
ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
MYSQL_CHECK_ZLIB_DIR
fi
if test "x$mysql_cv_compress" != "xyes"; then
AC_MSG_ERROR([headers or binaries were not found in $mysql_zlib_dir/{include,lib}])
fi
;;
esac
if test "$mysql_cv_compress" = "yes"; then
AC_SUBST([ZLIB_LIBS])
AC_SUBST([ZLIB_INCLUDES])
AC_DEFINE([HAVE_COMPRESS], [1], [Define to enable compression support])
fi
;;
esac
])
dnl ------------------------------------------------------------------------
#---START: Used in for client configure
AC_DEFUN(MYSQL_CHECK_ULONG,
[AC_MSG_CHECKING(for type ulong)

View file

@ -43,5 +43,6 @@ enum options_client
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME
};

View file

@ -17,7 +17,7 @@
#define MYSQL_CLIENT
#undef MYSQL_SERVER
#include "client_priv.h"
#include <time.h>
#include <my_time.h>
#include "log_event.h"
#define BIN_LOG_HEADER_SIZE 4
@ -53,10 +53,18 @@ static int port = MYSQL_PORT;
static const char* sock= 0;
static const char* user = 0;
static char* pass = 0;
static ulonglong position = 0;
static ulonglong start_position, stop_position;
#define start_position_mot ((my_off_t)start_position)
#define stop_position_mot ((my_off_t)stop_position)
static char *start_datetime_str, *stop_datetime_str;
static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX;
static ulonglong rec_count= 0;
static short binlog_flags = 0;
static MYSQL* mysql = NULL;
static const char* dirname_for_local_load= 0;
static bool stop_passed= 0;
static int dump_local_log_entries(const char* logname);
static int dump_remote_log_entries(const char* logname);
@ -302,15 +310,36 @@ Create_file event for file_id: %u\n",ae->file_id);
Load_log_processor load_processor;
/*
RETURN
0 ok and continue
1 error and terminate
-1 ok and terminate
int process_event(ulonglong *rec_count, char *last_db, Log_event *ev,
my_off_t pos, int old_format)
TODO
This function returns 0 even in some error cases. This should be changed.
*/
int process_event(char *last_db, Log_event *ev, my_off_t pos, int old_format)
{
char ll_buff[21];
DBUG_ENTER("process_event");
if ((*rec_count) >= offset)
if ((rec_count >= offset) &&
((my_time_t)(ev->when) >= start_datetime))
{
/*
We have found an event after start_datetime, from now on print
everything (in case the binlog has timestamps increasing and decreasing,
we do this to avoid cutting the middle).
*/
start_datetime= 0;
offset= 0; // print everything and protect against cycling rec_count
if (((my_time_t)(ev->when) >= stop_datetime)
|| (pos >= stop_position_mot))
{
stop_passed= 1; // skip all next binlogs
DBUG_RETURN(-1);
}
if (!short_form)
fprintf(result_file, "# at %s\n",llstr(pos,ll_buff));
@ -387,7 +416,7 @@ Create_file event for file_id: %u\n",exv->file_id);
}
end:
(*rec_count)++;
rec_count++;
if (ev)
delete ev;
DBUG_RETURN(0);
@ -417,13 +446,14 @@ static struct my_option my_long_options[] =
{"port", 'P', "Use port to connect to the remote server.",
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
0, 0, 0},
{"position", 'j', "Start reading the binlog at position N.",
(gptr*) &position, (gptr*) &position, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"position", 'j', "Deprecated. Use --start-position instead.",
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
@ -439,6 +469,35 @@ static struct my_option my_long_options[] =
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &sock, (gptr*) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"start-datetime", OPT_START_DATETIME,
"Start reading the binlog at first event having a datetime equal or "
"posterior to the argument; the argument must be a date and time "
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
(gptr*) &start_datetime_str, (gptr*) &start_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"stop-datetime", OPT_STOP_DATETIME,
"Stop reading the binlog at first event having a datetime equal or "
"posterior to the argument; the argument must be a date and time "
"in the local time zone, in any format accepted by the MySQL server "
"for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
"(you should probably use quotes for your shell to set it properly).",
(gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", OPT_START_POSITION,
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
{"stop-position", OPT_STOP_POSITION,
"Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.",
(gptr*) &stop_position, (gptr*) &stop_position, 0, GET_ULL,
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \
@ -513,6 +572,29 @@ the mysql command line client\n\n");
my_print_variables(my_long_options);
}
static my_time_t convert_str_to_timestamp(const char* str)
{
int was_cut;
MYSQL_TIME l_time;
long dummy_my_timezone;
bool dummy_in_dst_time_gap;
/* We require a total specification (date AND time) */
if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) !=
MYSQL_TIMESTAMP_DATETIME || was_cut)
{
fprintf(stderr, "Incorrect date and time argument: %s\n", str);
exit(1);
}
/*
Note that Feb 30th, Apr 31st cause no error messages and are mapped to
the next existing day, like in mysqld. Maybe this could be changed when
mysqld is changed too (with its "strict" mode?).
*/
return
my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap);
}
#include <help_end.h>
extern "C" my_bool
@ -559,7 +641,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
break;
}
break;
case OPT_START_DATETIME:
start_datetime= convert_str_to_timestamp(start_datetime_str);
break;
case OPT_STOP_DATETIME:
stop_datetime= convert_str_to_timestamp(stop_datetime_str);
break;
case 'V':
print_version();
exit(0);
@ -604,9 +691,8 @@ static MYSQL* safe_connect()
static int dump_log_entries(const char* logname)
{
if (remote_opt)
return dump_remote_log_entries(logname);
return dump_local_log_entries(logname);
return (remote_opt ? dump_remote_log_entries(logname) :
dump_local_log_entries(logname));
}
@ -663,21 +749,27 @@ static int dump_remote_log_entries(const char* logname)
char buf[128];
char last_db[FN_REFLEN+1] = "";
uint len, logname_len;
NET* net = &mysql->net;
NET* net;
int old_format;
int error= 0;
my_off_t old_off= start_position_mot;
char fname[FN_REFLEN+1];
DBUG_ENTER("dump_remote_log_entries");
/*
Even if we already read one binlog (case of >=2 binlogs on command line),
we cannot re-use the same connection as before, because it is now dead
(COM_BINLOG_DUMP kills the thread when it finishes).
*/
mysql= safe_connect();
net= &mysql->net;
old_format = check_master_version(mysql);
if (!position)
position = BIN_LOG_HEADER_SIZE; // protect the innocent from spam
if (position < BIN_LOG_HEADER_SIZE)
{
position = BIN_LOG_HEADER_SIZE;
// warn the user
sql_print_error("Warning: The position in the binary log can't be less than %d.\nStarting from position %d\n", BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE);
}
int4store(buf, position);
/*
COM_BINLOG_DUMP accepts only 4 bytes for the position, so we are forced to
cast to uint32.
*/
int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
logname_len = (uint) strlen(logname);
int4store(buf + 6, 0);
@ -685,33 +777,32 @@ static int dump_remote_log_entries(const char* logname)
if (simple_command(mysql, COM_BINLOG_DUMP, buf, logname_len + 10, 1))
{
fprintf(stderr,"Got fatal error sending the log dump command\n");
DBUG_RETURN(1);
error= 1;
goto err;
}
my_off_t old_off= position;
ulonglong rec_count= 0;
char fname[FN_REFLEN+1];
for (;;)
{
const char *error;
const char *error_msg;
len = net_safe_read(mysql);
if (len == packet_error)
{
fprintf(stderr, "Got error reading packet from server: %s\n",
mysql_error(mysql));
DBUG_RETURN(1);
error= 1;
goto err;
}
if (len < 8 && net->read_pos[0] == 254)
break; // end of data
DBUG_PRINT("info",( "len= %u, net->read_pos[5] = %d\n",
len, net->read_pos[5]));
Log_event *ev = Log_event::read_log_event((const char*) net->read_pos + 1 ,
len - 1, &error, old_format);
len - 1, &error_msg, old_format);
if (!ev)
{
fprintf(stderr, "Could not construct log event object\n");
DBUG_RETURN(1);
error= 1;
goto err;
}
Log_event_type type= ev->get_type_code();
@ -735,22 +826,32 @@ static int dump_remote_log_entries(const char* logname)
which are about the binlogs, so which would trigger the end-detection
below.
*/
if ((rev->when == 0) && !to_last_remote_log)
if (rev->when == 0)
{
if ((rev->ident_len != logname_len) ||
memcmp(rev->new_log_ident, logname, logname_len))
DBUG_RETURN(0);
/*
Otherwise, this is a fake Rotate for our log, at the very beginning
for sure. Skip it, because it was not in the original log. If we
are running with to_last_remote_log, we print it, because it serves
as a useful marker between binlogs then.
*/
continue;
if (!to_last_remote_log)
{
if ((rev->ident_len != logname_len) ||
memcmp(rev->new_log_ident, logname, logname_len))
{
error= 0;
goto err;
}
/*
Otherwise, this is a fake Rotate for our log, at the very
beginning for sure. Skip it, because it was not in the original
log. If we are running with to_last_remote_log, we print it,
because it serves as a useful marker between binlogs then.
*/
continue;
}
len= 1; // fake Rotate, so don't increment old_off
}
}
if (process_event(&rec_count,last_db,ev,old_off,old_format))
DBUG_RETURN(1);
if ((error= process_event(last_db,ev,old_off,old_format)))
{
error= ((error < 0) ? 0 : 1);
goto err;
}
}
else
{
@ -760,29 +861,35 @@ static int dump_remote_log_entries(const char* logname)
File file;
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
DBUG_RETURN(1);
{
error= 1;
goto err;
}
if (process_event(&rec_count,last_db,ev,old_off,old_format))
if ((error= process_event(last_db,ev,old_off,old_format)))
{
my_close(file,MYF(MY_WME));
DBUG_RETURN(1);
error= ((error < 0) ? 0 : 1);
goto err;
}
if (load_processor.load_old_format_file(net,old_fname,old_len,file))
{
my_close(file,MYF(MY_WME));
DBUG_RETURN(1);
error= 1;
goto err;
}
my_close(file,MYF(MY_WME));
}
/*
Let's adjust offset for remote log as for local log to produce
similar text. As we don't print the fake Rotate event, all events are
real so we can simply add the length.
similar text.
*/
old_off+= len-1;
}
DBUG_RETURN(0);
err:
mysql_close(mysql);
DBUG_RETURN(error);
}
@ -817,7 +924,6 @@ static int dump_local_log_entries(const char* logname)
{
File fd = -1;
IO_CACHE cache,*file= &cache;
ulonglong rec_count = 0;
char last_db[FN_REFLEN+1];
byte tmp_buff[BIN_LOG_HEADER_SIZE];
bool old_format = 0;
@ -829,7 +935,7 @@ static int dump_local_log_entries(const char* logname)
{
if ((fd = my_open(logname, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
return 1;
if (init_io_cache(file, fd, 0, READ_CACHE, (my_off_t) position, 0,
if (init_io_cache(file, fd, 0, READ_CACHE, start_position_mot, 0,
MYF(MY_WME | MY_NABP)))
{
my_close(fd, MYF(MY_WME));
@ -843,12 +949,12 @@ static int dump_local_log_entries(const char* logname)
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
return 1;
old_format = check_header(file);
if (position)
if (start_position)
{
/* skip 'position' characters from stdout */
/* skip 'start_position' characters from stdout */
byte buff[IO_SIZE];
my_off_t length,tmp;
for (length= (my_off_t) position ; length > 0 ; length-=tmp)
for (length= start_position_mot ; length > 0 ; length-=tmp)
{
tmp=min(length,sizeof(buff));
if (my_b_read(file, buff, (uint) tmp))
@ -858,11 +964,11 @@ static int dump_local_log_entries(const char* logname)
}
}
}
file->pos_in_file=position;
file->pos_in_file= start_position_mot;
file->seek_not_done=0;
}
if (!position)
if (!start_position)
{
// Skip header
if (my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
@ -891,9 +997,10 @@ static int dump_local_log_entries(const char* logname)
// file->error == 0 means EOF, that's OK, we break in this case
break;
}
if (process_event(&rec_count,last_db,ev,old_off,false))
if ((error= process_event(last_db,ev,old_off,false)))
{
error= 1;
if (error < 0)
error= 0;
break;
}
}
@ -909,11 +1016,14 @@ end:
int main(int argc, char** argv)
{
static char **defaults_argv;
int exit_value;
int exit_value= 0;
ulonglong save_stop_position;
MY_INIT(argv[0]);
DBUG_ENTER("main");
DBUG_PROCESS(argv[0]);
init_time(); // for time functions
parse_args(&argc, (char***)&argv);
defaults_argv=argv;
@ -925,8 +1035,6 @@ int main(int argc, char** argv)
}
my_set_max_open_files(open_files_limit);
if (remote_opt)
mysql = safe_connect();
MY_TMPDIR tmpdir;
tmpdir.list= 0;
@ -944,24 +1052,26 @@ int main(int argc, char** argv)
else
load_processor.init_by_cur_dir();
exit_value= 0;
fprintf(result_file,
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
while (--argc >= 0)
for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
(--argc >= 0) && !stop_passed ; )
{
if (argc == 0) // last log, --stop-position applies
stop_position= save_stop_position;
if (dump_log_entries(*(argv++)))
{
exit_value=1;
break;
}
// For next log, --start-position does not apply
start_position= BIN_LOG_HEADER_SIZE;
}
if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file != stdout)
my_fclose(result_file, MYF(0));
if (remote_opt)
mysql_close(mysql);
cleanup();
free_defaults(defaults_argv);
my_free_open_file_info();

View file

@ -664,15 +664,6 @@ AC_ARG_WITH(named-curses-libs,
[ with_named_curses=no ]
)
# Force use of a zlib (compress)
AC_ARG_WITH(named-z-libs,
[ --with-named-z-libs=ARG
Use specified zlib libraries instead of
those automatically found by configure.],
[ with_named_zlib=$withval ],
[ with_named_zlib=z ]
)
# Make thread safe client
AC_ARG_ENABLE(thread-safe-client,
[ --enable-thread-safe-client
@ -806,16 +797,7 @@ AC_CHECK_FUNC(crypt, AC_DEFINE([HAVE_CRYPT], [1], [crypt]))
# For sem_xxx functions on Solaris 2.6
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
# For compress in zlib
case $SYSTEM_TYPE in
*netware* | *modesto*)
AC_DEFINE(HAVE_COMPRESS, [1])
;;
*)
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
;;
esac
MYSQL_CHECK_ZLIB_WITH_COMPRESS
#--------------------------------------------------------------------
# Check for TCP wrapper support
@ -945,7 +927,7 @@ then
fi
# We make a special variable for client library's to avoid including
# thread libs in the client.
NON_THREADED_CLIENT_LIBS="$LIBS"
NON_THREADED_CLIENT_LIBS="$LIBS $ZLIB_LIBS"
AC_MSG_CHECKING([for int8])
case $SYSTEM_TYPE in
@ -3082,6 +3064,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
include/mysql_version.h dnl
cmd-line-utils/Makefile dnl
cmd-line-utils/libedit/Makefile dnl
zlib/Makefile dnl
cmd-line-utils/readline/Makefile)
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
AC_OUTPUT

View file

@ -41,6 +41,13 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
int *was_cut);
long calc_daynr(uint year,uint month,uint day);
void init_time(void);
my_time_t
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap);
C_MODE_END
#endif /* _my_time_h_ */

View file

@ -22,215 +22,218 @@
*/
/* these two are for uniformity */
#define mi_sint1korr(A) (int8)(*A)
#define mi_uint1korr(A) (uint8)(*A)
#define mi_sint1korr(A) ((int8)(*A))
#define mi_uint1korr(A) ((uint8)(*A))
#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\
((int16) ((int16) (A)[0]) << 8))
#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) (uchar) (A)[0]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[2])) : \
(((uint32) (uchar) (A)[0]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[2])))
#define mi_sint4korr(A) (int32) (((int32) ((uchar) (A)[3])) +\
(((int32) ((uchar) (A)[2]) << 8)) +\
(((int32) ((uchar) (A)[1]) << 16)) +\
(((int32) ((int16) (A)[0]) << 24)))
#define mi_sint8korr(A) (longlong) mi_uint8korr(A)
#define mi_uint2korr(A) (uint16) (((uint16) ((uchar) (A)[1])) +\
((uint16) ((uchar) (A)[0]) << 8))
#define mi_uint3korr(A) (uint32) (((uint32) ((uchar) (A)[2])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[0])) << 16))
#define mi_uint4korr(A) (uint32) (((uint32) ((uchar) (A)[3])) +\
(((uint32) ((uchar) (A)[2])) << 8) +\
(((uint32) ((uchar) (A)[1])) << 16) +\
(((uint32) ((uchar) (A)[0])) << 24))
#define mi_uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[4])) +\
(((uint32) ((uchar) (A)[3])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[1])) << 24)) +\
(((ulonglong) ((uchar) (A)[0])) << 32))
#define mi_uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[5])) +\
(((uint32) ((uchar) (A)[4])) << 8) +\
(((uint32) ((uchar) (A)[3])) << 16) +\
(((uint32) ((uchar) (A)[2])) << 24)) +\
(((ulonglong) (((uint32) ((uchar) (A)[1])) +\
(((uint32) ((uchar) (A)[0]) << 8)))) <<\
32))
#define mi_uint7korr(A) ((ulonglong)(((uint32) ((uchar) (A)[6])) +\
(((uint32) ((uchar) (A)[5])) << 8) +\
(((uint32) ((uchar) (A)[4])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) (((uint32) ((uchar) (A)[2])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[0])) << 16))) <<\
32))
#define mi_uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[7])) +\
(((uint32) ((uchar) (A)[6])) << 8) +\
(((uint32) ((uchar) (A)[5])) << 16) +\
(((uint32) ((uchar) (A)[4])) << 24)) +\
(((ulonglong) (((uint32) ((uchar) (A)[3])) +\
(((uint32) ((uchar) (A)[2])) << 8) +\
(((uint32) ((uchar) (A)[1])) << 16) +\
(((uint32) ((uchar) (A)[0])) << 24))) <<\
32))
#define mi_sint2korr(A) ((int16) (((int16) (((uchar*) (A))[1])) +\
((int16) ((int16) ((char*) (A))[0]) << 8)))
#define mi_sint3korr(A) ((int32) (((((uchar*) (A))[0]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) ((uchar*) (A))[0]) << 16) |\
(((uint32) ((uchar*) (A))[1]) << 8) | \
((uint32) ((uchar*) (A))[2])) : \
(((uint32) ((uchar*) (A))[0]) << 16) |\
(((uint32) ((uchar*) (A))[1]) << 8) | \
((uint32) ((uchar*) (A))[2])))
#define mi_sint4korr(A) ((int32) (((int32) (((uchar*) (A))[3])) +\
((int32) (((uchar*) (A))[2]) << 8) +\
((int32) (((uchar*) (A))[1]) << 16) +\
((int32) ((int16) ((char*) (A))[0]) << 24)))
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
#define mi_uint2korr(A) ((uint16) (((uint16) (((uchar*) (A))[1])) +\
((uint16) (((uchar*) (A))[0]) << 8)))
#define mi_uint3korr(A) ((uint32) (((uint32) (((uchar*) (A))[2])) +\
(((uint32) (((uchar*) (A))[1])) << 8) +\
(((uint32) (((uchar*) (A))[0])) << 16)))
#define mi_uint4korr(A) ((uint32) (((uint32) (((uchar*) (A))[3])) +\
(((uint32) (((uchar*) (A))[2])) << 8) +\
(((uint32) (((uchar*) (A))[1])) << 16) +\
(((uint32) (((uchar*) (A))[0])) << 24)))
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[4])) +\
(((uint32) (((uchar*) (A))[3])) << 8) +\
(((uint32) (((uchar*) (A))[2])) << 16) +\
(((uint32) (((uchar*) (A))[1])) << 24)) +\
(((ulonglong) (((uchar*) (A))[0])) << 32))
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[5])) +\
(((uint32) (((uchar*) (A))[4])) << 8) +\
(((uint32) (((uchar*) (A))[3])) << 16) +\
(((uint32) (((uchar*) (A))[2])) << 24)) +\
(((ulonglong) (((uint32) (((uchar*) (A))[1])) +\
(((uint32) (((uchar*) (A))[0]) << 8)))) <<\
32))
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[6])) +\
(((uint32) (((uchar*) (A))[5])) << 8) +\
(((uint32) (((uchar*) (A))[4])) << 16) +\
(((uint32) (((uchar*) (A))[3])) << 24)) +\
(((ulonglong) (((uint32) (((uchar*) (A))[2])) +\
(((uint32) (((uchar*) (A))[1])) << 8) +\
(((uint32) (((uchar*) (A))[0])) << 16))) <<\
32))
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\
(((uint32) (((uchar*) (A))[6])) << 8) +\
(((uint32) (((uchar*) (A))[5])) << 16) +\
(((uint32) (((uchar*) (A))[4])) << 24)) +\
(((ulonglong) (((uint32) (((uchar*) (A))[3])) +\
(((uint32) (((uchar*) (A))[2])) << 8) +\
(((uint32) (((uchar*) (A))[1])) << 16) +\
(((uint32) (((uchar*) (A))[0])) << 24))) <<\
32))
/* This one is for uniformity */
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
*((uchar*) ((T)+1))= (uchar)(def_temp); \
*((uchar*) ((T)+0))= (uchar)(def_temp >> 8); }
#define mi_int3store(T,A) { /*lint -save -e734 */\
ulong def_temp= (ulong) (A);\
*(((T)+2))=(char) (def_temp);\
*((T)+1)= (char) (def_temp >> 8);\
*((T)+0)= (char) (def_temp >> 16);\
/*lint -restore */}
#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\
*((T)+3)=(char) (def_temp);\
*((T)+2)=(char) (def_temp >> 8);\
*((T)+1)=(char) (def_temp >> 16);\
*((T)+0)=(char) (def_temp >> 24); }
#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\
def_temp2= (ulong) ((A) >> 32);\
*((T)+4)=(char) (def_temp);\
*((T)+3)=(char) (def_temp >> 8);\
*((T)+2)=(char) (def_temp >> 16);\
*((T)+1)=(char) (def_temp >> 24);\
*((T)+0)=(char) (def_temp2); }
#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\
def_temp2= (ulong) ((A) >> 32);\
*((T)+5)=(char) (def_temp);\
*((T)+4)=(char) (def_temp >> 8);\
*((T)+3)=(char) (def_temp >> 16);\
*((T)+2)=(char) (def_temp >> 24);\
*((T)+1)=(char) (def_temp2);\
*((T)+0)=(char) (def_temp2 >> 8); }
#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\
def_temp2= (ulong) ((A) >> 32);\
*((T)+6)=(char) (def_temp);\
*((T)+5)=(char) (def_temp >> 8);\
*((T)+4)=(char) (def_temp >> 16);\
*((T)+3)=(char) (def_temp >> 24);\
*((T)+2)=(char) (def_temp2);\
*((T)+1)=(char) (def_temp2 >> 8);\
*((T)+0)=(char) (def_temp2 >> 16); }
#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A), \
def_temp4= (ulong) ((A) >> 32); \
mi_int4store((T),def_temp4); \
mi_int4store((T+4),def_temp3); \
}
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
((uchar*) (T))[1]= (uchar) (def_temp);\
((uchar*) (T))[0]= (uchar) (def_temp >> 8); }
#define mi_int3store(T,A) { /*lint -save -e734 */\
ulong def_temp= (ulong) (A);\
((uchar*) (T))[2]= (uchar) (def_temp);\
((uchar*) (T))[1]= (uchar) (def_temp >> 8);\
((uchar*) (T))[0]= (uchar) (def_temp >> 16);\
/*lint -restore */}
#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\
((uchar*) (T))[3]= (uchar) (def_temp);\
((uchar*) (T))[2]= (uchar) (def_temp >> 8);\
((uchar*) (T))[1]= (uchar) (def_temp >> 16);\
((uchar*) (T))[0]= (uchar) (def_temp >> 24); }
#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\
def_temp2= (ulong) ((A) >> 32);\
((uchar*) (T))[4]= (uchar) (def_temp);\
((uchar*) (T))[3]= (uchar) (def_temp >> 8);\
((uchar*) (T))[2]= (uchar) (def_temp >> 16);\
((uchar*) (T))[1]= (uchar) (def_temp >> 24);\
((uchar*) (T))[0]= (uchar) (def_temp2); }
#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\
def_temp2= (ulong) ((A) >> 32);\
((uchar*) (T))[5]= (uchar) (def_temp);\
((uchar*) (T))[4]= (uchar) (def_temp >> 8);\
((uchar*) (T))[3]= (uchar) (def_temp >> 16);\
((uchar*) (T))[2]= (uchar) (def_temp >> 24);\
((uchar*) (T))[1]= (uchar) (def_temp2);\
((uchar*) (T))[0]= (uchar) (def_temp2 >> 8); }
#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\
def_temp2= (ulong) ((A) >> 32);\
((uchar*) (T))[6]= (uchar) (def_temp);\
((uchar*) (T))[5]= (uchar) (def_temp >> 8);\
((uchar*) (T))[4]= (uchar) (def_temp >> 16);\
((uchar*) (T))[3]= (uchar) (def_temp >> 24);\
((uchar*) (T))[2]= (uchar) (def_temp2);\
((uchar*) (T))[1]= (uchar) (def_temp2 >> 8);\
((uchar*) (T))[0]= (uchar) (def_temp2 >> 16); }
#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A),\
def_temp4= (ulong) ((A) >> 32);\
mi_int4store((uchar*) (T) + 0, def_temp4);\
mi_int4store((uchar*) (T) + 4, def_temp3); }
#ifdef WORDS_BIGENDIAN
#define mi_float4store(T,A) { *(T)= ((byte *) &A)[0];\
*((T)+1)=(char) ((byte *) &A)[1];\
*((T)+2)=(char) ((byte *) &A)[2];\
*((T)+3)=(char) ((byte *) &A)[3]; }
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[0];\
((uchar*) (T))[1]= ((uchar*) &A)[1];\
((uchar*) (T))[2]= ((uchar*) &A)[2];\
((uchar*) (T))[3]= ((uchar*) &A)[3]; }
#define mi_float4get(V,M) { float def_temp;\
((byte*) &def_temp)[0]=(M)[0];\
((byte*) &def_temp)[1]=(M)[1];\
((byte*) &def_temp)[2]=(M)[2];\
((byte*) &def_temp)[3]=(M)[3];\
(V)=def_temp; }
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
(V)= def_temp; }
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[0];\
*((T)+1)=(char) ((byte *) &V)[1];\
*((T)+2)=(char) ((byte *) &V)[2];\
*((T)+3)=(char) ((byte *) &V)[3];\
*((T)+4)=(char) ((byte *) &V)[4];\
*((T)+5)=(char) ((byte *) &V)[5];\
*((T)+6)=(char) ((byte *) &V)[6];\
*((T)+7)=(char) ((byte *) &V)[7]; }
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[0];\
((uchar*) (T))[1]= ((uchar*) &V)[1];\
((uchar*) (T))[2]= ((uchar*) &V)[2];\
((uchar*) (T))[3]= ((uchar*) &V)[3];\
((uchar*) (T))[4]= ((uchar*) &V)[4];\
((uchar*) (T))[5]= ((uchar*) &V)[5];\
((uchar*) (T))[6]= ((uchar*) &V)[6];\
((uchar*) (T))[7]= ((uchar*) &V)[7]; }
#define mi_float8get(V,M) { double def_temp;\
((byte*) &def_temp)[0]=(M)[0];\
((byte*) &def_temp)[1]=(M)[1];\
((byte*) &def_temp)[2]=(M)[2];\
((byte*) &def_temp)[3]=(M)[3];\
((byte*) &def_temp)[4]=(M)[4];\
((byte*) &def_temp)[5]=(M)[5];\
((byte*) &def_temp)[6]=(M)[6];\
((byte*) &def_temp)[7]=(M)[7]; \
(V)=def_temp; }
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
((uchar*) &def_temp)[4]= ((uchar*) (M))[4];\
((uchar*) &def_temp)[5]= ((uchar*) (M))[5];\
((uchar*) &def_temp)[6]= ((uchar*) (M))[6];\
((uchar*) &def_temp)[7]= ((uchar*) (M))[7]; \
(V)= def_temp; }
#else
#define mi_float4store(T,A) { *(T)= ((byte *) &A)[3];\
*((T)+1)=(char) ((byte *) &A)[2];\
*((T)+2)=(char) ((byte *) &A)[1];\
*((T)+3)=(char) ((byte *) &A)[0]; }
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[3];\
((uchar*) (T))[1]= ((uchar*) &A)[2];\
((uchar*) (T))[2]= ((uchar*) &A)[1];\
((uchar*) (T))[3]= ((uchar*) &A)[0]; }
#define mi_float4get(V,M) { float def_temp;\
((byte*) &def_temp)[0]=(M)[3];\
((byte*) &def_temp)[1]=(M)[2];\
((byte*) &def_temp)[2]=(M)[1];\
((byte*) &def_temp)[3]=(M)[0];\
(V)=def_temp; }
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
(V)= def_temp; }
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[3];\
*((T)+1)=(char) ((byte *) &V)[2];\
*((T)+2)=(char) ((byte *) &V)[1];\
*((T)+3)=(char) ((byte *) &V)[0];\
*((T)+4)=(char) ((byte *) &V)[7];\
*((T)+5)=(char) ((byte *) &V)[6];\
*((T)+6)=(char) ((byte *) &V)[5];\
*((T)+7)=(char) ((byte *) &V)[4];}
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[3];\
((uchar*) (T))[1]= ((uchar*) &V)[2];\
((uchar*) (T))[2]= ((uchar*) &V)[1];\
((uchar*) (T))[3]= ((uchar*) &V)[0];\
((uchar*) (T))[4]= ((uchar*) &V)[7];\
((uchar*) (T))[5]= ((uchar*) &V)[6];\
((uchar*) (T))[6]= ((uchar*) &V)[5];\
((uchar*) (T))[7]= ((uchar*) &V)[4];}
#define mi_float8get(V,M) { double def_temp;\
((byte*) &def_temp)[0]=(M)[3];\
((byte*) &def_temp)[1]=(M)[2];\
((byte*) &def_temp)[2]=(M)[1];\
((byte*) &def_temp)[3]=(M)[0];\
((byte*) &def_temp)[4]=(M)[7];\
((byte*) &def_temp)[5]=(M)[6];\
((byte*) &def_temp)[6]=(M)[5];\
((byte*) &def_temp)[7]=(M)[4];\
(V)=def_temp; }
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
((uchar*) &def_temp)[4]= ((uchar*) (M))[7];\
((uchar*) &def_temp)[5]= ((uchar*) (M))[6];\
((uchar*) &def_temp)[6]= ((uchar*) (M))[5];\
((uchar*) &def_temp)[7]= ((uchar*) (M))[4];\
(V)= def_temp; }
#else
#define mi_float8store(T,V) { *(T)= ((byte *) &V)[7];\
*((T)+1)=(char) ((byte *) &V)[6];\
*((T)+2)=(char) ((byte *) &V)[5];\
*((T)+3)=(char) ((byte *) &V)[4];\
*((T)+4)=(char) ((byte *) &V)[3];\
*((T)+5)=(char) ((byte *) &V)[2];\
*((T)+6)=(char) ((byte *) &V)[1];\
*((T)+7)=(char) ((byte *) &V)[0];}
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[7];\
((uchar*) (T))[1]= ((uchar*) &V)[6];\
((uchar*) (T))[2]= ((uchar*) &V)[5];\
((uchar*) (T))[3]= ((uchar*) &V)[4];\
((uchar*) (T))[4]= ((uchar*) &V)[3];\
((uchar*) (T))[5]= ((uchar*) &V)[2];\
((uchar*) (T))[6]= ((uchar*) &V)[1];\
((uchar*) (T))[7]= ((uchar*) &V)[0];}
#define mi_float8get(V,M) { double def_temp;\
((byte*) &def_temp)[0]=(M)[7];\
((byte*) &def_temp)[1]=(M)[6];\
((byte*) &def_temp)[2]=(M)[5];\
((byte*) &def_temp)[3]=(M)[4];\
((byte*) &def_temp)[4]=(M)[3];\
((byte*) &def_temp)[5]=(M)[2];\
((byte*) &def_temp)[6]=(M)[1];\
((byte*) &def_temp)[7]=(M)[0];\
(V)=def_temp; }
((uchar*) &def_temp)[0]= ((uchar*) (M))[7];\
((uchar*) &def_temp)[1]= ((uchar*) (M))[6];\
((uchar*) &def_temp)[2]= ((uchar*) (M))[5];\
((uchar*) &def_temp)[3]= ((uchar*) (M))[4];\
((uchar*) &def_temp)[4]= ((uchar*) (M))[3];\
((uchar*) &def_temp)[5]= ((uchar*) (M))[2];\
((uchar*) &def_temp)[6]= ((uchar*) (M))[1];\
((uchar*) &def_temp)[7]= ((uchar*) (M))[0];\
(V)= def_temp; }
#endif /* __FLOAT_WORD_ORDER */
#endif /* WORDS_BIGENDIAN */
/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */
#ifdef BIG_TABLES
#define mi_rowstore(T,A) mi_int8store(T,A)
#define mi_rowkorr(T) mi_uint8korr(T)
#define mi_rowstore(T,A) mi_int8store(T, A)
#define mi_rowkorr(T) mi_uint8korr(T)
#else
#define mi_rowstore(T,A) { mi_int4store(T,0); mi_int4store(((T)+4),A); }
#define mi_rowkorr(T) mi_uint4korr((T)+4)
#define mi_rowstore(T,A) { mi_int4store(T, 0);\
mi_int4store(((uchar*) (T) + 4), A); }
#define mi_rowkorr(T) mi_uint4korr((uchar*) (T) + 4)
#endif
#if SIZEOF_OFF_T > 4
#define mi_sizestore(T,A) mi_int8store(T,A)
#define mi_sizekorr(T) mi_uint8korr(T)
#define mi_sizestore(T,A) mi_int8store(T, A)
#define mi_sizekorr(T) mi_uint8korr(T)
#else
#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR) bfill((char*) (T),8,255); else { mi_int4store((T),0); mi_int4store(((T)+4),A); }}
#define mi_sizekorr(T) mi_uint4korr((T)+4)
#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR)\
bfill((char*) (T), 8, 255);\
else { mi_int4store((T), 0);\
mi_int4store(((T) + 4), A); }}
#define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4)
#endif

View file

@ -34,4 +34,13 @@ typedef struct st_mysql_time
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;
/*
Portable time_t replacement.
Should be signed and hold seconds for 1902-2038 range.
*/
typedef long my_time_t;
#define MY_TIME_T_MAX LONG_MAX
#define MY_TIME_T_MIN LONG_MIN
#endif /* _mysql_time_h_ */

View file

@ -1513,6 +1513,8 @@ fil_decr_pending_ibuf_merges(
mutex_exit(&(system->mutex));
}
/************************************************************
Creates the database directory for a table if it does not exist yet. */
static
void
fil_create_directory_for_tablename(

View file

@ -42,6 +42,7 @@ extern char* srv_arch_dir;
#endif /* UNIV_LOG_ARCHIVE */
extern ibool srv_file_per_table;
extern ibool srv_locks_unsafe_for_binlog;
extern ulint srv_n_data_files;
extern char** srv_data_file_names;

View file

@ -631,10 +631,24 @@ row_sel_get_clust_rec(
if (!node->read_view) {
/* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is
not used.
*/
if ( srv_locks_unsafe_for_binlog )
{
err = lock_clust_rec_read_check_and_lock(0, clust_rec,
index,node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
}
else
{
err = lock_clust_rec_read_check_and_lock(0, clust_rec, index,
node->row_lock_mode, LOCK_ORDINARY, thr);
if (err != DB_SUCCESS) {
}
if (err != DB_SUCCESS) {
return(err);
}
@ -1184,9 +1198,23 @@ rec_loop:
search result set, resulting in the phantom problem. */
if (!consistent_read) {
/* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is
not used.
*/
if ( srv_locks_unsafe_for_binlog )
{
err = sel_set_rec_lock(page_rec_get_next(rec), index,
node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
}
else
{
err = sel_set_rec_lock(page_rec_get_next(rec), index,
node->row_lock_mode, LOCK_ORDINARY, thr);
if (err != DB_SUCCESS) {
}
if (err != DB_SUCCESS) {
/* Note that in this case we will store in pcur
the PREDECESSOR of the record we are waiting
the lock for */
@ -1211,8 +1239,22 @@ rec_loop:
if (!consistent_read) {
/* Try to place a lock on the index record */
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
/* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is
not used.
*/
if ( srv_locks_unsafe_for_binlog )
{
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_REC_NOT_GAP, thr);
}
else
{
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_ORDINARY, thr);
}
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
@ -3144,10 +3186,24 @@ rec_loop:
/* Try to place a lock on the index record */
err = sel_set_rec_lock(rec, index,
/* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is
not used.
*/
if ( srv_locks_unsafe_for_binlog )
{
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr);
}
else
{
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
if (err != DB_SUCCESS) {
}
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
}
@ -3300,9 +3356,22 @@ rec_loop:
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr);
} else {
err = sel_set_rec_lock(rec, index,
/* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is
not used.
*/
if ( srv_locks_unsafe_for_binlog )
{
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr);
}
else
{
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
}
}
if (err != DB_SUCCESS) {

View file

@ -77,6 +77,10 @@ ibool srv_file_per_table = FALSE; /* store to its own file each table
created by an user; data dictionary
tables are in the system tablespace
0 */
ibool srv_locks_unsafe_for_binlog = FALSE; /* Place locks to records only
i.e. do not use next-key locking
except on duplicate key checking and
foreign key checking */
ulint srv_n_data_files = 0;
char** srv_data_file_names = NULL;
ulint* srv_data_file_sizes = NULL; /* size in database pages */

View file

@ -20,7 +20,7 @@
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
include $(srcdir)/Makefile.shared

View file

@ -21,7 +21,8 @@ target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @openssl_libs@
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes)
INCLUDES = @MT_INCLUDES@ \
-I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
include $(top_srcdir)/libmysql/Makefile.shared

View file

@ -27,7 +27,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/regex \
$(openssl_includes)
$(openssl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a
pkglib_LIBRARIES = libmysqld.a

View file

@ -609,9 +609,9 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
client_field->org_table_length= strlen(client_field->org_table);
client_field->charsetnr= server_field.charsetnr;
client_field->catalog= strdup_root(field_alloc, "std");
client_field->catalog= strdup_root(field_alloc, "def");
client_field->catalog_length= 3;
if (INTERNAL_NUM_FIELD(client_field))
client_field->flags|= NUM_FLAG;

View file

@ -18,8 +18,11 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res
pkgdata_DATA = mi_test_all mi_test_all.res
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
@ZLIB_LIBS@ \
$(top_builddir)/strings/libmystrings.a
pkglib_LIBRARIES = libmyisam.a
bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump
myisamchk_DEPENDENCIES= $(LIBRARIES)

View file

@ -1450,9 +1450,11 @@ then
then
echo "Starting ndbcluster"
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
export NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
export NDB_CONNECTSTRING
else
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
export NDB_CONNECTSTRING
echo "Using ndbcluster at $NDB_CONNECTSTRING"
fi
fi

View file

@ -86,7 +86,6 @@ fs_name_1=$fs_ndb/node-1-fs
fs_name_2=$fs_ndb/node-2-fs
NDB_HOME=
export NDB_CONNECTSTRING
if [ ! -x $fsdir ]; then
echo "$fsdir missing"
exit 1
@ -102,7 +101,8 @@ fi
ndb_host="localhost"
ndb_mgmd_port=$port_base
export NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
export NDB_CONNECTSTRING
start_default_ndbcluster() {

View file

@ -201,6 +201,24 @@ a b
202 5
203 6
204 7
alter table t1 modify b mediumint;
select * from t1 order by b;
a b
1 1
200 2
0 3
201 4
202 5
203 6
204 7
create table t2 (a int);
insert t2 values (1),(2);
alter table t2 add b int auto_increment primary key;
select * from t2;
a b
1 1
2 2
drop table t2;
delete from t1 where a=0;
update t1 set a=0 where b=5;
select * from t1 order by b;

View file

@ -40,6 +40,8 @@ show tables;
Tables_in_test
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3');
show tables;
Tables_in_mysql

View file

@ -21,7 +21,7 @@ def test t1 t1 g g 5 4 0 Y 32768 3 63
def test t1 t1 h h 0 7 0 Y 32768 4 63
def test t1 t1 i i 13 4 0 Y 32864 0 63
def test t1 t1 j j 10 10 0 Y 128 0 63
def test t1 t1 k k 7 19 0 N 1217 0 63
def test t1 t1 k k 7 19 0 N 1249 0 63
def test t1 t1 l l 12 19 0 Y 128 0 63
def test t1 t1 m m 254 1 0 Y 256 0 8
def test t1 t1 n n 254 3 0 Y 2048 0 8

View file

@ -0,0 +1,446 @@
drop table if exists t1;
reset master;
set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
set timestamp=@a;
create table t1 (a int auto_increment not null primary key, b char(3));
insert into t1 values(null, "a");
insert into t1 values(null, "b");
set timestamp=@a+2;
insert into t1 values(null, "c");
set timestamp=@a+4;
insert into t1 values(null, "d");
insert into t1 values(null, "e");
flush logs;
set timestamp=@a+1;
insert into t1 values(null, "f");
--- Local --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- offset --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=1;
use test;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- stop-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=3;
use test;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- stop-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
--- Local with 2 binlogs on command line --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- offset --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=1;
use test;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- stop-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=3;
use test;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- stop-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
--- Remote --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- offset --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=1;
use test;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- stop-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=3;
use test;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
--- stop-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
--- Remote with 2 binlogs on command line --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- offset --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=1;
use test;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- stop-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET INSERT_ID=3;
use test;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
use test;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- stop-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
--- to-last-log --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1579609942;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
insert into t1 values(null, "e");
SET INSERT_ID=6;
SET TIMESTAMP=1579609943;
insert into t1 values(null, "f");
--- end of test --
drop table t1;

View file

@ -15,7 +15,7 @@ col2 varchar(30) not null,
col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int);
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
insert into t1 values (2,4,3,5,"PENDING",1,7);
alter table t1
add column col4_5 varchar(20) not null after col4,

View file

@ -6,33 +6,33 @@ attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
SELECT pk1 FROM t1;
SELECT pk1 FROM t1 ORDER BY pk1;
pk1
9410
9411
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
9410 9412 NULL 9412
9411 9413 17 9413
SELECT t1.* FROM t1;
SELECT t1.* FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
9410 9412 NULL 9412
9411 9413 17 9413
UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
9410 1 NULL 9412
9411 9413 17 9413
UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
2 1 NULL 9412
9411 9413 17 9413
UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
9412 9413 17 9413
3 1 NULL 9412
9412 9413 17 9413
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1 attr2 attr3
@ -115,13 +115,17 @@ SELECT * FROM t1;
id id2
1234 7890
DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
SELECT * FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
SELECT * FROM t1 ORDER BY id;
id id2
3454 7890
3456 7890
3456 7890
3456 7890
DELETE FROM t1 WHERE id = 3456;
SELECT * FROM t1 ORDER BY id;
id id2
3454 7890
DROP TABLE t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,

View file

@ -1,25 +1,30 @@
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
insert into t1 values (1,'one'), (2,'two');
select * from t1;
select * from t1 order by x;
x y
2 two
1 one
select * from t1;
2 two
select * from t1 order by x;
x y
2 two
1 one
2 two
start transaction;
insert into t1 values (3,'three');
start transaction;
select * from t1;
select * from t1 order by x;
x y
2 two
1 one
commit;
select * from t1;
x y
2 two
3 three
start transaction;
select * from t1 order by x;
x y
1 one
2 two
commit;
select * from t1 order by x;
x y
1 one
2 two
3 three
commit;

View file

@ -870,7 +870,7 @@ def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1217 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63

View file

@ -870,7 +870,7 @@ def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1217 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63

View file

@ -871,7 +871,7 @@ def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1217 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63

View file

@ -913,7 +913,7 @@ def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1217 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
@ -2106,7 +2106,7 @@ def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1217 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63

View file

@ -870,7 +870,7 @@ def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1217 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63

View file

@ -138,6 +138,13 @@ insert into t1(b)values(5);
insert into t1(b)values(6);
insert into t1(b)values(7);
select * from t1 order by b;
alter table t1 modify b mediumint;
select * from t1 order by b;
create table t2 (a int);
insert t2 values (1),(2);
alter table t2 add b int auto_increment primary key;
select * from t2;
drop table t2;
delete from t1 where a=0;
update t1 set a=0 where b=5;
select * from t1 order by b;

View file

@ -48,6 +48,8 @@ flush privileges;
#connect (con1,localhost,test,gambling2,"");
#show tables;
connect (con1,localhost,test,gambling2,mysql);
--error 1105
set password='gambling3';
set password=old_password('gambling3');
show tables;
connect (con1,localhost,test,gambling3,test);

View file

@ -0,0 +1,156 @@
# Test for the new options --start-datetime, stop-datetime,
# and a few others.
--disable_warnings
drop table if exists t1;
--enable_warnings
reset master;
# We need this for getting fixed timestamps inside of this test.
# I use a date in the future to keep a growing timestamp along the
# binlog (including the Start_log_event). This test will work
# unchanged everywhere, because mysql-test-run has fixed TZ, which it
# exports (so mysqlbinlog has same fixed TZ).
set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
set timestamp=@a;
create table t1 (a int auto_increment not null primary key, b char(3));
insert into t1 values(null, "a");
insert into t1 values(null, "b");
set timestamp=@a+2;
insert into t1 values(null, "c");
set timestamp=@a+4;
insert into t1 values(null, "d");
insert into t1 values(null, "e");
flush logs;
set timestamp=@a+1; # this could happen on a slave
insert into t1 values(null, "f");
# delimiters are for easier debugging in future
--disable_query_log
select "--- Local --" as "";
--enable_query_log
#
# We should use --short-form everywhere because in other case output will
# be time dependent (the Start events). Better than nothing.
#
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- offset --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=497 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=497 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- stop-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log
select "--- Local with 2 binlogs on command line --" as "";
--enable_query_log
# This is to verify that some options apply only to first, or last binlog
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- offset --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=497 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=32 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- stop-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log
select "--- Remote --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- offset --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=497 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=497 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- Remote with 2 binlogs on command line --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- offset --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=497 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=32 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- to-last-log --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001
# clean up
--disable_query_log
select "--- end of test --" as "";
--enable_query_log
drop table t1;

View file

@ -29,7 +29,7 @@ col2 varchar(30) not null,
col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int);
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
insert into t1 values (2,4,3,5,"PENDING",1,7);
alter table t1
add column col4_5 varchar(20) not null after col4,

View file

@ -21,19 +21,19 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
SELECT pk1 FROM t1;
SELECT * FROM t1;
SELECT t1.* FROM t1;
SELECT pk1 FROM t1 ORDER BY pk1;
SELECT * FROM t1 ORDER BY pk1;
SELECT t1.* FROM t1 ORDER BY pk1;
# Update on record by primary key
UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
# Update primary key
UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1;
SELECT * FROM t1 ORDER BY pk1;
# Delete the record
DELETE FROM t1;
@ -85,9 +85,10 @@ UPDATE t1 SET id=1234 WHERE id2=7890;
SELECT * FROM t1;
DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
SELECT * FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
SELECT * FROM t1 ORDER BY id;
DELETE FROM t1 WHERE id = 3456;
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1;

View file

@ -19,20 +19,23 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
connection con1;
create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
insert into t1 values (1,'one'), (2,'two');
select * from t1;
select * from t1 order by x;
connection con2;
select * from t1;
select * from t1 order by x;
connection con1;
start transaction; insert into t1 values (3,'three');
start transaction;
insert into t1 values (3,'three');
select * from t1 order by x;
connection con2;
start transaction; select * from t1;
start transaction;
select * from t1 order by x;
connection con1;
commit;
connection con2;
select * from t1;
select * from t1 order by x;
commit;

View file

@ -8,8 +8,7 @@
# The slave is started with max_binlog_size=16384 bytes,
# to force many rotations (approximately 30 rotations)
# If the master or slave does not support InnoDB, this test will pass
source include/have_innodb.inc;
source include/master-slave.inc;
connection slave;
stop slave;

View file

@ -17,7 +17,8 @@
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir)
INCLUDES = @MT_INCLUDES@ \
@ZLIB_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir)
pkglib_LIBRARIES = libmysys.a
LDADD = libmysys.a ../dbug/libdbug.a \
../strings/libmystrings.a

View file

@ -461,17 +461,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
else
finfo.mystat= NULL;
/*
If the directory is the root directory of the drive, Windows sometimes
creates hidden or system files there (like RECYCLER); do not show
them. We would need to see how this can be achieved with a Borland
compiler.
*/
#ifndef __BORLANDC__
if (attrib & (_A_HIDDEN | _A_SYSTEM))
continue;
#endif
if (push_dynamic(dir_entries_storage, (gptr)&finfo))
goto error;

View file

@ -23,6 +23,7 @@ ndbapi/NdbReceiver.hpp \
ndbapi/NdbResultSet.hpp \
ndbapi/NdbScanFilter.hpp \
ndbapi/NdbScanOperation.hpp \
ndbapi/NdbIndexScanOperation.hpp \
ndbapi/ndberror.h
mgmapiinclude_HEADERS = \

View file

@ -762,7 +762,7 @@ BitmaskPOD<size>::overlaps(BitmaskPOD<size> that)
template <unsigned size>
class Bitmask : public BitmaskPOD<size> {
public:
Bitmask() { clear();}
Bitmask() { this->clear();}
};
#endif

View file

@ -261,9 +261,9 @@ directory(Uint32 sz){
ConfigValuesFactory::ConfigValuesFactory(Uint32 keys, Uint32 data){
m_sectionCounter = (1 << KP_SECTION_SHIFT);
m_freeKeys = directory(keys);
m_freeData = data;
m_freeData = (data + 7) & ~7;
m_currentSection = 0;
m_cfg = create(m_freeKeys, data);
m_cfg = create(m_freeKeys, m_freeData);
}
ConfigValuesFactory::ConfigValuesFactory(ConfigValues * cfg){
@ -316,7 +316,8 @@ ConfigValuesFactory::expand(Uint32 fk, Uint32 fs){
m_freeKeys = (m_freeKeys >= fk ? m_cfg->m_size : fk + m_cfg->m_size);
m_freeData = (m_freeData >= fs ? m_cfg->m_dataSize : fs + m_cfg->m_dataSize);
m_freeKeys = directory(m_freeKeys);
m_freeData = (m_freeData + 7) & ~7;
ConfigValues * m_tmp = m_cfg;
m_cfg = create(m_freeKeys, m_freeData);
put(* m_tmp);
@ -333,6 +334,7 @@ ConfigValuesFactory::shrink(){
m_freeKeys = m_cfg->m_size - m_freeKeys;
m_freeData = m_cfg->m_dataSize - m_freeData;
m_freeKeys = directory(m_freeKeys);
m_freeData = (m_freeData + 7) & ~7;
ConfigValues * m_tmp = m_cfg;
m_cfg = create(m_freeKeys, m_freeData);

View file

@ -218,6 +218,7 @@ ndbout << "Ptr: " << ptr.p->word32 << " \tIndex: " << tmp_string << " \tValue: "
#define ZREL_FRAG 6
#define ZREL_DIR 7
#define ZREPORT_MEMORY_USAGE 8
#define ZLCP_OP_WRITE_RT_BREAK 9
/* ------------------------------------------------------------------------- */
/* ERROR CODES */
@ -1190,6 +1191,7 @@ private:
void zpagesize_error(const char* where);
void reportMemoryUsage(Signal* signal, int gth);
void lcp_write_op_to_undolog(Signal* signal);
// Initialisation

View file

@ -46,13 +46,17 @@ Dbacc::remainingUndoPages(){
ndbrequire(HeadPage>=TailPage);
Uint32 UsedPages = HeadPage - TailPage;
Uint32 Remaining = cundopagesize - UsedPages;
Int32 Remaining = cundopagesize - UsedPages;
// There can not be more than cundopagesize remaining
ndbrequire(Remaining<=cundopagesize);
if (Remaining <= 0){
// No more undolog, crash node
progError(__LINE__,
ERR_NO_MORE_UNDOLOG,
"There are more than 1Mbyte undolog writes outstanding");
}
return Remaining;
}//Dbacc::remainingUndoPages()
}
void
Dbacc::updateLastUndoPageIdWritten(Signal* signal, Uint32 aNewValue){
@ -193,6 +197,17 @@ void Dbacc::execCONTINUEB(Signal* signal)
return;
}
case ZLCP_OP_WRITE_RT_BREAK:
{
operationRecPtr.i= signal->theData[1];
fragrecptr.i= signal->theData[2];
lcpConnectptr.i= signal->theData[3];
ptrCheckGuard(operationRecPtr, coprecsize, operationrec);
ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
ptrCheckGuard(lcpConnectptr, clcpConnectsize, lcpConnectrec);
lcp_write_op_to_undolog(signal);
return;
}
default:
ndbrequire(false);
break;
@ -7697,32 +7712,70 @@ void Dbacc::execACC_LCPREQ(Signal* signal)
fragrecptr.p->lcpMaxOverDirIndex = fragrecptr.p->lastOverIndex;
fragrecptr.p->createLcp = ZTRUE;
operationRecPtr.i = fragrecptr.p->lockOwnersList;
while (operationRecPtr.i != RNIL) {
jam();
ptrCheckGuard(operationRecPtr, coprecsize, operationrec);
lcp_write_op_to_undolog(signal);
}
if ((operationRecPtr.p->operation == ZINSERT) ||
(operationRecPtr.p->elementIsDisappeared == ZTRUE)){
void
Dbacc::lcp_write_op_to_undolog(Signal* signal)
{
bool delay_continueb= false;
Uint32 i, j;
for (i= 0; i < 16; i++) {
jam();
if (remainingUndoPages() <= ZMIN_UNDO_PAGES_AT_COMMIT) {
jam();
delay_continueb= true;
break;
}
for (j= 0; j < 32; j++) {
if (operationRecPtr.i == RNIL) {
jam();
break;
}
jam();
ptrCheckGuard(operationRecPtr, coprecsize, operationrec);
if ((operationRecPtr.p->operation == ZINSERT) ||
(operationRecPtr.p->elementIsDisappeared == ZTRUE)){
/*******************************************************************
* Only log inserts and elements that are marked as dissapeared.
* All other operations update the element header and that is handled
* when pages are written to disk
********************************************************************/
undopageptr.i = (cundoposition>>ZUNDOPAGEINDEXBITS) & (cundopagesize-1);
ptrAss(undopageptr, undopage);
theadundoindex = cundoposition & ZUNDOPAGEINDEX_MASK;
tundoindex = theadundoindex + ZUNDOHEADSIZE;
undopageptr.i = (cundoposition>>ZUNDOPAGEINDEXBITS) & (cundopagesize-1);
ptrAss(undopageptr, undopage);
theadundoindex = cundoposition & ZUNDOPAGEINDEX_MASK;
tundoindex = theadundoindex + ZUNDOHEADSIZE;
writeUndoOpInfo(signal);/* THE INFORMATION ABOUT ELEMENT HEADER, STORED*/
/* IN OP REC, IS WRITTEN AT UNDO PAGES */
cundoElemIndex = 0;/* DEFAULT VALUE USED BY WRITE_UNDO_HEADER SUBROTINE */
writeUndoHeader(signal, RNIL, UndoHeader::ZOP_INFO); /* WRITE THE HEAD OF THE UNDO ELEMENT */
checkUndoPages(signal); /* SEND UNDO PAGE TO DISK WHEN A GROUP OF */
writeUndoOpInfo(signal);/* THE INFORMATION ABOUT ELEMENT HEADER, STORED*/
/* IN OP REC, IS WRITTEN AT UNDO PAGES */
cundoElemIndex = 0;/* DEFAULT VALUE USED BY WRITE_UNDO_HEADER SUBROTINE */
writeUndoHeader(signal, RNIL, UndoHeader::ZOP_INFO); /* WRITE THE HEAD OF THE UNDO ELEMENT */
checkUndoPages(signal); /* SEND UNDO PAGE TO DISK WHEN A GROUP OF */
/* UNDO PAGES,CURRENTLY 8, IS FILLED */
}//if
operationRecPtr.i = operationRecPtr.p->nextLockOwnerOp;
}//while
}
operationRecPtr.i = operationRecPtr.p->nextLockOwnerOp;
}
if (operationRecPtr.i == RNIL) {
jam();
break;
}
}
if (operationRecPtr.i != RNIL) {
jam();
signal->theData[0]= ZLCP_OP_WRITE_RT_BREAK;
signal->theData[1]= operationRecPtr.i;
signal->theData[2]= fragrecptr.i;
signal->theData[3]= lcpConnectptr.i;
if (delay_continueb) {
jam();
sendSignalWithDelay(cownBlockref, GSN_CONTINUEB, signal, 10, 4);
} else {
jam();
sendSignal(cownBlockref, GSN_CONTINUEB, signal, 4, JBB);
}
return;
}
signal->theData[0] = fragrecptr.p->lcpLqhPtr;
sendSignal(lcpConnectptr.p->lcpUserblockref, GSN_ACC_LCPSTARTED,
@ -7735,8 +7788,7 @@ void Dbacc::execACC_LCPREQ(Signal* signal)
signal->theData[0] = lcpConnectptr.i;
signal->theData[1] = fragrecptr.i;
sendSignal(cownBlockref, GSN_ACC_SAVE_PAGES, signal, 2, JBB);
return;
}//Dbacc::execACC_LCPREQ()
}
/* ******************--------------------------------------------------------------- */
/* ACC_SAVE_PAGES A GROUP OF PAGES IS ALLOCATED. THE PAGES AND OVERFLOW */
@ -8595,12 +8647,6 @@ void Dbacc::checkUndoPages(Signal* signal)
* RECORDS IN
*/
Uint16 nextUndoPageId = tundoPageId + 1;
if (nextUndoPageId > (clastUndoPageIdWritten + cundopagesize)){
// No more undolog, crash node
progError(__LINE__,
ERR_NO_MORE_UNDOLOG,
"There are more than 1Mbyte undolog writes outstanding");
}
updateUndoPositionPage(signal, nextUndoPageId << ZUNDOPAGEINDEXBITS);
if ((tundoPageId & (ZWRITE_UNDOPAGESIZE - 1)) == (ZWRITE_UNDOPAGESIZE - 1)) {

View file

@ -998,7 +998,12 @@ public:
* It will receive max 16 tuples in each request
*/
struct ScanFragRec {
ScanFragRec(){}
ScanFragRec(){
stopFragTimer();
lqhBlockref = 0;
scanFragState = IDLE;
scanRec = RNIL;
}
/**
* ScanFragState
* WAIT_GET_PRIMCONF : Waiting for DIGETPRIMCONF when starting a new

View file

@ -187,7 +187,7 @@ NDB_MAIN(mgmsrv){
"Please check if the port is already used,\n"
"(perhaps a mgmtsrvr is already running),\n"
"and if you are executing on the correct computer",
glob.interface_name, glob.port);
(glob.interface_name ? glob.interface_name : "*"), glob.port);
goto error_end;
}
free(glob.interface_name);

View file

@ -1452,7 +1452,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
alterTable(&tSignal, ptr)
: createTable(&tSignal, ptr);
if (haveAutoIncrement) {
if (!alter && haveAutoIncrement) {
// if (!ndb.setAutoIncrementValue(impl.m_internalName.c_str(), autoIncrementValue)) {
if (!ndb.setAutoIncrementValue(impl.m_externalName.c_str(), autoIncrementValue)) {
m_error.code = 4336;

View file

@ -589,13 +589,14 @@ Ndb::releaseSignal(NdbApiSignal* aSignal)
#if defined VM_TRACE
// Check that signal is not null
assert(aSignal != NULL);
#if 0
// Check that signal is not already in list
NdbApiSignal* tmp = theSignalIdleList;
while (tmp != NULL){
assert(tmp != aSignal);
tmp = tmp->next();
}
#endif
#endif
creleaseSignals++;
aSignal->next(theSignalIdleList);

View file

@ -34,7 +34,8 @@ public:
int records,
int batch = 512,
bool allowConstraintViolation = true,
int doSleep = 0);
int doSleep = 0,
bool oneTrans = false);
int scanReadRecords(Ndb*,
int records,
int abort = 0,

View file

@ -29,9 +29,18 @@
* delete should be visible to same transaction
*
*/
int runLoadTable2(NDBT_Context* ctx, NDBT_Step* step)
{
int records = ctx->getNumRecords();
HugoTransactions hugoTrans(*ctx->getTab());
if (hugoTrans.loadTable(GETNDB(step), records, 512, false, 0, true) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
}
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
int runLoadTable(NDBT_Context* ctx, NDBT_Step* step)
{
int records = ctx->getNumRecords();
HugoTransactions hugoTrans(*ctx->getTab());
if (hugoTrans.loadTable(GETNDB(step), records) != 0){
@ -1255,6 +1264,11 @@ TESTCASE("MassiveRollback2",
INITIALIZER(runMassiveRollback2);
FINALIZER(runClearTable2);
}
TESTCASE("MassiveTransaction",
"Test very large insert transaction"){
INITIALIZER(runLoadTable2);
FINALIZER(runClearTable2);
}
NDBT_TESTSUITE_END(testBasic);
int main(int argc, const char** argv){

View file

@ -693,12 +693,14 @@ HugoTransactions::loadTable(Ndb* pNdb,
int records,
int batch,
bool allowConstraintViolation,
int doSleep){
int doSleep,
bool oneTrans){
int check;
int retryAttempt = 0;
int retryMax = 5;
NdbConnection *pTrans;
NdbOperation *pOp;
bool first_batch = true;
const int org = batch;
const int cols = tab.getNoOfColumns();
@ -707,7 +709,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
batch = (batch * 256); // -> 512 -> 65536k per commit
batch = batch/bytes; //
batch = batch == 0 ? 1 : batch;
if(batch != org){
g_info << "batch = " << org << " rowsize = " << bytes
<< " -> rows/commit = " << batch << endl;
@ -715,7 +717,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
g_info << "|- Inserting records..." << endl;
for (int c=0 ; c<records ; ){
bool closeTrans;
if (retryAttempt >= retryMax){
g_info << "Record " << c << " could not be inserted, has retried "
<< retryAttempt << " times " << endl;
@ -726,19 +728,22 @@ HugoTransactions::loadTable(Ndb* pNdb,
if (doSleep > 0)
NdbSleep_MilliSleep(doSleep);
pTrans = pNdb->startTransaction();
if (first_batch || !oneTrans) {
first_batch = false;
pTrans = pNdb->startTransaction();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (pTrans == NULL) {
const NdbError err = pNdb->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
if (err.status == NdbError::TemporaryError){
ERR(err);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
return NDBT_FAILED;
}
ERR(err);
return NDBT_FAILED;
}
for(int b = 0; b < batch && c+b<records; b++){
@ -768,7 +773,13 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
// Execute the transaction and insert the record
check = pTrans->execute( Commit );
if (!oneTrans || (c + batch) >= records) {
closeTrans = true;
check = pTrans->execute( Commit );
} else {
closeTrans = false;
check = pTrans->execute( NoCommit );
}
if(check == -1 ) {
const NdbError err = pTrans->getNdbError();
pNdb->closeTransaction(pTrans);
@ -811,8 +822,10 @@ HugoTransactions::loadTable(Ndb* pNdb,
break;
}
}
else{
pNdb->closeTransaction(pTrans);
else{
if (closeTrans) {
pNdb->closeTransaction(pTrans);
}
}
// Step to next record

View file

@ -35,6 +35,16 @@ static uchar internal_format_positions[]=
static char time_separator=':';
static ulong const days_at_timestart=719528; /* daynr at 1970.01.01 */
uchar days_in_month[]= {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};
/*
Offset of system time zone from UTC in seconds used to speed up
work of my_system_gmt_sec() function.
*/
static long my_time_zone=0;
/*
Convert a timestamp string to a MYSQL_TIME value.
@ -559,3 +569,148 @@ fractional:
}
/*
Prepare offset of system time zone from UTC for my_system_gmt_sec() func.
SYNOPSIS
init_time()
*/
void init_time(void)
{
time_t seconds;
struct tm *l_time,tm_tmp;
MYSQL_TIME my_time;
bool not_used;
seconds= (time_t) time((time_t*) 0);
localtime_r(&seconds,&tm_tmp);
l_time= &tm_tmp;
my_time_zone= 3600; /* Comp. for -3600 in my_gmt_sec */
my_time.year= (uint) l_time->tm_year+1900;
my_time.month= (uint) l_time->tm_mon+1;
my_time.day= (uint) l_time->tm_mday;
my_time.hour= (uint) l_time->tm_hour;
my_time.minute= (uint) l_time->tm_min;
my_time.second= (uint) l_time->tm_sec;
my_system_gmt_sec(&my_time, &my_time_zone, &not_used); /* Init my_time_zone */
}
/* Calculate nr of day since year 0 in new date-system (from 1615) */
long calc_daynr(uint year,uint month,uint day)
{
long delsum;
int temp;
DBUG_ENTER("calc_daynr");
if (year == 0 && month == 0 && day == 0)
DBUG_RETURN(0); /* Skip errors */
if (year < 200)
{
if ((year=year+1900) < 1900+YY_PART_YEAR)
year+=100;
}
delsum= (long) (365L * year+ 31*(month-1) +day);
if (month <= 2)
year--;
else
delsum-= (long) (month*4+23)/10;
temp=(int) ((year/100+1)*3)/4;
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
year+(month <= 2),month,day,delsum+year/4-temp));
DBUG_RETURN(delsum+(int) year/4-temp);
} /* calc_daynr */
/*
Convert time in MYSQL_TIME representation in system time zone to its
my_time_t form (number of seconds in UTC since begginning of Unix Epoch).
SYNOPSIS
my_system_gmt_sec()
t - time value to be converted
my_timezone - pointer to long where offset of system time zone
from UTC will be stored for caching
in_dst_time_gap - set to true if time falls into spring time-gap
NOTES
The idea is to cache the time zone offset from UTC (including daylight
saving time) for the next call to make things faster. But currently we
just calculate this offset during startup (by calling init_time()
function) and use it all the time.
Time value provided should be legal time value (e.g. '2003-01-01 25:00:00'
is not allowed).
RETURN VALUE
Time in UTC seconds since Unix Epoch representation.
*/
my_time_t
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
{
uint loop;
time_t tmp;
struct tm *l_time,tm_tmp;
long diff, current_timezone;
/*
Calculate the gmt time based on current time and timezone
The -1 on the end is to ensure that if have a date that exists twice
(like 2002-10-27 02:00:0 MET), we will find the initial date.
By doing -3600 we will have to call localtime_r() several times, but
I couldn't come up with a better way to get a repeatable result :(
We can't use mktime() as it's buggy on many platforms and not thread safe.
*/
tmp=(time_t) (((calc_daynr((uint) t->year,(uint) t->month,(uint) t->day) -
(long) days_at_timestart)*86400L + (long) t->hour*3600L +
(long) (t->minute*60 + t->second)) + (time_t) my_time_zone -
3600);
current_timezone= my_time_zone;
localtime_r(&tmp,&tm_tmp);
l_time=&tm_tmp;
for (loop=0;
loop < 2 &&
(t->hour != (uint) l_time->tm_hour ||
t->minute != (uint) l_time->tm_min);
loop++)
{ /* One check should be enough ? */
/* Get difference in days */
int days= t->day - l_time->tm_mday;
if (days < -1)
days= 1; // Month has wrapped
else if (days > 1)
days= -1;
diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour)) +
(long) (60*((int) t->minute - (int) l_time->tm_min)));
current_timezone+= diff+3600; // Compensate for -3600 above
tmp+= (time_t) diff;
localtime_r(&tmp,&tm_tmp);
l_time=&tm_tmp;
}
/*
Fix that if we are in the not existing daylight saving time hour
we move the start of the next real hour
*/
if (loop == 2 && t->hour != (uint) l_time->tm_hour)
{
int days= t->day - l_time->tm_mday;
if (days < -1)
days=1; // Month has wrapped
else if (days > 1)
days= -1;
diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour))+
(long) (60*((int) t->minute - (int) l_time->tm_min)));
if (diff == 3600)
tmp+=3600 - t->minute*60 - t->second; // Move to next hour
else if (diff == -3600)
tmp-=t->minute*60 + t->second; // Move to previous hour
*in_dst_time_gap= 1;
}
*my_timezone= current_timezone;
return (my_time_t) tmp;
} /* my_system_gmt_sec */

View file

@ -19,7 +19,7 @@
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
INCLUDES = @MT_INCLUDES@ \
INCLUDES = @MT_INCLUDES@ @ZLIB_INCLUDES@ \
@bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \
-I$(top_srcdir)/include -I$(top_srcdir)/regex \
-I$(srcdir) $(openssl_includes)
@ -30,14 +30,15 @@ noinst_PROGRAMS = gen_lex_hash
bin_PROGRAMS = mysql_tzinfo_to_sql
gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@
LDADD = @isam_libs@ \
../myisam/libmyisam.a \
../myisammrg/libmyisammrg.a \
../heap/libheap.a \
../vio/libvio.a \
../mysys/libmysys.a \
../dbug/libdbug.a \
../regex/libregex.a \
../strings/libmystrings.a
@ZLIB_LIBS@ \
$(top_builddir)/myisam/libmyisam.a \
$(top_builddir)/myisammrg/libmyisammrg.a \
$(top_builddir)/heap/libheap.a \
$(top_builddir)/vio/libvio.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/regex/libregex.a \
$(top_builddir)/strings/libmystrings.a
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \
@ -95,7 +96,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
mysql_tzinfo_to_sql_SOURCES = mysql_tzinfo_to_sql.cc
mysql_tzinfo_to_sql_LDADD = $(LDADD) $(CXXLDFLAGS)
mysql_tzinfo_to_sql_LDADD = @MYSQLD_EXTRA_LDFLAGS@ $(LDADD) $(CXXLDFLAGS)
DEFS = -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \

View file

@ -2877,7 +2877,8 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
:Field_str(ptr_arg, 19, (uchar*) 0,0,
unireg_check_arg, field_name_arg, table_arg, cs)
{
flags|=ZEROFILL_FLAG; /* 4.0 MYD compatibility */
/* For 4.0 MYD and 4.0 InnoDB compatibility */
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
if (table && !table->timestamp_field &&
unireg_check != NONE)
{

View file

@ -38,7 +38,7 @@ class Field
public:
static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); }
static void operator delete(void *ptr_arg, size_t size) {
#ifdef PEDANTIC_SAFEMALLOC
#ifdef SAFEMALLOC
bfill(ptr_arg, size, 0x8F);
#endif
}

View file

@ -117,6 +117,7 @@ my_bool innobase_log_archive = FALSE;/* unused */
my_bool innobase_use_native_aio = FALSE;
my_bool innobase_fast_shutdown = TRUE;
my_bool innobase_file_per_table = FALSE;
my_bool innobase_locks_unsafe_for_binlog = FALSE;
static char *internal_innobase_data_file_path = NULL;
@ -908,6 +909,7 @@ innobase_init(void)
srv_fast_shutdown = (ibool) innobase_fast_shutdown;
srv_file_per_table = (ibool) innobase_file_per_table;
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
srv_max_n_open_files = (ulint) innobase_open_files;
@ -3640,11 +3642,19 @@ ha_innobase::create(
}
if (current_thd->query != NULL) {
error = row_table_add_foreign_constraints(trx,
current_thd->query, norm_name);
error = convert_error_code_to_mysql(error, NULL);
LEX_STRING q;
if (thd->convert_string(&q, system_charset_info,
current_thd->query,
current_thd->query_length,
current_thd->charset())) {
error = HA_ERR_OUT_OF_MEM;
} else {
error = row_table_add_foreign_constraints(trx,
q.str, norm_name);
error = convert_error_code_to_mysql(error, NULL);
}
if (error) {
innobase_commit_low(trx);

View file

@ -189,7 +189,7 @@ extern char *innobase_unix_file_flush_method;
/* The following variables have to be my_bool for SHOW VARIABLES to work */
extern my_bool innobase_log_archive,
innobase_use_native_aio, innobase_fast_shutdown,
innobase_file_per_table;
innobase_file_per_table, innobase_locks_unsafe_for_binlog;
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
}

View file

@ -333,11 +333,11 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
- TODO allocate blob part aligned buffers
*/
NdbBlob::ActiveHook get_ndb_blobs_value;
NdbBlob::ActiveHook g_get_ndb_blobs_value;
int get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg)
int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg)
{
DBUG_ENTER("get_ndb_blobs_value [callback]");
DBUG_ENTER("g_get_ndb_blobs_value");
if (ndb_blob->blobsNextBlob() != NULL)
DBUG_RETURN(0);
ha_ndbcluster *ha= (ha_ndbcluster *)arg;
@ -428,7 +428,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
{
// Set callback
void *arg= (void *)this;
DBUG_RETURN(ndb_blob->setActiveHook(::get_ndb_blobs_value, arg) != 0);
DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0);
}
DBUG_RETURN(1);
}

View file

@ -184,7 +184,7 @@ class ha_ndbcluster: public handler
uint fieldnr, const byte* field_ptr);
int set_ndb_value(NdbOperation*, Field *field, uint fieldnr);
int get_ndb_value(NdbOperation*, Field *field, uint fieldnr);
friend int ::get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
int get_ndb_blobs_value(NdbBlob *last_ndb_blob);
int set_primary_key(NdbOperation *op, const byte *key);
int set_primary_key(NdbOperation *op);

View file

@ -828,7 +828,7 @@ extern Gt_creator gt_creator;
extern Lt_creator lt_creator;
extern Ge_creator ge_creator;
extern Le_creator le_creator;
extern uchar *days_in_month;
extern uchar days_in_month[];
extern char language[LIBLEN],reg_ext[FN_EXTLEN];
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
@ -994,12 +994,9 @@ void free_blobs(TABLE *table);
int set_zone(int nr,int min_zone,int max_zone);
ulong convert_period_to_month(ulong period);
ulong convert_month_to_period(ulong month);
long calc_daynr(uint year,uint month,uint day);
uint calc_days_in_year(uint year);
void get_date_from_daynr(long daynr,uint *year, uint *month,
uint *day);
void init_time(void);
my_time_t my_system_gmt_sec(const TIME *, long *current_timezone, bool *not_exist);
my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *not_exist);
bool str_to_time_with_warn(const char *str,uint length,TIME *l_time);
timestamp_type str_to_datetime_with_warn(const char *str, uint length,

View file

@ -3880,6 +3880,7 @@ enum options_mysqld
OPT_INNODB_FLUSH_METHOD,
OPT_INNODB_FAST_SHUTDOWN,
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION,
@ -4156,6 +4157,10 @@ Disable with --skip-bdb (will save memory).",
"Stores each InnoDB table to an .ibd file in the database dir.",
(gptr*) &innobase_file_per_table,
(gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_locks_unsafe_for_binlog", OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
"Force Innodb not to use next-key locking. Instead use only row-level locking",
(gptr*) &innobase_locks_unsafe_for_binlog,
(gptr*) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif /* End HAVE_INNOBASE_DB */
{"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection",
(gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC,
@ -5056,6 +5061,8 @@ struct show_var_st status_vars[]= {
{"Com_create_function", (char*) (com_stat+(uint) SQLCOM_CREATE_FUNCTION),SHOW_LONG},
{"Com_create_index", (char*) (com_stat+(uint) SQLCOM_CREATE_INDEX),SHOW_LONG},
{"Com_create_table", (char*) (com_stat+(uint) SQLCOM_CREATE_TABLE),SHOW_LONG},
{"Com_dealloc_sql", (char*) (com_stat+(uint)
SQLCOM_DEALLOCATE_PREPARE), SHOW_LONG},
{"Com_delete", (char*) (com_stat+(uint) SQLCOM_DELETE),SHOW_LONG},
{"Com_delete_multi", (char*) (com_stat+(uint) SQLCOM_DELETE_MULTI),SHOW_LONG},
{"Com_do", (char*) (com_stat+(uint) SQLCOM_DO),SHOW_LONG},
@ -5064,6 +5071,8 @@ struct show_var_st status_vars[]= {
{"Com_drop_index", (char*) (com_stat+(uint) SQLCOM_DROP_INDEX),SHOW_LONG},
{"Com_drop_table", (char*) (com_stat+(uint) SQLCOM_DROP_TABLE),SHOW_LONG},
{"Com_drop_user", (char*) (com_stat+(uint) SQLCOM_DROP_USER),SHOW_LONG},
{"Com_execute_sql", (char*) (com_stat+(uint) SQLCOM_EXECUTE),
SHOW_LONG},
{"Com_flush", (char*) (com_stat+(uint) SQLCOM_FLUSH),SHOW_LONG},
{"Com_grant", (char*) (com_stat+(uint) SQLCOM_GRANT),SHOW_LONG},
{"Com_ha_close", (char*) (com_stat+(uint) SQLCOM_HA_CLOSE),SHOW_LONG},
@ -5079,6 +5088,8 @@ struct show_var_st status_vars[]= {
{"Com_lock_tables", (char*) (com_stat+(uint) SQLCOM_LOCK_TABLES),SHOW_LONG},
{"Com_optimize", (char*) (com_stat+(uint) SQLCOM_OPTIMIZE),SHOW_LONG},
{"Com_preload_keys", (char*) (com_stat+(uint) SQLCOM_PRELOAD_KEYS),SHOW_LONG},
{"Com_prepare_sql", (char*) (com_stat+(uint) SQLCOM_PREPARE),
SHOW_LONG},
{"Com_purge", (char*) (com_stat+(uint) SQLCOM_PURGE),SHOW_LONG},
{"Com_purge_before_date", (char*) (com_stat+(uint) SQLCOM_PURGE_BEFORE),SHOW_LONG},
{"Com_rename_table", (char*) (com_stat+(uint) SQLCOM_RENAME_TABLE),SHOW_LONG},
@ -5125,12 +5136,6 @@ struct show_var_st status_vars[]= {
{"Com_unlock_tables", (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG},
{"Com_update", (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG},
{"Com_update_multi", (char*) (com_stat+(uint) SQLCOM_UPDATE_MULTI),SHOW_LONG},
{"Com_prepare_sql", (char*) (com_stat+(uint) SQLCOM_PREPARE),
SHOW_LONG},
{"Com_execute_sql", (char*) (com_stat+(uint) SQLCOM_EXECUTE),
SHOW_LONG},
{"Com_dealloc_sql", (char*) (com_stat+(uint)
SQLCOM_DEALLOCATE_PREPARE), SHOW_LONG},
{"Connections", (char*) &thread_id, SHOW_LONG_CONST},
{"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG},
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG},
@ -5141,6 +5146,7 @@ struct show_var_st status_vars[]= {
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_CONST},
{"Handler_commit", (char*) &ha_commit_count, SHOW_LONG},
{"Handler_delete", (char*) &ha_delete_count, SHOW_LONG},
{"Handler_discover", (char*) &ha_discover_count, SHOW_LONG},
{"Handler_read_first", (char*) &ha_read_first_count, SHOW_LONG},
{"Handler_read_key", (char*) &ha_read_key_count, SHOW_LONG},
{"Handler_read_next", (char*) &ha_read_next_count, SHOW_LONG},
@ -5150,13 +5156,12 @@ struct show_var_st status_vars[]= {
{"Handler_rollback", (char*) &ha_rollback_count, SHOW_LONG},
{"Handler_update", (char*) &ha_update_count, SHOW_LONG},
{"Handler_write", (char*) &ha_write_count, SHOW_LONG},
{"Handler_discover", (char*) &ha_discover_count, SHOW_LONG},
{"Key_blocks_not_flushed", (char*) &dflt_key_cache_var.global_blocks_changed,
SHOW_KEY_CACHE_LONG},
{"Key_blocks_used", (char*) &dflt_key_cache_var.blocks_used,
SHOW_KEY_CACHE_CONST_LONG},
{"Key_blocks_unused", (char*) &dflt_key_cache_var.blocks_unused,
SHOW_KEY_CACHE_CONST_LONG},
{"Key_blocks_used", (char*) &dflt_key_cache_var.blocks_used,
SHOW_KEY_CACHE_CONST_LONG},
{"Key_read_requests", (char*) &dflt_key_cache_var.global_cache_r_requests,
SHOW_KEY_CACHE_LONG},
{"Key_reads", (char*) &dflt_key_cache_var.global_cache_read,

View file

@ -611,8 +611,8 @@ struct show_var_st init_vars[]= {
#ifdef HAVE_BERKELEY_DB
{"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONG},
{"bdb_home", (char*) &berkeley_home, SHOW_CHAR_PTR},
{"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR},
{"bdb_log_buffer_size", (char*) &berkeley_log_buffer_size, SHOW_LONG},
{"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR},
{"bdb_max_lock", (char*) &berkeley_max_lock, SHOW_LONG},
{"bdb_shared_data", (char*) &berkeley_shared_data, SHOW_BOOL},
{"bdb_tmpdir", (char*) &berkeley_tmpdir, SHOW_CHAR_PTR},
@ -652,9 +652,9 @@ struct show_var_st init_vars[]= {
{"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE},
{"have_compress", (char*) &have_compress, SHOW_HAVE},
{"have_crypt", (char*) &have_crypt, SHOW_HAVE},
{"have_geometry", (char*) &have_geometry, SHOW_HAVE},
{"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE},
{"have_geometry", (char*) &have_geometry, SHOW_HAVE},
{"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
{"have_openssl", (char*) &have_openssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
@ -673,6 +673,7 @@ struct show_var_st init_vars[]= {
{"innodb_fast_shutdown", (char*) &innobase_fast_shutdown, SHOW_MY_BOOL},
{"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
{"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL},
{"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog, SHOW_MY_BOOL},
{"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT},
{"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
{"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
@ -2850,8 +2851,9 @@ int set_var_password::check(THD *thd)
if (!user->host.str)
user->host.str= (char*) thd->host_or_ip;
/* Returns 1 as the function sends error to client */
return check_change_password(thd, user->host.str, user->user.str) ? 1 : 0;
#else
return check_change_password(thd, user->host.str, user->user.str, password) ?
1 : 0;
#else
return 0;
#endif
}
@ -2860,8 +2862,8 @@ int set_var_password::update(THD *thd)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Returns 1 as the function sends error to client */
return (change_password(thd, user->host.str, user->user.str, password) ?
1 : 0);
return change_password(thd, user->host.str, user->user.str, password) ?
1 : 0;
#else
return 0;
#endif

View file

@ -1127,13 +1127,14 @@ bool acl_check_host(const char *host, const char *ip)
1 ERROR ; In this case the error is sent to the client.
*/
bool check_change_password(THD *thd, const char *host, const char *user)
bool check_change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
if (!initialized)
{
net_printf(thd,ER_OPTION_PREVENTS_STATEMENT,
"--skip-grant-tables"); /* purecov: inspected */
return(1); /* purecov: inspected */
"--skip-grant-tables");
return(1);
}
if (!thd->slave_thread &&
(strcmp(thd->user,user) ||
@ -1147,6 +1148,15 @@ bool check_change_password(THD *thd, const char *host, const char *user)
send_error(thd, ER_PASSWORD_ANONYMOUS_USER);
return(1);
}
uint len=strlen(new_password);
if (len != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
net_printf(thd, 0,
"Password hash should be a %d-digit hexadecimal number",
SCRAMBLED_PASSWORD_CHAR_LENGTH);
return -1;
}
return(0);
}
@ -1174,7 +1184,7 @@ bool change_password(THD *thd, const char *host, const char *user,
host,user,new_password));
DBUG_ASSERT(host != 0); // Ensured by parent
if (check_change_password(thd, host, user))
if (check_change_password(thd, host, user, new_password))
DBUG_RETURN(1);
VOID(pthread_mutex_lock(&acl_cache->lock));
@ -1433,7 +1443,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
if (combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
combo.password.length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
my_printf_error(ER_PASSWORD_NO_MATCH,
my_printf_error(ER_UNKNOWN_ERROR,
"Password hash should be a %d-digit hexadecimal number",
MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
DBUG_RETURN(-1);

View file

@ -142,7 +142,8 @@ ulong acl_get(const char *host, const char *ip,
int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd,
uint passwd_len);
bool acl_check_host(const char *host, const char *ip);
bool check_change_password(THD *thd, const char *host, const char *user);
bool check_change_password(THD *thd, const char *host, const char *user,
char *password);
bool change_password(THD *thd, const char *host, const char *user,
char *password);
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,

View file

@ -2587,7 +2587,7 @@ fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
Field *rfield= field->field;
TABLE *table= rfield->table;
if (rfield == table->next_number_field)
table->auto_increment_field_not_null= true;
table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
DBUG_RETURN(1);
}
@ -2608,7 +2608,7 @@ fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
value=v++;
TABLE *table= field->table;
if (field == table->next_number_field)
table->auto_increment_field_not_null= true;
table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(field, 0) < 0) && !ignore_errors)
DBUG_RETURN(1);
}

View file

@ -320,10 +320,17 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
{
if (!strncmp(buf,"default-character-set", (pos-buf)))
{
/*
Try character set name, and if it fails
try collation name, probably it's an old
4.1.0 db.opt file, which didn't have
separate default-character-set and
default-collation commands.
*/
if (!(create->default_table_charset=
get_charset_by_csname(pos+1,
MY_CS_PRIMARY,
MYF(0))))
get_charset_by_csname(pos+1, MY_CS_PRIMARY, MYF(0))) &&
!(create->default_table_charset=
get_charset_by_name(pos+1, MYF(0))))
{
sql_print_error("Error while loading database options: '%s':",path);
sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);

View file

@ -19,9 +19,9 @@
#pragma interface /* gcc class implementation */
#endif
/* mysql standard class memoryallocator */
/* mysql standard class memory allocator */
#ifdef PEDANTIC_SAFEMALLOC
#ifdef SAFEMALLOC
#define TRASH(XX,YY) bfill((XX), (YY), 0x8F)
#else
#define TRASH(XX,YY) /* no-op */

View file

@ -3271,13 +3271,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
ha_rows *deleted)
{
int error;
Copy_field *copy,*copy_end;
Copy_field *copy,*copy_end, *next_field;
ulong found_count,delete_count;
THD *thd= current_thd;
uint length;
SORT_FIELD *sortorder;
READ_RECORD info;
Field *next_field;
TABLE_LIST tables;
List<Item> fields;
List<Item> all_fields;
@ -3298,7 +3297,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
{
def=it++;
if (def->field)
{
if (*ptr == to->next_number_field)
next_field= copy_end;
(copy_end++)->set(*ptr,def->field,0);
}
}
found_count=delete_count=0;
@ -3334,7 +3338,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
error= 1;
goto err;
}
/* Handler must be told explicitly to retrieve all columns, because
this function does not set field->query_id in the columns to the
current query id */
@ -3343,7 +3347,6 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (handle_duplicates == DUP_IGNORE ||
handle_duplicates == DUP_REPLACE)
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
next_field=to->next_number_field;
thd->row_count= 0;
while (!(error=info.read_record(&info)))
{
@ -3354,10 +3357,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
break;
}
thd->row_count++;
if (next_field)
next_field->reset();
if (to->next_number_field)
to->next_number_field->reset();
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
{
if (copy_ptr == next_field)
to->auto_increment_field_not_null= TRUE;
copy_ptr->do_copy(copy_ptr);
}
if ((error=to->file->write_row((byte*) to->record[0])))
{
if ((handle_duplicates != DUP_IGNORE &&

View file

@ -20,166 +20,9 @@
#include "mysql_priv.h"
#include <m_ctype.h>
static ulong const days_at_timestart=719528; /* daynr at 1970.01.01 */
uchar *days_in_month= (uchar*) "\037\034\037\036\037\036\037\037\036\037\036\037";
/*
Offset of system time zone from UTC in seconds used to speed up
work of my_system_gmt_sec() function.
*/
static long my_time_zone=0;
/*
Prepare offset of system time zone from UTC for my_system_gmt_sec() func.
SYNOPSIS
init_time()
*/
void init_time(void)
{
time_t seconds;
struct tm *l_time,tm_tmp;;
TIME my_time;
bool not_used;
seconds= (time_t) time((time_t*) 0);
localtime_r(&seconds,&tm_tmp);
l_time= &tm_tmp;
my_time_zone= 3600; /* Comp. for -3600 in my_gmt_sec */
my_time.year= (uint) l_time->tm_year+1900;
my_time.month= (uint) l_time->tm_mon+1;
my_time.day= (uint) l_time->tm_mday;
my_time.hour= (uint) l_time->tm_hour;
my_time.minute= (uint) l_time->tm_min;
my_time.second= (uint) l_time->tm_sec;
my_system_gmt_sec(&my_time, &my_time_zone, &not_used); /* Init my_time_zone */
}
/*
Convert time in TIME representation in system time zone to its
my_time_t form (number of seconds in UTC since begginning of Unix Epoch).
SYNOPSIS
my_system_gmt_sec()
t - time value to be converted
my_timezone - pointer to long where offset of system time zone
from UTC will be stored for caching
in_dst_time_gap - set to true if time falls into spring time-gap
NOTES
The idea is to cache the time zone offset from UTC (including daylight
saving time) for the next call to make things faster. But currently we
just calculate this offset during startup (by calling init_time()
function) and use it all the time.
Time value provided should be legal time value (e.g. '2003-01-01 25:00:00'
is not allowed).
RETURN VALUE
Time in UTC seconds since Unix Epoch representation.
*/
my_time_t
my_system_gmt_sec(const TIME *t, long *my_timezone, bool *in_dst_time_gap)
{
uint loop;
time_t tmp;
struct tm *l_time,tm_tmp;
long diff, current_timezone;
/*
Calculate the gmt time based on current time and timezone
The -1 on the end is to ensure that if have a date that exists twice
(like 2002-10-27 02:00:0 MET), we will find the initial date.
By doing -3600 we will have to call localtime_r() several times, but
I couldn't come up with a better way to get a repeatable result :(
We can't use mktime() as it's buggy on many platforms and not thread safe.
*/
tmp=(time_t) (((calc_daynr((uint) t->year,(uint) t->month,(uint) t->day) -
(long) days_at_timestart)*86400L + (long) t->hour*3600L +
(long) (t->minute*60 + t->second)) + (time_t) my_time_zone -
3600);
current_timezone= my_time_zone;
localtime_r(&tmp,&tm_tmp);
l_time=&tm_tmp;
for (loop=0;
loop < 2 &&
(t->hour != (uint) l_time->tm_hour ||
t->minute != (uint) l_time->tm_min);
loop++)
{ /* One check should be enough ? */
/* Get difference in days */
int days= t->day - l_time->tm_mday;
if (days < -1)
days= 1; // Month has wrapped
else if (days > 1)
days= -1;
diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour)) +
(long) (60*((int) t->minute - (int) l_time->tm_min)));
current_timezone+= diff+3600; // Compensate for -3600 above
tmp+= (time_t) diff;
localtime_r(&tmp,&tm_tmp);
l_time=&tm_tmp;
}
/*
Fix that if we are in the not existing daylight saving time hour
we move the start of the next real hour
*/
if (loop == 2 && t->hour != (uint) l_time->tm_hour)
{
int days= t->day - l_time->tm_mday;
if (days < -1)
days=1; // Month has wrapped
else if (days > 1)
days= -1;
diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour))+
(long) (60*((int) t->minute - (int) l_time->tm_min)));
if (diff == 3600)
tmp+=3600 - t->minute*60 - t->second; // Move to next hour
else if (diff == -3600)
tmp-=t->minute*60 + t->second; // Move to previous hour
*in_dst_time_gap= 1;
}
*my_timezone= current_timezone;
return (my_time_t) tmp;
} /* my_system_gmt_sec */
/* Some functions to calculate dates */
/* Calculate nr of day since year 0 in new date-system (from 1615) */
long calc_daynr(uint year,uint month,uint day)
{
long delsum;
int temp;
DBUG_ENTER("calc_daynr");
if (year == 0 && month == 0 && day == 0)
DBUG_RETURN(0); /* Skip errors */
if (year < 200)
{
if ((year=year+1900) < 1900+YY_PART_YEAR)
year+=100;
}
delsum= (long) (365L * year+ 31*(month-1) +day);
if (month <= 2)
year--;
else
delsum-= (long) (month*4+23)/10;
temp=(int) ((year/100+1)*3)/4;
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
year+(month <= 2),month,day,delsum+year/4-temp));
DBUG_RETURN(delsum+(int) year/4-temp);
} /* calc_daynr */
#ifndef TESTTIME
/* Calc weekday from daynr */
/* Returns 0 for monday, 1 for tuesday .... */

View file

@ -19,15 +19,10 @@
#pragma interface /* gcc class interface */
#endif
/*
Portable time_t replacement.
Should be signed and hold seconds for 1902-2038 range.
*/
typedef long my_time_t;
#define MY_TIME_T_MAX LONG_MAX
#define MY_TIME_T_MIN LONG_MIN
#include <mysql_time.h>
#if !defined(TESTTIME) && !defined(TZINFO2SQL)
/*
This class represents abstract time zone and provides
basic interface for TIME <-> my_time_t conversion.

View file

@ -75,7 +75,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
uchar fileinfo[64],forminfo[288],*keybuff;
TYPELIB formnames;
uchar *screen_buff;
DBUG_ENTER("rea_create_table");
DBUG_ENTER("mysql_create_frm");
formnames.type_names=0;
if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))

View file

@ -149,7 +149,7 @@ languages and applications need to dynamically load and use MySQL.
%package Max
Release: %{release}
Summary: MySQL - server with Berkeley DB, OpenSSL, RAID and UDF support
Summary: MySQL - server with Berkeley DB, RAID and UDF support
Group: Applications/Databases
Provides: mysql-Max
Obsoletes: mysql-Max
@ -157,7 +157,7 @@ Requires: MySQL >= 4.0
%description Max
Optional MySQL server binary that supports additional features like
Berkeley DB, OpenSSL, RAID and User Defined Functions (UDFs).
Berkeley DB, RAID and User Defined Functions (UDFs).
To activate this binary, just install this package in addition to
the standard MySQL package.
@ -269,7 +269,7 @@ then
fi
BuildMySQL "--enable-shared \
--with-openssl \
--without-openssl \
--with-berkeley-db \
--with-innodb \
--with-raid \
@ -579,6 +579,11 @@ fi
# The spec file changelog only includes changes made to the spec file
# itself
%changelog
* Thu Jul 29 2004 Lenz Grimmer <lenz@mysql.com>
- disabled OpenSSL in the Max binaries again (the RPM packages were the
only exception to this anyway) (BUG 1043)
* Wed Jun 30 2004 Lenz Grimmer <lenz@mysql.com>
- fixed server postinstall (mysql_install_db was called with the wrong

View file

@ -1,5 +1,23 @@
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ ../libmysql_r/libmysqlclient_r.la @openssl_libs@
# Copyright (C) 2004 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
INCLUDES=@MT_INCLUDES@ -I$(top_srcdir)/include $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ @openssl_libs@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la @ZLIB_LIBS@
bin_PROGRAMS= mysqlmanager
mysqlmanager_SOURCES= mysqlmanager.c
mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)

29
zlib/Makefile.am Normal file
View file

@ -0,0 +1,29 @@
# Copyright (C) 2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
noinst_LTLIBRARIES=libz.la
noinst_HEADERS= crc32.h deflate.h inffast.h inffixed.h inflate.h \
inftrees.h trees.h zconf.h zlib.h zutil.h
libz_la_SOURCES= adler32.c compress.c crc32.c deflate.c gzio.c \
infback.c inffast.c inflate.c inftrees.c trees.c \
uncompr.c zutil.c
EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3