mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge bk-internal:/home/bk/mysql-4.0/
into serg.mylan:/usr/home/serg/Abk/mysql-4.0
This commit is contained in:
@ -45,17 +45,15 @@ static const char *load_default_groups[]= { "mysqlbinlog","client",0 };
|
|||||||
void sql_print_error(const char *format, ...);
|
void sql_print_error(const char *format, ...);
|
||||||
|
|
||||||
static bool one_database = 0;
|
static bool one_database = 0;
|
||||||
static bool force_opt= 0;
|
static const char* database= 0;
|
||||||
static const char* database;
|
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
|
||||||
static bool short_form = 0;
|
|
||||||
static ulonglong offset = 0;
|
static ulonglong offset = 0;
|
||||||
static const char* host = 0;
|
static const char* host = 0;
|
||||||
static int port = MYSQL_PORT;
|
static int port = MYSQL_PORT;
|
||||||
static const char* sock= MYSQL_UNIX_ADDR;
|
static const char* sock= 0;
|
||||||
static const char* user = 0;
|
static const char* user = 0;
|
||||||
static const char* pass = "";
|
static const char* pass = "";
|
||||||
static ulonglong position = 0;
|
static ulonglong position = 0;
|
||||||
static bool use_remote = 0;
|
|
||||||
static short binlog_flags = 0;
|
static short binlog_flags = 0;
|
||||||
static MYSQL* mysql = NULL;
|
static MYSQL* mysql = NULL;
|
||||||
|
|
||||||
@ -238,6 +236,9 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0},
|
0, 0},
|
||||||
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
|
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
|
||||||
|
(gptr*) &remote_opt, (gptr*) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||||
|
0, 0},
|
||||||
{"short-form", 's', "Just show the queries, no extra info.",
|
{"short-form", 's', "Just show the queries, no extra info.",
|
||||||
(gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
(gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
@ -342,22 +343,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'd':
|
case 'd':
|
||||||
one_database = 1;
|
one_database = 1;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
|
||||||
use_remote = 1;
|
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
use_remote = 1;
|
|
||||||
break;
|
|
||||||
case 'p':
|
case 'p':
|
||||||
use_remote = 1;
|
|
||||||
pass = my_strdup(argument, MYF(0));
|
pass = my_strdup(argument, MYF(0));
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME))))
|
if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME))))
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'R':
|
||||||
use_remote = 1;
|
remote_opt= 1;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version();
|
print_version();
|
||||||
@ -396,7 +390,7 @@ static MYSQL* safe_connect()
|
|||||||
|
|
||||||
static void dump_log_entries(const char* logname)
|
static void dump_log_entries(const char* logname)
|
||||||
{
|
{
|
||||||
if (use_remote)
|
if (remote_opt)
|
||||||
dump_remote_log_entries(logname);
|
dump_remote_log_entries(logname);
|
||||||
else
|
else
|
||||||
dump_local_log_entries(logname);
|
dump_local_log_entries(logname);
|
||||||
@ -758,7 +752,7 @@ int main(int argc, char** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_remote)
|
if (remote_opt)
|
||||||
mysql = safe_connect();
|
mysql = safe_connect();
|
||||||
|
|
||||||
MY_TMPDIR tmpdir;
|
MY_TMPDIR tmpdir;
|
||||||
@ -782,7 +776,7 @@ int main(int argc, char** argv)
|
|||||||
free_tmpdir(&tmpdir);
|
free_tmpdir(&tmpdir);
|
||||||
if (result_file != stdout)
|
if (result_file != stdout)
|
||||||
my_fclose(result_file, MYF(0));
|
my_fclose(result_file, MYF(0));
|
||||||
if (use_remote)
|
if (remote_opt)
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
my_end(0);
|
my_end(0);
|
||||||
|
@ -39,28 +39,28 @@ select "--- Local --" as "";
|
|||||||
#
|
#
|
||||||
|
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.001
|
||||||
|
|
||||||
# this should not fail but shouldn't produce any working statements
|
# this should not fail but shouldn't produce any working statements
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- Broken LOAD DATA --" as "";
|
select "--- Broken LOAD DATA --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ $MYSQL_TEST_DIR/var/log/master-bin.002
|
||||||
|
|
||||||
# this should show almost nothing
|
# this should show almost nothing
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- --database --" as "";
|
select "--- --database --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.001
|
||||||
|
|
||||||
# this test for position option
|
# this test for position option
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- --position --" as "";
|
select "--- --position --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --position=27 $MYSQL_TEST_DIR/var/log/master-bin.002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=27 $MYSQL_TEST_DIR/var/log/master-bin.002
|
||||||
|
|
||||||
# These are tests for remote binlog.
|
# These are tests for remote binlog.
|
||||||
# They should return the same as previous test.
|
# They should return the same as previous test.
|
||||||
@ -76,28 +76,28 @@ select "--- Remote --" as "";
|
|||||||
# This is broken now
|
# This is broken now
|
||||||
# By the way it seems that remote version fetches all events with name >= master-bin.001
|
# By the way it seems that remote version fetches all events with name >= master-bin.001
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.001
|
||||||
|
|
||||||
# This is broken too
|
# This is broken too
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- Broken LOAD DATA --" as "";
|
select "--- Broken LOAD DATA --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
|
||||||
|
|
||||||
# And this too ! (altough it is documented)
|
# And this too ! (altough it is documented)
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- --database --" as "";
|
select "--- --database --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.001
|
||||||
|
|
||||||
# Strangely but this works
|
# Strangely but this works
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
select "--- --position --" as "";
|
select "--- --position --" as "";
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -36,6 +36,7 @@ bin_SCRIPTS = @server_scripts@ \
|
|||||||
make_win_src_distribution
|
make_win_src_distribution
|
||||||
|
|
||||||
EXTRA_SCRIPTS = make_binary_distribution.sh \
|
EXTRA_SCRIPTS = make_binary_distribution.sh \
|
||||||
|
make_sharedlib_distribution.sh \
|
||||||
make_win_src_distribution.sh \
|
make_win_src_distribution.sh \
|
||||||
msql2mysql.sh \
|
msql2mysql.sh \
|
||||||
mysql_config.sh \
|
mysql_config.sh \
|
||||||
@ -60,12 +61,13 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) \
|
|||||||
mysqlaccess.conf \
|
mysqlaccess.conf \
|
||||||
mysqlbug
|
mysqlbug
|
||||||
|
|
||||||
pkgdata_DATA = make_binary_distribution
|
pkgdata_DATA = make_binary_distribution make_sharedlib_distribution
|
||||||
|
|
||||||
# mysqlbug should be distributed built so that people can report build
|
# mysqlbug should be distributed built so that people can report build
|
||||||
# failures with it.
|
# failures with it.
|
||||||
CLEANFILES = @server_scripts@ \
|
CLEANFILES = @server_scripts@ \
|
||||||
make_binary_distribution \
|
make_binary_distribution \
|
||||||
|
make_sharedlib_distribution \
|
||||||
msql2mysql \
|
msql2mysql \
|
||||||
mysql_config \
|
mysql_config \
|
||||||
mysql_fix_privilege_tables \
|
mysql_fix_privilege_tables \
|
||||||
|
117
scripts/make_sharedlib_distribution.sh
Normal file
117
scripts/make_sharedlib_distribution.sh
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# The default path should be /usr/local
|
||||||
|
|
||||||
|
# Get some info from configure
|
||||||
|
# chmod +x ./scripts/setsomevars
|
||||||
|
|
||||||
|
machine=@MACHINE_TYPE@
|
||||||
|
system=@SYSTEM_TYPE@
|
||||||
|
version=@VERSION@
|
||||||
|
export machine system version
|
||||||
|
SOURCE=`pwd`
|
||||||
|
CP="cp -p"
|
||||||
|
MV="mv"
|
||||||
|
|
||||||
|
STRIP=1
|
||||||
|
DEBUG=0
|
||||||
|
SILENT=0
|
||||||
|
TMP=/tmp
|
||||||
|
SUFFIX=""
|
||||||
|
|
||||||
|
parse_arguments() {
|
||||||
|
for arg do
|
||||||
|
case "$arg" in
|
||||||
|
--debug) DEBUG=1;;
|
||||||
|
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
|
||||||
|
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
|
||||||
|
--no-strip) STRIP=0 ;;
|
||||||
|
--silent) SILENT=1 ;;
|
||||||
|
*)
|
||||||
|
echo "Unknown argument '$arg'"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_arguments "$@"
|
||||||
|
|
||||||
|
BASE=$TMP/my_dist$SUFFIX
|
||||||
|
|
||||||
|
if [ -d $BASE ] ; then
|
||||||
|
rm -r -f $BASE
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $BASE/lib
|
||||||
|
|
||||||
|
for i in \
|
||||||
|
libmysql/.libs/libmysqlclient.so* \
|
||||||
|
libmysql_r/.libs/libmysqlclient_r.so*
|
||||||
|
do
|
||||||
|
if [ -f $i ]
|
||||||
|
then
|
||||||
|
$CP $i $BASE/lib
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Change the distribution to a long descriptive name
|
||||||
|
NEW_NAME=mysql-shared-$version-$system-$machine$SUFFIX
|
||||||
|
BASE2=$TMP/$NEW_NAME
|
||||||
|
rm -r -f $BASE2
|
||||||
|
mv $BASE $BASE2
|
||||||
|
BASE=$BASE2
|
||||||
|
|
||||||
|
#if we are debugging, do not do tar/gz
|
||||||
|
if [ x$DEBUG = x1 ] ; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is needed to prefer GNU tar instead of tar because tar can't
|
||||||
|
# always handle long filenames
|
||||||
|
|
||||||
|
PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
|
||||||
|
which_1 ()
|
||||||
|
{
|
||||||
|
for cmd
|
||||||
|
do
|
||||||
|
for d in $PATH_DIRS
|
||||||
|
do
|
||||||
|
for file in $d/$cmd
|
||||||
|
do
|
||||||
|
if test -x $file -a ! -d $file
|
||||||
|
then
|
||||||
|
echo $file
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create the result tar file
|
||||||
|
#
|
||||||
|
|
||||||
|
tar=`which_1 gnutar gtar`
|
||||||
|
if test "$?" = "1" -o "$tar" = ""
|
||||||
|
then
|
||||||
|
tar=tar
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using $tar to create archive"
|
||||||
|
cd $TMP
|
||||||
|
|
||||||
|
OPT=cvf
|
||||||
|
if [ x$SILENT = x1 ] ; then
|
||||||
|
OPT=cf
|
||||||
|
fi
|
||||||
|
|
||||||
|
$tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
|
||||||
|
cd $SOURCE
|
||||||
|
echo "Compressing archive"
|
||||||
|
gzip -9 $NEW_NAME.tar
|
||||||
|
echo "Removing temporary directory"
|
||||||
|
rm -r -f $BASE
|
||||||
|
|
||||||
|
echo "$NEW_NAME.tar.gz created"
|
@ -1017,11 +1017,12 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi)
|
|||||||
BINLOG_FORMAT_323_GEQ_57 ;
|
BINLOG_FORMAT_323_GEQ_57 ;
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
case '5':
|
|
||||||
mi->old_format = BINLOG_FORMAT_CURRENT;
|
mi->old_format = BINLOG_FORMAT_CURRENT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errmsg = "Master reported unrecognized MySQL version";
|
/* 5.0 is not supported */
|
||||||
|
errmsg = "Master reported an unrecognized MySQL version. Note that 4.0 \
|
||||||
|
slaves can't replicate a 5.0 or newer master.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user