Merge with 5.1

This commit is contained in:
Michael Widenius 2010-01-04 19:54:42 +02:00
commit d2f7348fdc
134 changed files with 3195 additions and 889 deletions

View File

@ -1924,3 +1924,7 @@ libmysqld/opt_table_elimination.cc
libmysqld/ha_federatedx.cc
tmp
libmysqld/debug_sync.cc
client/rpl_filter.cc
client/rpl_filter.h
client/sql_list.cc
client/sql_list.h

View File

@ -1,6 +1,6 @@
cflags="$c_warnings $extra_flags"
cxxflags="$cxx_warnings $base_cxxflags $extra_flags"
extra_configs="$extra_configs $local_infile_configs"
cflags="$c_warnings $extra_flags $EXTRA_FLAGS $EXTRA_CFLAGS"
cxxflags="$cxx_warnings $base_cxxflags $extra_flags $EXTRA_FLAGS $EXTRA_CXXFLAGS"
extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
commands="\

View File

@ -34,6 +34,14 @@ parse_options()
full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
--extra-flags=*)
EXTRA_FLAGS=`get_key_value "$1"`;;
--extra-cflags=*)
EXTRA_CFLAGS=`get_key_value "$1"`;;
--extra-cxxflags=*)
EXTRA_CXXFLAGS=`get_key_value "$1"`;;
--extra-configs=*)
EXTRA_CONFIGS=`get_key_value "$1"`;;
-c | --just-configure)
just_configure=1;;
-n | --just-print | --print)

View File

@ -1279,7 +1279,6 @@ sig_handler handle_sigint(int sig)
char kill_buffer[40];
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || (interrupted_query == 2))
{
@ -1295,6 +1294,7 @@ sig_handler handle_sigint(int sig)
goto err;
}
/* First time try to kill the query, second time the connection */
interrupted_query++;
/* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
@ -1305,10 +1305,13 @@ sig_handler handle_sigint(int sig)
sprintf(kill_buffer, "KILL %s%lu",
(interrupted_query == 1) ? "QUERY " : "",
mysql_thread_id(&mysql));
tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
if (verbose)
tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n",
kill_buffer);
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
interrupted_query= 0;
return;
@ -1321,7 +1324,6 @@ err:
handler called mysql_end().
*/
mysql_thread_end();
return;
#else
mysql_end(sig);
#endif
@ -2881,13 +2883,8 @@ com_help(String *buffer __attribute__((unused)),
return com_server_help(buffer,line,help_arg);
}
put_info("\nFor information about MySQL products and services, visit:\n"
" http://www.mysql.com/\n"
"For developer information, including the MySQL Reference Manual, "
"visit:\n"
" http://dev.mysql.com/\n"
"To buy MySQL Enterprise support, training, or other products, visit:\n"
" https://shop.mysql.com/\n", INFO_INFO);
put_info("\nGeneral information about MariaDB can be found at\n"
"http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);

View File

@ -857,7 +857,8 @@ int main(int argc, char **argv)
if (!opt_write_binlog)
{
if (disable_binlog()) {
if (disable_binlog())
{
first_error= 1;
goto end;
}

View File

@ -472,11 +472,10 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
if (commit_rate)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
if (pre_system)
if ((sysret= system(pre_system)) != 0)
fprintf(stderr,
"Warning: Execution of pre_system option returned %d.\n",
sysret);
if (pre_system && (sysret= system(pre_system)) != 0)
fprintf(stderr,
"Warning: Execution of pre_system option returned %d.\n",
sysret);
/*
Pre statements are always run after all other logic so they can
@ -490,11 +489,10 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
if (post_statements)
run_statements(mysql, post_statements);
if (post_system)
if ((sysret= system(post_system)) != 0)
fprintf(stderr,
"Warning: Execution of post_system option returned %d.\n",
sysret);
if (post_system && (sysret= system(post_system)) != 0)
fprintf(stderr,
"Warning: Execution of post_system option returned %d.\n",
sysret);
/* We are finished with this run */
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
drop_primary_key_list();

View File

@ -1267,6 +1267,7 @@ void abort_not_supported_test(const char *fmt, ...)
DBUG_ENTER("abort_not_supported_test");
/* Print include filestack */
fflush(stdout);
fprintf(stderr, "The test '%s' is not supported by this installation\n",
file_stack->file_name);
fprintf(stderr, "Detected in file %s at line %d\n",
@ -3497,9 +3498,10 @@ void do_diff_files(struct st_command *command)
if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
match_expected_error(command, error, NULL) < 0)
{
/* Compare of the two files failed, append them to output
so the failure can be analyzed, but only if it was not
expected to fail.
/*
Compare of the two files failed, append them to output
so the failure can be analyzed, but only if it was not
expected to fail.
*/
show_diff(&ds_res, ds_filename.str, ds_filename2.str);
log_file.write(&ds_res);
@ -5013,7 +5015,8 @@ void do_connect(struct st_command *command)
con_options= ds_options.str;
while (*con_options)
{
char* end;
size_t length;
char *end;
/* Step past any spaces in beginning of option*/
while (*con_options && my_isspace(charset_info, *con_options))
con_options++;
@ -5021,13 +5024,14 @@ void do_connect(struct st_command *command)
end= con_options;
while (*end && !my_isspace(charset_info, *end))
end++;
if (!strncmp(con_options, "SSL", 3))
length= (size_t) (end - con_options);
if (length == 3 && !strncmp(con_options, "SSL", 3))
con_ssl= 1;
else if (!strncmp(con_options, "COMPRESS", 8))
else if (length == 8 && !strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
else if (!strncmp(con_options, "PIPE", 4))
else if (length == 4 && !strncmp(con_options, "PIPE", 4))
con_pipe= 1;
else if (!strncmp(con_options, "SHM", 3))
else if (length == 3 && !strncmp(con_options, "SHM", 3))
con_shm= 1;
else
die("Illegal option to connect: %.*s",
@ -5096,14 +5100,13 @@ void do_connect(struct st_command *command)
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
}
else if(shared_memory_base_name)
else if (shared_memory_base_name)
{
mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
shared_memory_base_name);
shared_memory_base_name);
}
#endif
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, opt_db);
@ -6879,10 +6882,8 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
ulonglong affected_rows;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
LINT_INIT(affected_rows);
/*
Init a new stmt if it's not already one created for this connection
@ -6981,6 +6982,9 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
handle_no_error(command);
if (!disable_result_log)
{
ulonglong affected_rows;
LINT_INIT(affected_rows);
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
@ -7026,39 +7030,33 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
Need to grab affected rows information before getting
warnings here
*/
if (!disable_info)
affected_rows= mysql_affected_rows(mysql);
if (!disable_warnings)
{
ulonglong affected_rows;
LINT_INIT(affected_rows);
/* Get the warnings from execute */
if (!disable_info)
affected_rows= mysql_affected_rows(mysql);
if (!disable_warnings)
/* Append warnings to ds - if there are any */
if (append_warnings(&ds_execute_warnings, mysql) ||
ds_execute_warnings.length ||
ds_prepare_warnings.length ||
ds_warnings->length)
{
/* Get the warnings from execute */
/* Append warnings to ds - if there are any */
if (append_warnings(&ds_execute_warnings, mysql) ||
ds_execute_warnings.length ||
ds_prepare_warnings.length ||
ds_warnings->length)
{
dynstr_append_mem(ds, "Warnings:\n", 10);
if (ds_warnings->length)
dynstr_append_mem(ds, ds_warnings->str,
ds_warnings->length);
if (ds_prepare_warnings.length)
dynstr_append_mem(ds, ds_prepare_warnings.str,
ds_prepare_warnings.length);
if (ds_execute_warnings.length)
dynstr_append_mem(ds, ds_execute_warnings.str,
ds_execute_warnings.length);
}
dynstr_append_mem(ds, "Warnings:\n", 10);
if (ds_warnings->length)
dynstr_append_mem(ds, ds_warnings->str,
ds_warnings->length);
if (ds_prepare_warnings.length)
dynstr_append_mem(ds, ds_prepare_warnings.str,
ds_prepare_warnings.length);
if (ds_execute_warnings.length)
dynstr_append_mem(ds, ds_execute_warnings.str,
ds_execute_warnings.length);
}
if (!disable_info)
append_info(ds, affected_rows, mysql_info(mysql));
}
if (!disable_info)
append_info(ds, affected_rows, mysql_info(mysql));
}
end:
@ -7235,7 +7233,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
}
dynstr_free(&query_str);
}
if (sp_protocol_enabled &&
@ -7662,6 +7659,7 @@ int main(int argc, char **argv)
my_bool q_send_flag= 0, abort_flag= 0;
uint command_executed= 0, last_command_executed= 0;
char save_file[FN_REFLEN];
bool empty_result= FALSE;
MY_INIT(argv[0]);
save_file[0]= 0;
@ -7819,6 +7817,7 @@ int main(int argc, char **argv)
verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
while (!read_command(&command) && !abort_flag)
{
my_bool ok_to_do;
int current_line_inc = 1, processed = 0;
if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND)
get_command_type(command);
@ -7831,7 +7830,7 @@ int main(int argc, char **argv)
command->type= Q_COMMENT;
}
my_bool ok_to_do= cur_block->ok;
ok_to_do= cur_block->ok;
/*
Some commands need to be "done" the first time if they may get
re-iterated over in a true context. This can only happen if there's
@ -8100,7 +8099,10 @@ int main(int argc, char **argv)
abort_flag= 1;
break;
case Q_SKIP:
abort_not_supported_test("%s", command->first_argument);
/* Eval the query, thus replacing all environment variables */
dynstr_set(&ds_res, 0);
do_eval(&ds_res, command->first_argument, command->end, FALSE);
abort_not_supported_test("%s",ds_res.str);
break;
case Q_RESULT:
@ -8167,8 +8169,6 @@ int main(int argc, char **argv)
if (parsing_disabled)
die("Test ended with parsing disabled");
my_bool empty_result= FALSE;
/*
The whole test has been executed _sucessfully_.
Time to compare result or save it to record file.

View File

@ -497,12 +497,18 @@ int DbugParse(CODE_STATE *cs, const char *control)
const char *end;
int rel, f_used=0;
struct settings *stack;
int org_cs_locked;
stack= cs->stack;
if (!(org_cs_locked= cs->locked))
{
cs->locked= 1;
pthread_mutex_lock(&THR_LOCK_dbug);
}
if (control[0] == '-' && control[1] == '#')
control+=2;
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
@ -550,9 +556,11 @@ int DbugParse(CODE_STATE *cs, const char *control)
while (control < end)
{
int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0;
if (sign) control++;
if (sign)
control++;
c= *control++;
if (*control == ',') control++;
if (*control == ',')
control++;
/* XXX when adding new cases here, don't forget _db_explain_ ! */
switch (c) {
case 'd':
@ -570,7 +578,7 @@ int DbugParse(CODE_STATE *cs, const char *control)
{
if (DEBUGGING)
stack->keywords= ListDel(stack->keywords, control, end);
break;
break;
}
stack->keywords= ListAdd(stack->keywords, control, end);
stack->flags |= DEBUG_ON;
@ -718,8 +726,13 @@ int DbugParse(CODE_STATE *cs, const char *control)
control=end+1;
end= DbugStrTok(control);
}
return !rel || f_used;
}
if (!org_cs_locked)
{
pthread_mutex_unlock(&THR_LOCK_dbug);
cs->locked= 0;
}
return !rel || f_used;}
#define framep_trace_flag(cs, frp) (frp ? \
frp->level & TRACE_ON : \
@ -1340,11 +1353,11 @@ void _db_doprnt_(const char *format,...)
va_start(args,format);
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, cs->u_keyword, 0))
{
int save_errno=errno;
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
@ -1356,6 +1369,9 @@ void _db_doprnt_(const char *format,...)
DbugFlush(cs);
errno=save_errno;
}
else if (!cs->locked)
pthread_mutex_unlock(&THR_LOCK_dbug);
va_end(args);
}
@ -1386,10 +1402,10 @@ void _db_dump_(uint _line_, const char *keyword,
CODE_STATE *cs;
get_code_state_or_return;
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
if (_db_keyword_(cs, keyword, 0))
{
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, _line_);
if (TRACING)
{
@ -1420,6 +1436,8 @@ void _db_dump_(uint _line_, const char *keyword,
(void) fputc('\n',cs->stack->out_file);
DbugFlush(cs);
}
else if (!cs->locked)
pthread_mutex_unlock(&THR_LOCK_dbug);
}
@ -2105,7 +2123,8 @@ static void DBUGCloseFile(CODE_STATE *cs, FILE *fp)
{
if (fp != stderr && fp != stdout && fclose(fp) == EOF)
{
pthread_mutex_lock(&THR_LOCK_dbug);
if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
(void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process);
perror("");
DbugFlush(cs);

View File

@ -167,7 +167,8 @@ public:
void CleanNew(word32 newSize)
{
New(newSize);
memset(buffer_, 0, sz_ * sizeof(T));
if (sz_ > 0)
memset(buffer_, 0, sz_ * sizeof(T));
}
void New(word32 newSize)

View File

@ -1,4 +1,2 @@
-- require r/have_big5.require
disable_query_log;
show collation like 'big5_chinese_ci';
enable_query_log;
let collation=big5_chinese_ci;
--source include/have_collation.inc

View File

@ -0,0 +1,3 @@
if (!`SELECT count(*) AS 'true' FROM information_schema.collations WHERE collation_name LIKE '$collation'`) {
skip Test needs character set '$collation';
}

View File

@ -1,4 +1,2 @@
-- require r/have_cp1250_ch.require
disable_query_log;
show collation like 'cp1250_czech_cs';
enable_query_log;
let collation=cp1250_czech_cs;
--source include/have_collation.inc

View File

@ -1,7 +1,2 @@
--require r/have_cp1251.require
--disable_query_log
SHOW COLLATION LIKE 'cp1251_general_ci';
--enable_query_log
let collation=cp1251_general_ci;
--source include/have_collation.inc

View File

@ -1,7 +1,2 @@
--require r/have_cp866.require
--disable_query_log
SHOW COLLATION LIKE 'cp866_general_ci';
--enable_query_log
let collation=cp866_general_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_cp932.require
disable_query_log;
show collation like 'cp932_japanese_ci';
enable_query_log;
let collation=cp932_japanese_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_eucjpms.require
disable_query_log;
show collation like 'eucjpms_japanese_ci';
enable_query_log;
let collation=eucjpms_japanese_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_euckr.require
disable_query_log;
show collation like 'euckr_korean_ci';
enable_query_log;
let collation=euckr_korean_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_gb2312.require
disable_query_log;
show collation like 'gb2312_chinese_ci';
enable_query_log;
let collation=gb2312_chinese_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_gbk.require
disable_query_log;
show collation like 'gbk_chinese_ci';
enable_query_log;
let collation=gbk_chinese_ci;
--source include/have_collation.inc

View File

@ -1,7 +1,2 @@
--require r/have_koi8r.require
--disable_query_log
SHOW COLLATION LIKE 'koi8r_general_ci';
--enable_query_log
let collation=koi8r_general_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_latin2_ch.require
disable_query_log;
show collation like 'latin2_czech_cs';
enable_query_log;
let collation=latin2_czech_cs;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_sjis.require
disable_query_log;
show collation like 'sjis_japanese_ci';
enable_query_log;
let collation=sjis_japanese_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_tis620.require
disable_query_log;
show collation like 'tis620_thai_ci';
enable_query_log;
let collation=tis620_thai_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_ucs2.require
disable_query_log;
show collation like 'ucs2_general_ci';
enable_query_log;
let collation=ucs2_general_ci;
--source include/have_collation.inc

View File

@ -1,4 +1,2 @@
-- require r/have_ujis.require
disable_query_log;
show collation like 'ujis_japanese_ci';
enable_query_log;
let collation=ujis_japanese_ci;
--source include/have_collation.inc

View File

@ -1,7 +1,2 @@
--require r/have_utf8.require
--disable_query_log
SHOW COLLATION LIKE 'utf8_general_ci';
--enable_query_log
let collation=utf8_general_ci;
--source include/have_collation.inc

View File

@ -101,7 +101,6 @@ sub init_pattern {
sub collect_test_cases ($$) {
my $suites= shift; # Semicolon separated list of test suites
my %found_suites;
my $opt_cases= shift;
my $cases= []; # Array of hash(one hash for each testcase)
@ -115,7 +114,6 @@ sub collect_test_cases ($$) {
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
"ha_innodb_plugin.sl"],
NOT_REQUIRED);
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
!(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin);
@ -123,7 +121,6 @@ sub collect_test_cases ($$) {
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
$found_suites{$suite}= 1;
last if $some_test_found;
}
@ -136,12 +133,6 @@ sub collect_test_cases ($$) {
{
my $found= 0;
my ($sname, $tname, $extension)= split_testname($test_name_spec);
if (defined($sname) && !defined($found_suites{$sname}))
{
$found_suites{$sname}= 1;
push(@$cases, collect_one_suite($sname));
}
foreach my $test ( @$cases )
{
# test->{name} is always in suite.name format
@ -247,7 +238,7 @@ sub split_testname {
}
sub collect_one_suite($)
sub collect_one_suite
{
my $suite= shift; # Test suite name
my $opt_cases= shift;
@ -767,7 +758,6 @@ sub process_opts_file {
}
}
##############################################################################
#
# Collect information about a single test case

View File

@ -388,7 +388,7 @@ MSG
}
elsif (@$extra_warnings)
{
mtr_error("There were errors/warnings in server logs after running test cases.");
mtr_error("There where errors/warnings in server logs after running test cases.");
}
elsif ($fail)
{

View File

@ -178,6 +178,7 @@ our @opt_extra_mysqltest_opt;
our $opt_compress;
our $opt_ssl;
our $opt_skip_ssl;
our $opt_ssl_supported;
our $opt_ps_protocol;
our $opt_sp_protocol;

View File

@ -126,7 +126,7 @@ my $path_config_file; # The generated config file, var/my.cnf
# executables will be used by the test suite.
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
my $DEFAULT_SUITES= "main,binlog,federated,rpl,innodb,maria,parts";
my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts";
my $opt_suites;
our $opt_verbose= 0; # Verbose output, enable with --verbose
@ -201,10 +201,10 @@ my $opt_mark_progress;
my $opt_sleep;
my $opt_testcase_timeout= 15; # minutes
my $opt_suite_timeout = 300; # minutes
my $opt_shutdown_timeout= 10; # seconds
my $opt_start_timeout = 180; # seconds
my $opt_testcase_timeout= 15; # 15 minutes
my $opt_suite_timeout = 360; # 6 hours
my $opt_shutdown_timeout= 10; # 10 seconds
my $opt_start_timeout = 180; # 180 seconds
sub testcase_timeout { return $opt_testcase_timeout * 60; };
sub suite_timeout { return $opt_suite_timeout * 60; };
@ -1319,6 +1319,8 @@ sub command_line_setup {
{
# Indicate that we are using debugger
$glob_debugger= 1;
$opt_testcase_timeout= 60*60*24; # Don't abort debugging with timeout
$opt_suite_timeout= $opt_testcase_timeout;
$opt_retry= 1;
$opt_retry_failure= 1;
@ -2151,7 +2153,6 @@ sub environment_setup {
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
$ENV{'VALGRIND_TEST'}= $opt_valgrind;
}
@ -2908,8 +2909,8 @@ sub mysql_install_db {
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
my $path_sql= my_find_file($install_basedir,
["mysql", "sql/share", "share/mysql",
"share/mariadb", "share", "scripts"],
["mysql", "sql/share", "share/mariadb",
"share/mysql", "share", "scripts"],
"mysql_system_tables.sql",
NOT_REQUIRED);
@ -3861,7 +3862,7 @@ sub extract_server_log ($$) {
my ($error_log, $tname) = @_;
# Open the servers .err log file and read all lines
# belonging to current tets into @lines
# belonging to current test into @lines
my $Ferr = IO::File->new($error_log)
or mtr_error("Could not open file '$error_log' for reading: $!");
@ -5682,12 +5683,15 @@ Misc options
servers to exit before finishing the process
fast Run as fast as possible, dont't wait for servers
to shutdown etc.
parallel=N Run tests in N parallel threads (default=1)
parallel=N Run tests in N parallel threads (default 1)
Use parallel=auto for auto-setting of N
repeat=N Run each test N number of times
retry=N Retry tests that fail N times, limit number of failures
to $opt_retry_failure
retry-failure=N Limit number of retries for a failed test
retry=N Retry tests that fail up to N times (default $opt_retry).
Retries are also limited by the maximum number of
failures before stopping, set with the --retry-failure
option
retry-failure=N When using the --retry option to retry failed tests,
stop when N failures have occured (default $opt_retry_failure)
reorder Reorder tests to get fewer server restarts
help Get this help text

View File

@ -0,0 +1,31 @@
drop table if exists t1,t2;
CREATE TABLE t1(
c1 INT DEFAULT 12 COMMENT 'column1',
c2 INT NULL COMMENT 'column2',
c3 INT NOT NULL COMMENT 'column3',
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
c6 VARCHAR(255))
COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT '12' COMMENT 'column1',
`c2` int(11) DEFAULT NULL COMMENT 'column2',
`c3` int(11) NOT NULL COMMENT 'column3',
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
`c6` varchar(255) COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int(11) DEFAULT '12' COMMENT 'column1',
`c2` int(11) DEFAULT NULL COMMENT 'column2',
`c3` int(11) NOT NULL COMMENT 'column3',
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
`c6` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;

View File

@ -1792,52 +1792,6 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=utf8
drop table t1;
# --
# -- Bug#21380: DEFAULT definition not always transfered by CREATE
# -- TABLE/SELECT to the new table.
# --
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(
c1 INT DEFAULT 12 COMMENT 'column1',
c2 INT NULL COMMENT 'column2',
c3 INT NOT NULL COMMENT 'column3',
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
c6 VARCHAR(255))
COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT '12' COMMENT 'column1',
`c2` int(11) DEFAULT NULL COMMENT 'column2',
`c3` int(11) NOT NULL COMMENT 'column3',
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
`c6` varchar(255) COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int(11) DEFAULT '12' COMMENT 'column1',
`c2` int(11) DEFAULT NULL COMMENT 'column2',
`c3` int(11) NOT NULL COMMENT 'column3',
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
`c6` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
# -- End of test case for Bug#21380.
# --
# -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
# --

View File

@ -1211,3 +1211,47 @@ HEX(DAYNAME(19700101))
0427043504420432043504400433
SET character_set_connection=latin1;
End of 5.0 tests
Start of 5.1 tests
SET NAMES utf8;
CREATE TABLE t1 (
a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
key(a)
);
INSERT INTO t1 VALUES
('aa'),('bb'),('cc'),('dd'),('ee'),('ff'),('gg'),('hh'),('ii'),
('jj'),('kk'),('ll'),('mm'),('nn'),('oo'),('pp'),('rr'),('ss'),
('tt'),('uu'),('vv'),('ww'),('xx'),('yy'),('zz');
INSERT INTO t1 VALUES ('ca'),('cz'),('ch');
INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E');
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 23 NULL 30 Using where; Using index
SELECT * FROM t1 WHERE a LIKE 'c%';
a
ca
cc
cz
ch
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
SELECT * FROM t1 WHERE a LIKE 'ch%';
a
ch
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci;
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
SELECT hex(concat('d',_ucs2 0x017E,'%'));
hex(concat('d',_ucs2 0x017E,'%'))
0064017E0025
EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index
SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%');
hex(a)
0064017E
DROP TABLE t1;

View File

@ -1,3 +1,5 @@
drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest;
drop table if exists t1,t2;
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
big5_chinese_ci big5 1 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
cp1251_general_ci cp1251 51 Yes 0

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
cp866_general_ci cp866 36 Yes 0

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
cp932_japanese_ci cp932 95 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
eucjpms_japanese_ci eucjpms 97 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
euckr_korean_ci euckr 19 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
gb2312_chinese_ci gb2312 24 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
gbk_chinese_ci gbk 28 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
koi8r_general_ci koi8r 7 Yes 0

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
latin2_czech_cs latin2 2 Yes 4

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
sjis_japanese_ci sjis 13 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
tis620_thai_ci tis620 18 Yes Yes 4

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
ucs2_general_ci ucs2 35 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
ujis_japanese_ci ujis 12 Yes Yes 1

View File

@ -1,2 +0,0 @@
Collation Charset Id Default Compiled Sortlen
utf8_general_ci utf8 33 Yes Yes 1

View File

@ -3160,15 +3160,6 @@ ALTER TABLE t2 MODIFY a INT NOT NULL;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
DELETE FROM t1;
DROP TABLE t2,t1;
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
DELETE FROM t1;
INSERT INTO t1 VALUES ('DDD');
SELECT * FROM t1;
a
DDD
DROP TABLE t1;
CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
AUTO_INCREMENT=42;
INSERT INTO t1 VALUES (0),(347),(0);

View File

@ -0,0 +1,10 @@
drop table if exists t1;
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
DELETE FROM t1;
INSERT INTO t1 VALUES ('DDD');
SELECT * FROM t1;
a
DDD
DROP TABLE t1;

View File

@ -319,3 +319,17 @@ SHOW ERRORS;
Level Code Message
Error 1051 Unknown table 't1'
End of 5.0 tests
set sql_mode = default;
select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
CAST(a AS DECIMAL(13,5))
0.00000
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
create table t1 (a integer unsigned);
insert into t1 values (1),(-1),(0),(-2);
Warnings:
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 4
drop table t1;
End of 5.1 tests

View File

@ -9,5 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
federated_server : needs fixup

View File

@ -175,6 +175,8 @@ CREATE TABLE db_bogus.t1 (
)
;
INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
create user test_fed@localhost identified by 'foo';
grant all on db_legitimate.* to test_fed@localhost;
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
@ -211,15 +213,14 @@ id name
alter server s1 options (database 'db_bogus');
flush tables;
select * from federated.t1;
id name
2 this is bogus
ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: : 1044 : Access denied for user 'test_fed'@'localhost' to databa
drop server if exists 's1';
ERROR 42000: Access denied; you need the SUPER privilege for this operation
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
USER 'root',
PASSWORD '',
USER 'test_fed',
PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@ -228,8 +229,8 @@ drop server 's1';
create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
USER 'root',
PASSWORD '',
USER 'test_fed',
PASSWORD 'foo',
PORT SLAVE_PORT,
SOCKET '',
OWNER 'root');
@ -237,6 +238,7 @@ flush tables;
select * from federated.t1;
id name
1 this is legitimate
drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;
drop user guest_super@localhost;
@ -275,6 +277,6 @@ call p1();
drop procedure p1;
drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
DROP DATABASE IF EXISTS federated;

View File

@ -239,6 +239,7 @@ alter server s1 options (database 'db_bogus');
connection master;
flush tables;
--error ER_QUERY_ON_FOREIGN_DATA_SOURCE
select * from federated.t1;
connection conn_select;
@ -249,8 +250,8 @@ drop server if exists 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
USER 'root',
PASSWORD '',
USER 'test_fed',
PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@ -261,8 +262,8 @@ drop server 's1';
eval create server 's1' foreign data wrapper 'mysql' options
(HOST '127.0.0.1',
DATABASE 'db_legitimate',
USER 'root',
PASSWORD '',
USER 'test_fed',
PASSWORD 'foo',
PORT $SLAVE_MYPORT,
SOCKET '',
OWNER 'root');
@ -273,6 +274,7 @@ select * from federated.t1;
# clean up test
connection slave;
drop user test_fed@localhost;
drop database db_legitimate;
drop database db_bogus;

View File

@ -3372,9 +3372,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3389,9 +3389,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@ -3408,11 +3408,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@ -3430,11 +3430,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@ -3454,9 +3454,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3471,9 +3471,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@ -3490,11 +3490,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@ -3510,11 +3510,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;

View File

@ -3373,9 +3373,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3390,9 +3390,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@ -3409,11 +3409,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@ -3431,11 +3431,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@ -3455,9 +3455,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3472,9 +3472,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@ -3491,11 +3491,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@ -3511,11 +3511,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;

View File

@ -3373,9 +3373,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3390,9 +3390,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 29
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@ -3409,11 +3409,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@ -3431,11 +3431,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 28
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
@ -3455,9 +3455,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3472,9 +3472,9 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 27
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
Error 1366 Incorrect decimal value: '' for column '' at row 0
DROP VIEW v1;
@ -3491,11 +3491,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@ -3511,11 +3511,11 @@ NULL NULL 1
-1.00 -1 5
-3333.33 -3333.3333 26
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' '
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;

View File

@ -1,4 +1,6 @@
source include/master-slave.inc;
let collation=utf8_unicode_ci;
--source include/have_collation.inc
#
# BUG#16487

View File

@ -0,0 +1,26 @@
# Prerequisites
let collation=utf8_unicode_ci;
--source include/have_collation.inc
# Initial cleanup
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
#
# Bug#21380: DEFAULT definition not always transfered by CREATE
# TABLE/SELECT to the new table.
#
CREATE TABLE t1(
c1 INT DEFAULT 12 COMMENT 'column1',
c2 INT NULL COMMENT 'column2',
c3 INT NOT NULL COMMENT 'column3',
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
c6 VARCHAR(255))
COLLATE latin1_bin;
SHOW CREATE TABLE t1;
CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t1,t2;

View File

@ -1398,52 +1398,6 @@ drop table t1;
###########################################################################
--echo
--echo # --
--echo # -- Bug#21380: DEFAULT definition not always transfered by CREATE
--echo # -- TABLE/SELECT to the new table.
--echo # --
--echo
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
--echo
CREATE TABLE t1(
c1 INT DEFAULT 12 COMMENT 'column1',
c2 INT NULL COMMENT 'column2',
c3 INT NOT NULL COMMENT 'column3',
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
c6 VARCHAR(255))
COLLATE latin1_bin;
--echo
SHOW CREATE TABLE t1;
--echo
CREATE TABLE t2 AS SELECT * FROM t1;
--echo
SHOW CREATE TABLE t2;
--echo
DROP TABLE t2;
DROP TABLE t1;
--echo
--echo # -- End of test case for Bug#21380.
###########################################################################
--echo
--echo # --
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields

View File

@ -723,3 +723,34 @@ SELECT HEX(DAYNAME(19700101));
SET character_set_connection=latin1;
--echo End of 5.0 tests
--echo Start of 5.1 tests
#
# Checking my_like_range_ucs2
#
SET NAMES utf8;
CREATE TABLE t1 (
a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
key(a)
);
INSERT INTO t1 VALUES
('aa'),('bb'),('cc'),('dd'),('ee'),('ff'),('gg'),('hh'),('ii'),
('jj'),('kk'),('ll'),('mm'),('nn'),('oo'),('pp'),('rr'),('ss'),
('tt'),('uu'),('vv'),('ww'),('xx'),('yy'),('zz');
INSERT INTO t1 VALUES ('ca'),('cz'),('ch');
INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E');
# This one should scan only one row
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%';
# This one should scan many rows: 'c' is a contraction head
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%';
SELECT * FROM t1 WHERE a LIKE 'c%';
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%';
SELECT * FROM t1 WHERE a LIKE 'ch%';
ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci;
EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%';
SELECT hex(concat('d',_ucs2 0x017E,'%'));
EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%');
SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%');
DROP TABLE t1;

View File

@ -2,6 +2,15 @@
# Tests with the utf8 character set
#
let collation=utf8_unicode_ci;
--source include/have_collation.inc
--disable_warnings
drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest;
--enable_warnings
--disable_warnings
drop table if exists t1,t2;
--enable_warnings

View File

@ -36,6 +36,8 @@
--source include/have_cp866.inc
--source include/have_cp1251.inc
--source include/have_koi8r.inc
let collation=utf8_unicode_ci;
--source include/have_collation.inc
###########################################################################

View File

@ -36,6 +36,8 @@
--source include/have_cp866.inc
--source include/have_cp1251.inc
--source include/have_koi8r.inc
let collation=utf8_unicode_ci;
--source include/have_collation.inc
###########################################################################

View File

@ -2,6 +2,9 @@
# Test of fulltext index
#
let collation=utf8_unicode_ci;
--source include/have_collation.inc
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings

View File

@ -2,6 +2,9 @@
# test of new fulltext search features
#
let collation=utf8_unicode_ci;
--source include/have_collation.inc
#
# two-level tree
#

View File

@ -2352,18 +2352,6 @@ ALTER TABLE t2 MODIFY a INT NOT NULL;
DELETE FROM t1;
DROP TABLE t2,t1;
#
# Bug #26835: table corruption after delete+insert
#
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
DELETE FROM t1;
INSERT INTO t1 VALUES ('DDD');
SELECT * FROM t1;
DROP TABLE t1;
#
# Bug #23313 (AUTO_INCREMENT=# not reported back for InnoDB tables)
# Bug #21404 (AUTO_INCREMENT value reset when Adding FKEY (or ALTER?))

View File

@ -0,0 +1,24 @@
#
# Tests for innodb that requires not default character sets
#
--source include/have_innodb.inc
let collation=utf8_unicode_ci;
--source include/have_collation.inc
# Setup
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Bug #26835: table corruption after delete+insert
#
CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
DELETE FROM t1;
INSERT INTO t1 VALUES ('DDD');
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -11,8 +11,9 @@
# We cannot run on embedded server because we use multiple sessions.
--source include/not_embedded.inc
--source include/have_query_cache.inc
let collation=utf8_unicode_ci;
--source include/have_collation.inc
# The file with expected results fits only to a run without
# ps-protocol/sp-protocol/cursor-protocol/view-protocol.

View File

@ -11,8 +11,9 @@
# We cannot run on embedded server because we use multiple sessions.
--source include/not_embedded.inc
--source include/have_query_cache.inc
let collation=utf8_unicode_ci;
--source include/have_collation.inc
# The file with expected results fits only to a run with "--ps-protocol".
if (`SELECT $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0

View File

@ -194,7 +194,6 @@ DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
DROP PROCEDURE sp3;
#
# Bug#30059: End-space truncation warnings are inconsistent or incorrect
#
@ -235,3 +234,15 @@ DROP TABLE t1;
SHOW ERRORS;
--echo End of 5.0 tests
#
# Test warning with row numbers
#
set sql_mode = default;
select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
create table t1 (a integer unsigned);
insert into t1 values (1),(-1),(0),(-2);
drop table t1;
--echo End of 5.1 tests

View File

@ -145,7 +145,7 @@ static int simple_parser_deinit(MYSQL_FTPARSER_PARAM *param
the list of search terms when parsing a search string.
*/
static void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
static void add_word(MYSQL_FTPARSER_PARAM *param, const unsigned char *word, size_t len)
{
MYSQL_FTPARSER_BOOLEAN_INFO bool_info=
{ FT_TOKEN_WORD, 0, 0, 0, 0, ' ', 0 };
@ -169,11 +169,11 @@ static void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
static int simple_parser_parse(MYSQL_FTPARSER_PARAM *param)
{
char *end, *start, *docend= (char *)param->doc + param->length;
const unsigned char *end, *start, *docend= param->doc + param->length;
number_of_calls++;
for (end= start= (char *)param->doc;; end++)
for (end= start= param->doc;; end++)
{
if (end == docend)
{

View File

@ -21,7 +21,7 @@ echo "Finding system information for a MySQL bug report"
VERSION="@VERSION@@MYSQL_SERVER_SUFFIX@"
COMPILATION_COMMENT="@COMPILATION_COMMENT@"
BUGmysql="mysql@lists.mysql.com"
BUGmysql="maria-developers@lists.launchpad.net"
# This is set by configure
COMP_CALL_INFO="CC='@SAVE_CC@' CFLAGS='@SAVE_CFLAGS@' CXX='@SAVE_CXX@' CXXFLAGS='@SAVE_CXXFLAGS@' LDFLAGS='@SAVE_LDFLAGS@' ASFLAGS='@SAVE_ASFLAGS@'"
COMP_RUN_INFO="CC='@CC@' CFLAGS='@CFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' LDFLAGS='@LDFLAGS@' ASFLAGS='@ASFLAGS@'"

View File

@ -3208,7 +3208,7 @@ const char * STDCALL mysql_error(MYSQL *mysql)
mysql Connection
EXAMPLE
4.1.0-alfa -> 40100
MariaDB-4.1.0-alfa -> 40100
NOTES
We will ensure that a newer server always has a bigger number.
@ -3221,7 +3221,11 @@ ulong STDCALL
mysql_get_server_version(MYSQL *mysql)
{
uint major, minor, version;
char *pos= mysql->server_version, *end_pos;
const char *pos= mysql->server_version;
char *end_pos;
/* Skip possible prefix */
while (*pos && !my_isdigit(&my_charset_latin1, *pos))
pos++;
major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1;
version= (uint) strtoul(pos, &end_pos, 10);

View File

@ -1585,16 +1585,6 @@ int ha_recover(HASH *commit_list)
if (info.commit_list)
sql_print_information("Starting crash recovery...");
#ifndef WILL_BE_DELETED_LATER
/*
for now, only InnoDB supports 2pc. It means we can always safely
rollback all pending transactions, without risking inconsistent data
*/
DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog
tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK
info.dry_run=FALSE;
#endif
for (info.len= MAX_XID_LIST_SIZE ;
info.list==0 && info.len > MIN_XID_LIST_SIZE; info.len/=2)
{

View File

@ -38,7 +38,7 @@ int decimal_operation_results(int result)
case E_DEC_TRUNCATED:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
"", (long)-1);
"", (ulong) 0);
break;
case E_DEC_OVERFLOW:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
@ -54,7 +54,7 @@ int decimal_operation_results(int result)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", "", "", (long)-1);
"decimal", "", "", (ulong) 0);
break;
case E_DEC_OOM:
my_error(ER_OUT_OF_RESOURCES, MYF(0));

View File

@ -4196,8 +4196,10 @@ server.");
Need to unlock as global_system_variables.table_plugin
was acquired during plugin_init()
*/
pthread_mutex_lock(&LOCK_global_system_variables);
plugin_unlock(0, global_system_variables.table_plugin);
global_system_variables.table_plugin= plugin;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
}
#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)

View File

@ -3173,22 +3173,22 @@ ER_CANT_CREATE_THREAD
swe "Kan inte skapa en ny tråd (errno %d)"
ukr "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ ÎÏ×Õ Ç¦ÌËÕ (ÐÏÍÉÌËÁ %d). ñËÝÏ ×É ÎÅ ×ÉËÏÒÉÓÔÁÌÉ ÕÓÀ ÐÁÍ'ÑÔØ, ÔÏ ÐÒÏÞÉÔÁÊÔÅ ÄÏËÕÍÅÎÔÁæÀ ÄÏ ×ÁÛϧ ïó - ÍÏÖÌÉ×Ï ÃÅ ÐÏÍÉÌËÁ ïó"
ER_WRONG_VALUE_COUNT_ON_ROW 21S01
cze "Po-Bèet sloupcù neodpovídá poètu hodnot na øádku %ld"
dan "Kolonne antallet stemmer ikke overens med antallet af værdier i post %ld"
nla "Kolom aantal komt niet overeen met waarde aantal in rij %ld"
eng "Column count doesn't match value count at row %ld"
est "Tulpade hulk erineb väärtuste hulgast real %ld"
ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %ld überein"
hun "Az oszlopban talalhato ertek nem egyezik meg a %ld sorban szamitott ertekkel"
ita "Il numero delle colonne non corrisponde al conteggio alla riga %ld"
kor "Row %ld¿¡¼­ Ä®·³ Ä«¿îÆ®¿Í value Ä«¿îÅÍ¿Í ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù."
por "Contagem de colunas não confere com a contagem de valores na linha %ld"
rum "Numarul de coloane nu corespunde cu numarul de valori la linia %ld"
rus "ëÏÌÉÞÅÓÔ×Ï ÓÔÏÌÂÃÏ× ÎÅ ÓÏ×ÐÁÄÁÅÔ Ó ËÏÌÉÞÅÓÔ×ÏÍ ÚÎÁÞÅÎÉÊ × ÚÁÐÉÓÉ %ld"
serbian "Broj kolona ne odgovara broju vrednosti u slogu %ld"
spa "El número de columnas no corresponde al número en la línea %ld"
swe "Antalet kolumner motsvarar inte antalet värden på rad: %ld"
ukr "ë¦ÌØË¦ÓÔØ ÓÔÏ×ÂÃ¦× ÎÅ ÓЦ×ÐÁÄÁ¤ Ú Ë¦ÌØË¦ÓÔÀ ÚÎÁÞÅÎØ Õ ÓÔÒÏæ %ld"
cze "Po-Bèet sloupcù neodpovídá poètu hodnot na øádku %lu"
dan "Kolonne antallet stemmer ikke overens med antallet af værdier i post %lu"
nla "Kolom aantal komt niet overeen met waarde aantal in rij %lu"
eng "Column count doesn't match value count at row %lu"
est "Tulpade hulk erineb väärtuste hulgast real %lu"
ger "Anzahl der Felder stimmt nicht mit der Anzahl der Werte in Zeile %lu überein"
hun "Az oszlopban talalhato ertek nem egyezik meg a %lu sorban szamitott ertekkel"
ita "Il numero delle colonne non corrisponde al conteggio alla riga %lu"
kor "Row %lu¿¡¼­ Ä®·³ Ä«¿îÆ®¿Í value Ä«¿îÅÍ¿Í ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù."
por "Contagem de colunas não confere com a contagem de valores na linha %lu"
rum "Numarul de coloane nu corespunde cu numarul de valori la linia %lu"
rus "ëÏÌÉÞÅÓÔ×Ï ÓÔÏÌÂÃÏ× ÎÅ ÓÏ×ÐÁÄÁÅÔ Ó ËÏÌÉÞÅÓÔ×ÏÍ ÚÎÁÞÅÎÉÊ × ÚÁÐÉÓÉ %lu"
serbian "Broj kolona ne odgovara broju vrednosti u slogu %lu"
spa "El número de columnas no corresponde al número en la línea %lu"
swe "Antalet kolumner motsvarar inte antalet värden på rad: %lu"
ukr "ë¦ÌØË¦ÓÔØ ÓÔÏ×ÂÃ¦× ÎÅ ÓЦ×ÐÁÄÁ¤ Ú Ë¦ÌØË¦ÓÔÀ ÚÎÁÞÅÎØ Õ ÓÔÒÏæ %lu"
ER_CANT_REOPEN_TABLE
cze "Nemohu znovuotev-Bøít tabulku: '%-.192s"
dan "Kan ikke genåbne tabel '%-.192s"
@ -4887,29 +4887,29 @@ ER_CUT_VALUE_GROUP_CONCAT
swe "%d rad(er) kapades av group_concat()"
ukr "%d line(s) was(were) cut by group_concat()"
ER_WARN_TOO_FEW_RECORDS 01000
eng "Row %ld doesn't contain data for all columns"
ger "Zeile %ld enthält nicht für alle Felder Daten"
nla "Rij %ld bevat niet de data voor alle kolommen"
por "Conta de registro é menor que a conta de coluna na linha %ld"
spa "Línea %ld no contiene datos para todas las columnas"
eng "Row %lu doesn't contain data for all columns"
ger "Zeile %lu enthält nicht für alle Felder Daten"
nla "Rij %lu bevat niet de data voor alle kolommen"
por "Conta de registro é menor que a conta de coluna na linha %lu"
spa "Línea %lu no contiene datos para todas las columnas"
ER_WARN_TOO_MANY_RECORDS 01000
eng "Row %ld was truncated; it contained more data than there were input columns"
ger "Zeile %ld gekürzt, die Zeile enthielt mehr Daten, als es Eingabefelder gibt"
nla "Regel %ld ingekort, bevatte meer data dan invoer kolommen"
por "Conta de registro é maior que a conta de coluna na linha %ld"
spa "Línea %ld fué truncada; La misma contine mas datos que las que existen en las columnas de entrada"
eng "Row %lu was truncated; it contained more data than there were input columns"
ger "Zeile %lu gekürzt, die Zeile enthielt mehr Daten, als es Eingabefelder gibt"
nla "Regel %lu ingekort, bevatte meer data dan invoer kolommen"
por "Conta de registro é maior que a conta de coluna na linha %lu"
spa "Línea %lu fué truncada; La misma contine mas datos que las que existen en las columnas de entrada"
ER_WARN_NULL_TO_NOTNULL 22004
eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld"
ger "Feld auf Vorgabewert gesetzt, da NULL für NOT-NULL-Feld '%s' in Zeile %ld angegeben"
por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld"
spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la línea %ld"
eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %lu"
ger "Feld auf Vorgabewert gesetzt, da NULL für NOT-NULL-Feld '%s' in Zeile %lu angegeben"
por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %lu"
spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la línea %lu"
ER_WARN_DATA_OUT_OF_RANGE 22003
eng "Out of range value for column '%s' at row %ld"
eng "Out of range value for column '%s' at row %lu"
WARN_DATA_TRUNCATED 01000
eng "Data truncated for column '%s' at row %ld"
ger "Daten abgeschnitten für Feld '%s' in Zeile %ld"
por "Dado truncado para coluna '%s' na linha %ld"
spa "Datos truncados para columna '%s' en la línea %ld"
eng "Data truncated for column '%s' at row %lu"
ger "Daten abgeschnitten für Feld '%s' in Zeile %lu"
por "Dado truncado para coluna '%s' na linha %lu"
spa "Datos truncados para columna '%s' en la línea %lu"
ER_WARN_USING_OTHER_HANDLER
eng "Using storage engine %s for table '%s'"
ger "Für Tabelle '%s' wird Speicher-Engine %s benutzt"
@ -5090,8 +5090,8 @@ ER_UNKNOWN_TIME_ZONE
eng "Unknown or incorrect time zone: '%-.64s'"
ger "Unbekannte oder falsche Zeitzone: '%-.64s'"
ER_WARN_INVALID_TIMESTAMP
eng "Invalid TIMESTAMP value in column '%s' at row %ld"
ger "Ungültiger TIMESTAMP-Wert in Feld '%s', Zeile %ld"
eng "Invalid TIMESTAMP value in column '%s' at row %lu"
ger "Ungültiger TIMESTAMP-Wert in Feld '%s', Zeile %lu"
ER_INVALID_CHARACTER_STRING
eng "Invalid %s character string: '%.64s'"
ger "Ungültiger %s-Zeichen-String: '%.64s'"
@ -5322,8 +5322,8 @@ ER_DIVISION_BY_ZERO 22012
eng "Division by 0"
ger "Division durch 0"
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld"
ger "Falscher %-.32s-Wert: '%-.128s' für Feld '%.192s' in Zeile %ld"
eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu"
ger "Falscher %-.32s-Wert: '%-.128s' für Feld '%.192s' in Zeile %lu"
ER_ILLEGAL_VALUE_FOR_TYPE 22007
eng "Illegal %s '%-.192s' value found during parsing"
ger "Nicht zulässiger %s-Wert '%-.192s' beim Parsen gefunden"
@ -5456,8 +5456,8 @@ ER_PROC_AUTO_REVOKE_FAIL
eng "Failed to revoke all privileges to dropped routine"
ger "Rücknahme aller Rechte für die gelöschte Routine fehlgeschlagen"
ER_DATA_TOO_LONG 22001
eng "Data too long for column '%s' at row %ld"
ger "Daten zu lang für Feld '%s' in Zeile %ld"
eng "Data too long for column '%s' at row %lu"
ger "Daten zu lang für Feld '%s' in Zeile %lu"
ER_SP_BAD_SQLSTATE 42000
eng "Bad SQLSTATE: '%s'"
ger "Ungültiger SQLSTATE: '%s'"

View File

@ -1117,18 +1117,27 @@ be equal for the Statement-format replication to work";
goto err;
}
}
else if (is_network_error(mysql_errno(mysql)))
else if (is_network_error(err_code= mysql_errno(mysql)))
{
mi->report(WARNING_LEVEL, mysql_errno(mysql),
"Get master TIME_ZONE failed with error: %s", mysql_error(mysql));
mi->report(ERROR_LEVEL, err_code,
"Get master TIME_ZONE failed with error: %s",
mysql_error(mysql));
goto network_err;
}
}
else if (err_code == ER_UNKNOWN_SYSTEM_VARIABLE)
{
/* We use ERROR_LEVEL to get the error logged to file */
mi->report(ERROR_LEVEL, err_code,
"MySQL master doesn't have a TIME_ZONE variable. Note that"
"if your timezone is not same between master and slave, your "
"slave may get wrong data into timestamp columns");
}
else
{
/* Fatal error */
errmsg= "The slave I/O thread stops because a fatal error is encountered \
when it try to get the value of TIME_ZONE global variable from master.";
err_code= mysql_errno(mysql);
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
goto err;
}

View File

@ -8631,19 +8631,26 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
result=1;
}
/* Kill delayed insert threads */
if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
! in_use->killed)
if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT))
{
in_use->killed= THD::KILL_CONNECTION;
pthread_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
{
pthread_mutex_lock(in_use->mysys_var->current_mutex);
signalled= 1;
pthread_cond_broadcast(in_use->mysys_var->current_cond);
pthread_mutex_unlock(in_use->mysys_var->current_mutex);
}
pthread_mutex_unlock(&in_use->mysys_var->mutex);
if (!in_use->killed)
{
in_use->killed= THD::KILL_CONNECTION;
pthread_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
{
pthread_mutex_lock(in_use->mysys_var->current_mutex);
signalled= 1;
pthread_cond_broadcast(in_use->mysys_var->current_cond);
pthread_mutex_unlock(in_use->mysys_var->current_mutex);
}
pthread_mutex_unlock(&in_use->mysys_var->mutex);
}
/*
Don't abort locks. Instead give the delayed insert thread
time to finish it's inserts and die gracefully.
*/
continue;
}
/*
Now we must abort all tables locks used by this thread

View File

@ -2170,7 +2170,7 @@ bool select_export::send_data(List<Item> &items)
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
item->name, row_count);
item->name, (ulong) row_count);
}
cvt_str.length(bytes);
res= &cvt_str;

View File

@ -2622,7 +2622,7 @@ bool Delayed_insert::handle_inserts(void)
or if another thread is removing the current table definition
from the table cache.
*/
my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
my_error(ER_DELAYED_CANT_CHANGE_LOCK, MYF(ME_FATALERROR | ME_NOREFRESH),
table->s->table_name.str);
goto err;
}
@ -2795,10 +2795,11 @@ bool Delayed_insert::handle_inserts(void)
query_cache_invalidate3(&thd, table, 1);
if (thr_reschedule_write_lock(*thd.lock->locks))
{
/* This is not known to happen. */
my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR),
table->s->table_name.str);
goto err;
/* This is not known to happen. */
my_error(ER_DELAYED_CANT_CHANGE_LOCK,
MYF(ME_FATALERROR | ME_NOREFRESH),
table->s->table_name.str);
goto err;
}
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2008, Patrick Galbraith
Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -308,7 +308,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define MYSQL_SERVER 1q
#define MYSQL_SERVER 1
#include "mysql_priv.h"
#include <mysql/plugin.h>
@ -1627,7 +1627,13 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
{
MEM_ROOT mem_root;
txn->close(server);
if (!txn)
{
federatedx_txn tmp_txn;
tmp_txn.close(server);
}
else
txn->close(server);
DBUG_ASSERT(server->io_count == 0);
@ -1785,21 +1791,25 @@ int ha_federatedx::close(void)
if (stored_result)
retval= free_result();
/* Disconnect from mysql. thd may be null during refresh */
txn= thd ? get_txn(thd, true) : new federatedx_txn();
/* Disconnect from mysql */
if (!thd || !(txn= get_txn(thd, true)))
{
federatedx_txn tmp_txn;
if (txn)
tmp_txn.release(&io);
DBUG_ASSERT(io == NULL);
if ((error= free_share(&tmp_txn, share)))
retval= error;
}
else
{
txn->release(&io);
DBUG_ASSERT(io == NULL);
if ((error= free_share(txn, share)))
retval= error;
if (!thd)
delete txn;
}
DBUG_RETURN(retval);
}
@ -2793,14 +2803,16 @@ int ha_federatedx::rnd_end()
int ha_federatedx::free_result()
{
int error;
federatedx_io *tmp_io= 0, **iop;
DBUG_ASSERT(stored_result);
if ((error= txn->acquire(share, FALSE, &io)))
if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io))))
{
DBUG_ASSERT(0); // Fail when testing
return error;
}
io->free_result(stored_result);
(*iop)->free_result(stored_result);
stored_result= 0;
txn->release(&tmp_io);
return 0;
}
@ -2985,7 +2997,7 @@ int ha_federatedx::info(uint flag)
{
char error_buffer[FEDERATEDX_QUERY_BUFFER_SIZE];
uint error_code;
federatedx_io *tmp_io= 0;
federatedx_io *tmp_io= 0, **iop= 0;
DBUG_ENTER("ha_federatedx::info");
error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
@ -2993,7 +3005,7 @@ int ha_federatedx::info(uint flag)
/* we want not to show table status if not needed to do so */
if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
{
if ((error_code= txn->acquire(share, TRUE, &tmp_io)))
if (!*(iop= &io) && (error_code= txn->acquire(share, TRUE, (iop= &tmp_io))))
goto fail;
}
@ -3006,13 +3018,13 @@ int ha_federatedx::info(uint flag)
if (flag & HA_STATUS_CONST)
stats.block_size= 4096;
if (tmp_io->table_metadata(&stats, share->table_name,
if ((*iop)->table_metadata(&stats, share->table_name,
share->table_name_length, flag))
goto error;
}
if (flag & HA_STATUS_AUTO)
stats.auto_increment_value= tmp_io->last_insert_id();
stats.auto_increment_value= (*iop)->last_insert_id();
/*
If ::info created it's own transaction, close it. This happens in case
@ -3023,10 +3035,10 @@ int ha_federatedx::info(uint flag)
DBUG_RETURN(0);
error:
if (tmp_io)
if (iop && *iop)
{
my_sprintf(error_buffer, (error_buffer, ": %d : %s",
tmp_io->error_code(), tmp_io->error_str()));
(*iop)->error_code(), (*iop)->error_str()));
my_error(error_code, MYF(0), error_buffer);
}
else

View File

@ -1,5 +1,5 @@
MYSQL_STORAGE_ENGINE(ndbcluster, ndbcluster, [Cluster Storage Engine],
[High Availability Clustered tables], [max])
[High Availability Clustered tables],)
MYSQL_PLUGIN_DIRECTORY(ndbcluster,[storage/ndb])
MYSQL_PLUGIN_STATIC(ndbcluster, [[\$(ndbcluster_libs) \$(ndbcluster_system_libs) \$(NDB_SCI_LIBS)]])
MYSQL_PLUGIN_ACTIONS(ndbcluster,[MYSQL_SETUP_NDBCLUSTER])

View File

@ -1,6 +1,58 @@
PBXT Release Notes
==================
------- 1.0.09f RC3 - 2009-11-30
RN291: Fixed bug #489088: On shutdown MySQL reports: [Warning] Plugin 'PBXT' will be forced to shutdown.
RN290: Fixed bug #345524: pbxt does not compile on 64 bit windows. Currently atomic operations are not supported on this platform.
RN286: Fixed a bug introduced in RN281, which could cause an index scan to hang. The original change was to prevent a warning in Valgrind.
RN285: Merged changes required to compile with Drizzle.
RN284: Fixed bug that cause the error "[ERROR] Invalid (old?) table or database name 'mysqld.1'", when running temp_table.test under MariaDB (thanks to Monty for his initial bug fix). Added a fix for partition table names as well.
RN283: Added win_inttypes.h to the distribution. This file is only required for the Windows build.
RN282: Fixed bug #451101: jump or move depends on uninitialised value in myxt_get_key_length
RN281: Fixed bug #451080: Uninitialised memory write in XTDatabaseLog::xlog_append
RN280: Fixed bug #451085: jump or move depends on uninitialised value in my_type_to_string
RN279: Fixed bug #441000: xtstat crashes with segmentation fault on startup if max_pbxt_threads exceeded.
------- 1.0.09e RC3 - 2009-11-20
RN278: Fixed compile error with MySQL 5.1.41.
------- 1.0.09d RC3 - 2009-09-30
RN277: Added r/o flag to pbxt_max_threads server variable (this fix is related to bug #430637)
RN276: Added test case for replication on tables w/o PKs (see bug #430716)
RN275: Fixed bug #430600: 'Failed to read auto-increment value from storage engine' error.
RN274: Fixed bug #431240: This report is public edit xtstat fails if no PBXT table has been created. xtstat now accepts --database=information_schema or --database=pbxt. Depending on this setting PBXT will either use the information_schema.pbxt_statistics or the pbxt.statistics table. If information_schema is used, then the statistics are displayed even when no PBXT table exists. Recovery activity is also displayed, unless pbxt_support_xa=1, in which case MySQL will wait for PBXT recovery to complete before allowing connections.
RN273: Fixed bug #430633: XA_RBDEADLOCK is not returned on XA END after the transacting ended with a deadlock.
RN272: Fixed bug #430596: Backup/restore does not work well even on a basic PBXT table with auto-increment.
------- 1.0.09c RC3 - 2009-09-16
RN271: Windows build update: now you can simply put the pbxt directory under <mysql-root>/storage and build the PBXT engine as a part of the source tree. The engine will be linked statically. Be sure to specify the WITH_PBXT_STORAGE_ENGINE option when running win\configure.js
RN270: Correctly disabled PBMS so that this version now compiles under Windows. If PBMS_ENABLED is defined, PBXT will not compile under Windows becaause of a getpid() call in pbms.h.
------- 1.0.09 RC3 - 2009-09-09
RN269: Implemented online backup. A native online backup driver now performs BACKUP and RESTORE DATABASE operations for PBXT. NOTE: This feature is only supported by MySQL 6.0.9 or later.
RN268: Implemented XA support. PBXT now supports all XA related MySQL statements. The variable pbxt_support_xa determines if XA support is enabled. Note: due to MySQL bug #47134, enabling XA support could lead to a crash.
------- 1.0.08d RC2 - 2009-09-02
RN267: Fixed a bug that caused MySQL to crash on shutdown, after an incorrect command line parameter was given. The crash occurred because the background recovery task was not cleaned up before the PBXT engine was de-initialized.

View File

@ -22,7 +22,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.h ccutils_xt.h database_xt.h \
pbms_enabled.h sortedlist_xt.h strutil_xt.h \
tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
systab_xt.h ha_xtsys.h discover_xt.h \
systab_xt.h ha_xtsys.h discover_xt.h backup_xt.h \
pbms.h xt_config.h xt_defs.h xt_errno.h locklist_xt.h
EXTRA_LTLIBRARIES = libpbxt.la
@ -32,7 +32,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \
memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
sortedlist_xt.cc strutil_xt.cc \
tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
systab_xt.cc ha_xtsys.cc discover_xt.cc \
systab_xt.cc ha_xtsys.cc discover_xt.cc backup_xt.cc \
util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
libpbxt_la_LDFLAGS = -module

View File

@ -0,0 +1,802 @@
/* Copyright (c) 2009 PrimeBase Technologies GmbH
*
* PrimeBase XT
*
* 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
*
* 2009-09-07 Paul McCullagh
*
* H&G2JCtL
*/
#include "xt_config.h"
#ifdef MYSQL_SUPPORTS_BACKUP
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include "mysql_priv.h"
#include <backup/api_types.h>
#include <backup/backup_engine.h>
#include <backup/backup_aux.h> // for build_table_list()
#include <hash.h>
#include "ha_pbxt.h"
#include "backup_xt.h"
#include "pthread_xt.h"
#include "filesys_xt.h"
#include "database_xt.h"
#include "strutil_xt.h"
#include "memory_xt.h"
#include "trace_xt.h"
#include "myxt_xt.h"
#ifdef OK
#undef OK
#endif
#ifdef byte
#undef byte
#endif
#ifdef DEBUG
//#define TRACE_BACKUP_CALLS
//#define TEST_SMALL_BLOCK 100000
#endif
using backup::byte;
using backup::result_t;
using backup::version_t;
using backup::Table_list;
using backup::Table_ref;
using backup::Buffer;
#ifdef TRACE_BACKUP_CALLS
#define XT_TRACE_CALL() ha_trace_function(__FUNC__, NULL)
#else
#define XT_TRACE_CALL()
#endif
#define XT_RESTORE_BATCH_SIZE 10000
#define BUP_STATE_BEFORE_LOCK 0
#define BUP_STATE_AFTER_LOCK 1
#define BUP_STANDARD_VAR_RECORD 1
#define BUP_RECORD_BLOCK_4_START 2 // Part of a record, with a 4 byte total length, and 4 byte data length
#define BUP_RECORD_BLOCK_4 3 // Part of a record, with a 4 byte length
#define BUP_RECORD_BLOCK_4_END 4 // Last part of a record with a 4 byte length
/*
* -----------------------------------------------------------------------
* UTILITIES
*/
#ifdef TRACE_BACKUP_CALLS
static void ha_trace_function(const char *function, char *table)
{
char func_buf[50], *ptr;
XTThreadPtr thread = xt_get_self();
if ((ptr = strchr(function, '('))) {
ptr--;
while (ptr > function) {
if (!(isalnum(*ptr) || *ptr == '_'))
break;
ptr--;
}
ptr++;
xt_strcpy(50, func_buf, ptr);
if ((ptr = strchr(func_buf, '(')))
*ptr = 0;
}
else
xt_strcpy(50, func_buf, function);
if (table)
printf("%s %s (%s)\n", thread ? thread->t_name : "-unknown-", func_buf, table);
else
printf("%s %s\n", thread ? thread->t_name : "-unknown-", func_buf);
}
#endif
/*
* -----------------------------------------------------------------------
* BACKUP DRIVER
*/
class PBXTBackupDriver: public Backup_driver
{
public:
PBXTBackupDriver(const Table_list &);
virtual ~PBXTBackupDriver();
virtual size_t size();
virtual size_t init_size();
virtual result_t begin(const size_t);
virtual result_t end();
virtual result_t get_data(Buffer &);
virtual result_t prelock();
virtual result_t lock();
virtual result_t unlock();
virtual result_t cancel();
virtual void free();
void lock_tables_TL_READ_NO_INSERT();
private:
XTThreadPtr bd_thread;
int bd_state;
u_int bd_table_no;
XTOpenTablePtr bd_ot;
xtWord1 *bd_row_buf;
/* Non-zero if we last returned only part of
* a row.
*/
xtWord1 *db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *size, xtWord4 row_len);
xtWord1 *db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *size, xtWord4 total_len, xtWord4 row_len);
xtWord4 bd_row_offset;
xtWord4 bd_row_size;
};
PBXTBackupDriver::PBXTBackupDriver(const Table_list &tables):
Backup_driver(tables),
bd_state(BUP_STATE_BEFORE_LOCK),
bd_table_no(0),
bd_ot(NULL),
bd_row_buf(NULL),
bd_row_offset(0),
bd_row_size(0)
{
}
PBXTBackupDriver::~PBXTBackupDriver()
{
}
/** Estimates total size of backup. @todo improve it */
size_t PBXTBackupDriver::size()
{
XT_TRACE_CALL();
return UNKNOWN_SIZE;
}
/** Estimates size of backup before lock. @todo improve it */
size_t PBXTBackupDriver::init_size()
{
XT_TRACE_CALL();
return 0;
}
result_t PBXTBackupDriver::begin(const size_t)
{
THD *thd = current_thd;
XTExceptionRec e;
XT_TRACE_CALL();
if (!(bd_thread = xt_ha_set_current_thread(thd, &e))) {
xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
return backup::ERROR;
}
return backup::OK;
}
result_t PBXTBackupDriver::end()
{
XT_TRACE_CALL();
if (bd_ot) {
xt_tab_seq_exit(bd_ot);
xt_db_return_table_to_pool_ns(bd_ot);
bd_ot = NULL;
}
if (bd_thread->st_xact_data) {
if (!xt_xn_commit(bd_thread))
return backup::ERROR;
}
return backup::OK;
}
xtWord1 *PBXTBackupDriver::db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *ret_size, xtWord4 row_len)
{
register size_t size = *ret_size;
*buffer = bup_type; // Record type identifier.
buffer++;
size--;
memcpy(buffer, bd_ot->ot_row_wbuffer, row_len);
buffer += row_len;
size -= row_len;
*ret_size = size;
return buffer;
}
xtWord1 *PBXTBackupDriver::db_write_block(xtWord1 *buffer, xtWord1 bup_type, size_t *ret_size, xtWord4 total_len, xtWord4 row_len)
{
register size_t size = *ret_size;
*buffer = bup_type; // Record type identifier.
buffer++;
size--;
if (bup_type == BUP_RECORD_BLOCK_4_START) {
XT_SET_DISK_4(buffer, total_len);
buffer += 4;
size -= 4;
}
XT_SET_DISK_4(buffer, row_len);
buffer += 4;
size -= 4;
memcpy(buffer, bd_ot->ot_row_wbuffer+bd_row_offset, row_len);
buffer += row_len;
size -= row_len;
bd_row_size -= row_len;
bd_row_offset += row_len;
*ret_size = size;
return buffer;
}
result_t PBXTBackupDriver::get_data(Buffer &buf)
{
xtBool eof = FALSE;
size_t size;
xtWord4 row_len;
xtWord1 *buffer;
XT_TRACE_CALL();
if (bd_state == BUP_STATE_BEFORE_LOCK) {
buf.table_num = 0;
buf.size = 0;
buf.last = FALSE;
return backup::READY;
}
/* Open the backup table: */
if (!bd_ot) {
XTThreadPtr self = bd_thread;
XTTableHPtr tab;
char path[PATH_MAX];
if (bd_table_no == m_tables.count()) {
buf.size = 0;
buf.table_num = 0;
buf.last = TRUE;
return backup::DONE;
}
m_tables[bd_table_no].internal_name(path, sizeof(path));
bd_table_no++;
try_(a) {
xt_ha_open_database_of_table(self, (XTPathStrPtr) path);
tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL);
pushr_(xt_heap_release, tab);
if (!(bd_ot = xt_db_open_table_using_tab(tab, bd_thread)))
xt_throw(self);
freer_(); // xt_heap_release(tab)
/* Prepare the seqential scan: */
xt_tab_seq_exit(bd_ot);
if (!xt_tab_seq_init(bd_ot))
xt_throw(self);
if (bd_row_buf) {
xt_free(self, bd_row_buf);
bd_row_buf = NULL;
}
bd_row_buf = (xtWord1 *) xt_malloc(self, bd_ot->ot_table->tab_dic.dic_mysql_buf_size);
bd_ot->ot_cols_req = bd_ot->ot_table->tab_dic.dic_no_of_cols;
}
catch_(a) {
;
}
cont_(a);
if (!bd_ot)
goto failed;
}
buf.table_num = bd_table_no;
#ifdef TEST_SMALL_BLOCK
buf.size = TEST_SMALL_BLOCK;
#endif
size = buf.size;
buffer = (xtWord1 *) buf.data;
ASSERT_NS(size > 9);
/* First check of a record was partically written
* last time.
*/
write_row:
if (bd_row_size > 0) {
row_len = bd_row_size;
if (bd_row_offset == 0) {
if (row_len+1 > size) {
ASSERT_NS(size > 9);
row_len = size - 9;
buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4_START, &size, bd_row_size, row_len);
goto done;
}
buffer = db_write_block(buffer, BUP_STANDARD_VAR_RECORD, &size, row_len);
bd_row_size = 0;
}
else {
if (row_len+5 > size) {
row_len = size - 5;
buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4, &size, 0, row_len);
goto done;
}
buffer = db_write_block(buffer, BUP_RECORD_BLOCK_4_END, &size, 0, row_len);
}
}
/* Now continue with the sequential scan. */
while (size > 1) {
if (!xt_tab_seq_next(bd_ot, bd_row_buf, &eof))
goto failed;
if (eof) {
/* We will go the next table, on the next call. */
xt_tab_seq_exit(bd_ot);
xt_db_return_table_to_pool_ns(bd_ot);
bd_ot = NULL;
break;
}
if (!(row_len = myxt_store_row_data(bd_ot, 0, (char *) bd_row_buf)))
goto failed;
if (row_len+1 > size) {
/* Does not fit: */
bd_row_offset = 0;
bd_row_size = row_len;
/* Only add part of the row, if there is still
* quite a bit of space left:
*/
if (size >= (32 * 1024))
goto write_row;
break;
}
buffer = db_write_block(buffer, BUP_STANDARD_VAR_RECORD, &size, row_len);
}
done:
buf.size = buf.size - size;
/* This indicates wnd of data for a table! */
buf.last = eof;
return backup::OK;
failed:
xt_log_and_clear_exception(bd_thread);
return backup::ERROR;
}
result_t PBXTBackupDriver::prelock()
{
XT_TRACE_CALL();
return backup::READY;
}
result_t PBXTBackupDriver::lock()
{
XT_TRACE_CALL();
bd_thread->st_xact_mode = XT_XACT_COMMITTED_READ;
bd_thread->st_ignore_fkeys = FALSE;
bd_thread->st_auto_commit = FALSE;
bd_thread->st_table_trans = FALSE;
bd_thread->st_abort_trans = FALSE;
bd_thread->st_stat_ended = FALSE;
bd_thread->st_stat_trans = FALSE;
bd_thread->st_is_update = FALSE;
if (!xt_xn_begin(bd_thread))
return backup::ERROR;
bd_state = BUP_STATE_AFTER_LOCK;
return backup::OK;
}
result_t PBXTBackupDriver::unlock()
{
XT_TRACE_CALL();
return backup::OK;
}
result_t PBXTBackupDriver::cancel()
{
XT_TRACE_CALL();
return backup::OK; // free() will be called and suffice
}
void PBXTBackupDriver::free()
{
XT_TRACE_CALL();
if (bd_ot) {
xt_tab_seq_exit(bd_ot);
xt_db_return_table_to_pool_ns(bd_ot);
bd_ot = NULL;
}
if (bd_row_buf) {
xt_free_ns(bd_row_buf);
bd_row_buf = NULL;
}
if (bd_thread->st_xact_data)
xt_xn_rollback(bd_thread);
delete this;
}
void PBXTBackupDriver::lock_tables_TL_READ_NO_INSERT()
{
XT_TRACE_CALL();
}
/*
* -----------------------------------------------------------------------
* BACKUP DRIVER
*/
class PBXTRestoreDriver: public Restore_driver
{
public:
PBXTRestoreDriver(const Table_list &tables);
virtual ~PBXTRestoreDriver();
virtual result_t begin(const size_t);
virtual result_t end();
virtual result_t send_data(Buffer &buf);
virtual result_t cancel();
virtual void free();
private:
XTThreadPtr rd_thread;
u_int rd_table_no;
XTOpenTablePtr rd_ot;
STRUCT_TABLE *rd_my_table;
xtWord1 *rb_row_buf;
u_int rb_col_cnt;
u_int rb_insert_count;
/* Long rows are accumulated here: */
xtWord4 rb_row_len;
xtWord4 rb_data_size;
xtWord1 *rb_row_data;
};
PBXTRestoreDriver::PBXTRestoreDriver(const Table_list &tables):
Restore_driver(tables),
rd_thread(NULL),
rd_table_no(0),
rd_ot(NULL),
rb_row_buf(NULL),
rb_row_len(0),
rb_data_size(0),
rb_row_data(NULL)
{
}
PBXTRestoreDriver::~PBXTRestoreDriver()
{
}
result_t PBXTRestoreDriver::begin(const size_t)
{
THD *thd = current_thd;
XTExceptionRec e;
XT_TRACE_CALL();
if (!(rd_thread = xt_ha_set_current_thread(thd, &e))) {
xt_log_exception(NULL, &e, XT_LOG_DEFAULT);
return backup::ERROR;
}
return backup::OK;
}
result_t PBXTRestoreDriver::end()
{
XT_TRACE_CALL();
if (rd_ot) {
xt_db_return_table_to_pool_ns(rd_ot);
rd_ot = NULL;
}
//if (rb_row_buf) {
// xt_free_ns(rb_row_buf);
// rb_row_buf = NULL;
//}
if (rb_row_data) {
xt_free_ns(rb_row_data);
rb_row_data = NULL;
}
if (rd_thread->st_xact_data) {
if (!xt_xn_commit(rd_thread))
return backup::ERROR;
}
return backup::OK;
}
result_t PBXTRestoreDriver::send_data(Buffer &buf)
{
size_t size;
xtWord1 type;
xtWord1 *buffer;
xtWord4 row_len;
xtWord1 *rec_data;
XT_TRACE_CALL();
if (buf.table_num != rd_table_no) {
XTThreadPtr self = rd_thread;
XTTableHPtr tab;
char path[PATH_MAX];
if (rd_ot) {
xt_db_return_table_to_pool_ns(rd_ot);
rd_ot = NULL;
}
if (rd_thread->st_xact_data) {
if (!xt_xn_commit(rd_thread))
goto failed;
}
if (!xt_xn_begin(rd_thread))
goto failed;
rb_insert_count = 0;
rd_table_no = buf.table_num;
m_tables[rd_table_no-1].internal_name(path, sizeof(path));
try_(a) {
xt_ha_open_database_of_table(self, (XTPathStrPtr) path);
tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL);
pushr_(xt_heap_release, tab);
if (!(rd_ot = xt_db_open_table_using_tab(tab, rd_thread)))
xt_throw(self);
freer_(); // xt_heap_release(tab)
rd_my_table = rd_ot->ot_table->tab_dic.dic_my_table;
if (rd_my_table->found_next_number_field) {
rd_my_table->in_use = current_thd;
rd_my_table->next_number_field = rd_my_table->found_next_number_field;
rd_my_table->mark_columns_used_by_index_no_reset(rd_my_table->s->next_number_index, rd_my_table->read_set);
}
/* This is safe because only one thread can restore a table at
* a time!
*/
rb_row_buf = (xtWord1 *) rd_my_table->record[0];
//if (rb_row_buf) {
// xt_free(self, rb_row_buf);
// rb_row_buf = NULL;
//}
//rb_row_buf = (xtWord1 *) xt_malloc(self, rd_ot->ot_table->tab_dic.dic_mysql_buf_size);
rb_col_cnt = rd_ot->ot_table->tab_dic.dic_no_of_cols;
}
catch_(a) {
;
}
cont_(a);
if (!rd_ot)
goto failed;
}
buffer = (xtWord1 *) buf.data;
size = buf.size;
while (size > 0) {
type = *buffer;
switch (type) {
case BUP_STANDARD_VAR_RECORD:
rec_data = buffer + 1;
break;
case BUP_RECORD_BLOCK_4_START:
buffer++;
row_len = XT_GET_DISK_4(buffer);
buffer += 4;
if (rb_data_size < row_len) {
if (!xt_realloc_ns((void **) &rb_row_data, row_len))
goto failed;
rb_data_size = row_len;
}
row_len = XT_GET_DISK_4(buffer);
buffer += 4;
ASSERT_NS(row_len <= rb_data_size);
if (row_len > rb_data_size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
memcpy(rb_row_data, buffer, row_len);
rb_row_len = row_len;
buffer += row_len;
if (row_len + 9 > size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
size -= row_len + 9;
continue;
case BUP_RECORD_BLOCK_4:
buffer++;
row_len = XT_GET_DISK_4(buffer);
buffer += 4;
ASSERT_NS(rb_row_len + row_len <= rb_data_size);
if (rb_row_len + row_len > rb_data_size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
memcpy(rb_row_data + rb_row_len, buffer, row_len);
rb_row_len += row_len;
buffer += row_len;
if (row_len + 5 > size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
size -= row_len + 5;
continue;
case BUP_RECORD_BLOCK_4_END:
buffer++;
row_len = XT_GET_DISK_4(buffer);
buffer += 4;
ASSERT_NS(rb_row_len + row_len <= rb_data_size);
if (rb_row_len + row_len > rb_data_size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
memcpy(rb_row_data + rb_row_len, buffer, row_len);
buffer += row_len;
if (row_len + 5 > size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
size -= row_len + 5;
rec_data = rb_row_data;
break;
default:
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
if (!(row_len = myxt_load_row_data(rd_ot, rec_data, rb_row_buf, rb_col_cnt)))
goto failed;
if (rd_ot->ot_table->tab_dic.dic_my_table->found_next_number_field)
ha_set_auto_increment(rd_ot, rd_ot->ot_table->tab_dic.dic_my_table->found_next_number_field);
if (!xt_tab_new_record(rd_ot, rb_row_buf))
goto failed;
if (type == BUP_STANDARD_VAR_RECORD) {
buffer += row_len+1;
if (row_len + 1 > size) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_BAD_BACKUP_FORMAT);
goto failed;
}
size -= row_len + 1;
}
rb_insert_count++;
if (rb_insert_count == XT_RESTORE_BATCH_SIZE) {
if (!xt_xn_commit(rd_thread))
goto failed;
if (!xt_xn_begin(rd_thread))
goto failed;
rb_insert_count = 0;
}
}
return backup::OK;
failed:
xt_log_and_clear_exception(rd_thread);
return backup::ERROR;
}
result_t PBXTRestoreDriver::cancel()
{
XT_TRACE_CALL();
/* Nothing to do in cancel(); free() will suffice */
return backup::OK;
}
void PBXTRestoreDriver::free()
{
XT_TRACE_CALL();
if (rd_ot) {
xt_db_return_table_to_pool_ns(rd_ot);
rd_ot = NULL;
}
//if (rb_row_buf) {
// xt_free_ns(rb_row_buf);
// rb_row_buf = NULL;
//}
if (rb_row_data) {
xt_free_ns(rb_row_data);
rb_row_data = NULL;
}
if (rd_thread->st_xact_data)
xt_xn_rollback(rd_thread);
delete this;
}
/*
* -----------------------------------------------------------------------
* BACKUP ENGINE FACTORY
*/
#define PBXT_BACKUP_VERSION 1
class PBXTBackupEngine: public Backup_engine
{
public:
PBXTBackupEngine() { };
virtual version_t version() const {
return PBXT_BACKUP_VERSION;
};
virtual result_t get_backup(const uint32, const Table_list &, Backup_driver* &);
virtual result_t get_restore(const version_t, const uint32, const Table_list &,Restore_driver* &);
virtual void free()
{
delete this;
}
};
result_t PBXTBackupEngine::get_backup(const u_int count, const Table_list &tables, Backup_driver* &drv)
{
PBXTBackupDriver *ptr = new PBXTBackupDriver(tables);
if (!ptr)
return backup::ERROR;
drv = ptr;
return backup::OK;
}
result_t PBXTBackupEngine::get_restore(const version_t ver, const uint32,
const Table_list &tables, Restore_driver* &drv)
{
if (ver > PBXT_BACKUP_VERSION)
{
return backup::ERROR;
}
PBXTRestoreDriver *ptr = new PBXTRestoreDriver(tables);
if (!ptr)
return backup::ERROR;
drv = (Restore_driver *) ptr;
return backup::OK;
}
Backup_result_t pbxt_backup_engine(handlerton *self, Backup_engine* &be)
{
be = new PBXTBackupEngine();
if (!be)
return backup::ERROR;
return backup::OK;
}
#endif

View File

@ -0,0 +1,34 @@
/* Copyright (c) 2009 PrimeBase Technologies GmbH
*
* PrimeBase XT
*
* 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
*
* 2009-09-07 Paul McCullagh
*
* H&G2JCtL
*/
#ifndef __backup_xt_h__
#define __backup_xt_h__
#include "xt_defs.h"
#ifdef MYSQL_SUPPORTS_BACKUP
Backup_result_t pbxt_backup_engine(handlerton *self, Backup_engine* &be);
#endif
#endif

View File

@ -73,7 +73,7 @@
#define IDX_CAC_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->cs_lock, (o)->t_id)
#elif defined(IDX_CAC_USE_PTHREAD_RW)
#define IDX_CAC_LOCK_TYPE xt_rwlock_type
#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock(s, &(i)->cs_lock)
#define IDX_CAC_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, &(i)->cs_lock)
#define IDX_CAC_FREE_LOCK(s, i) xt_free_rwlock(&(i)->cs_lock)
#define IDX_CAC_READ_LOCK(i, o) xt_slock_rwlock_ns(&(i)->cs_lock)
#define IDX_CAC_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->cs_lock)
@ -94,8 +94,12 @@
#define IDX_CAC_UNLOCK(i, s) xt_spinxslock_unlock(&(i)->cs_lock, (s)->t_id)
#endif
#ifdef XT_NO_ATOMICS
#define ID_HANDLE_USE_PTHREAD_RW
#else
#define ID_HANDLE_USE_SPINLOCK
//#define ID_HANDLE_USE_PTHREAD_RW
#endif
#if defined(ID_HANDLE_USE_PTHREAD_RW)
#define ID_HANDLE_LOCK_TYPE xt_mutex_type
@ -374,7 +378,7 @@ xtPublic void xt_ind_release_handle(XTIndHandlePtr handle, xtBool have_lock, XTT
{
DcHandleSlotPtr hs;
XTIndBlockPtr block = NULL;
u_int hash_idx = 0;
u_int hash_idx = 0;
DcSegmentPtr seg = NULL;
XTIndBlockPtr xblock;
@ -1379,7 +1383,7 @@ xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID ad
ASSERT_NS(iref->ir_xlock == 2);
#endif
if (!(block = ind_cac_fetch(ot, ind, address, &seg, TRUE)))
return 0;
return FAILED;
branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2);
if (XT_GET_INDEX_BLOCK_LEN(branch_size) < 2 || XT_GET_INDEX_BLOCK_LEN(branch_size) > XT_INDEX_PAGE_SIZE) {

View File

@ -62,7 +62,7 @@ struct XTIdxReadBuffer;
#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
#elif defined(XT_IPAGE_USE_PTHREAD_RW)
#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)

View File

@ -54,6 +54,8 @@
* GLOBALS
*/
xtPublic XTDatabaseHPtr pbxt_database = NULL; // The global open database
xtPublic xtLogOffset xt_db_log_file_threshold;
xtPublic size_t xt_db_log_buffer_size;
xtPublic size_t xt_db_transaction_buffer_size;
@ -505,6 +507,15 @@ xtPublic XTDatabaseHPtr xt_get_database(XTThreadPtr self, char *path, xtBool mul
* all index entries that are not visible have
* been removed.
*
* REASON WHY WE SET ROWID ON RECOVERY:
* The row ID is set on recovery because the
* change to the index may be lost after a crash.
* The change to the index is done by the sweeper, and
* there is no record of this change in the log.
* The sweeper will not "re-sweep" all transations
* that are recovered. As a result, this upadte
* of the index by the sweeper may be lost.
*
* {OPEN-DB-SWEEPER-WAIT}
* This has been moved to after the release of the open
* database lock because:
@ -518,9 +529,12 @@ xtPublic XTDatabaseHPtr xt_get_database(XTThreadPtr self, char *path, xtBool mul
* - To open the database it needs the open database
* lock.
*/
/*
* This has been moved, see: {WAIT-FOR-SW-AFTER-RECOV}
pushr_(xt_heap_release, db);
xt_wait_for_sweeper(self, db, 0);
popr_();
*/
return db;
}

View File

@ -105,6 +105,8 @@ typedef struct XTTablePath {
#define XT_THREAD_IDLE 1
#define XT_THREAD_INERR 2
#define XT_XA_HASH_TAB_SIZE 223
typedef struct XTDatabase : public XTHeap {
char *db_name; /* The name of the database, last component of the path! */
char *db_main_path;
@ -131,6 +133,9 @@ typedef struct XTDatabase : public XTHeap {
u_int db_stat_sweep_waits; /* STATISTICS: count the sweeper waits. */
XTDatabaseLogRec db_xlog; /* The transaction log for this database. */
XTXactRestartRec db_restart; /* Database recovery stuff. */
xt_mutex_type db_xn_xa_lock;
XTXactPreparePtr db_xn_xa_table[XT_XA_HASH_TAB_SIZE];
XTSortedListPtr db_xn_xa_list; /* The "wait-for" list, of transactions waiting for other transactions. */
XTSortedListPtr db_xn_wait_for; /* The "wait-for" list, of transactions waiting for other transactions. */
u_int db_xn_call_start; /* Start of the post wait calls. */
@ -198,6 +203,7 @@ void xt_check_database(XTThreadPtr self);
void xt_add_pbxt_file(size_t size, char *path, const char *file);
void xt_add_location_file(size_t size, char *path);
void xt_add_pbxt_dir(size_t size, char *path);
void xt_add_system_dir(size_t size, char *path);
void xt_add_data_dir(size_t size, char *path);
@ -244,4 +250,6 @@ inline void xt_xlog_check_long_writer(XTThreadPtr thread)
}
}
extern XTDatabaseHPtr pbxt_database; // The global open database
#endif

View File

@ -35,7 +35,7 @@
#ifdef DEBUG
#ifdef DRIZZLED
#include <drizzled/common_includes.h>
//#include <drizzled/common_includes.h>
#else
#include "mysql_priv.h"
#endif
@ -437,11 +437,6 @@ class XTTokenizer {
XTToken *nextToken(XTThreadPtr self, c_char *keyword, XTToken *tk);
};
void ri_free_token(XTThreadPtr XT_UNUSED(self), XTToken *tk)
{
delete tk;
}
XTToken *XTTokenizer::newToken(XTThreadPtr self, u_int type, char *start, char *end)
{
if (!tkn_current) {

View File

@ -410,7 +410,7 @@ static void dl_recover_log(XTThreadPtr self, XTDatabaseHPtr db, XTDataLogFilePtr
ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
if ((size_t) data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
if (data_log->dlf_log_eof < (off_t) sizeof(XTXactLogHeaderDRec)) {
data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
xt_throw(self);
@ -1162,7 +1162,7 @@ xtBool XTDataLogBuffer::dlb_close_log(XTThreadPtr thread)
/* When I use 'thread' instead of 'self', this means
* that I will not throw an error.
*/
xtBool XTDataLogBuffer::dlb_get_log_offset(xtLogID *log_id, xtLogOffset *out_offset, size_t req_size, struct XTThread *thread)
xtBool XTDataLogBuffer::dlb_get_log_offset(xtLogID *log_id, xtLogOffset *out_offset, size_t XT_UNUSED(req_size), struct XTThread *thread)
{
/* Note, I am allowing a log to grow beyond the threshold.
* The amount depends on the maximum extended record size.
@ -1757,7 +1757,7 @@ static xtBool dl_collect_garbage(XTThreadPtr self, XTDatabaseHPtr db, XTDataLogF
freer_(); // xt_unlock_mutex(&db->db_co_dlog_lock)
/* Flush the transaction log. */
if (!xt_xlog_flush_log(self))
if (!xt_xlog_flush_log(db, self))
xt_throw(self);
xt_lock_mutex_ns(&db->db_datalogs.dlc_head_lock);
@ -1891,7 +1891,7 @@ static xtBool dl_collect_garbage(XTThreadPtr self, XTDatabaseHPtr db, XTDataLogF
freer_(); // xt_unlock_mutex(&db->db_co_dlog_lock)
/* Flush the transaction log. */
if (!xt_xlog_flush_log(self))
if (!xt_xlog_flush_log(db, self))
xt_throw(self);
/* Save state in source log header. */

View File

@ -31,6 +31,9 @@
#include <drizzled/session.h>
#include <drizzled/server_includes.h>
#include <drizzled/sql_base.h>
#include <drizzled/statement/alter_table.h>
#include <algorithm>
#include <sstream>
#endif
#include "strutil_xt.h"
@ -39,18 +42,273 @@
#include "ha_xtsys.h"
#ifndef DRIZZLED
#if MYSQL_VERSION_ID > 60005
#if MYSQL_VERSION_ID >= 50404
#define DOT_STR(x) x.str
#else
#define DOT_STR(x) x
#endif
#endif
#ifndef DRIZZLED
//#ifndef DRIZZLED
#define LOCK_OPEN_HACK_REQUIRED
#endif // DRIZZLED
//#endif // DRIZZLED
#ifdef LOCK_OPEN_HACK_REQUIRED
#ifdef DRIZZLED
using namespace drizzled;
using namespace std;
#define mysql_create_table_no_lock hacked_mysql_create_table_no_lock
namespace drizzled {
int rea_create_table(Session *session, const char *path,
const char *db, const char *table_name,
message::Table *table_proto,
HA_CREATE_INFO *create_info,
List<CreateField> &create_field,
uint32_t key_count,KEY *key_info);
}
static uint32_t build_tmptable_filename(Session* session,
char *buff, size_t bufflen)
{
uint32_t length;
ostringstream path_str, post_tmpdir_str;
string tmp;
path_str << drizzle_tmpdir;
post_tmpdir_str << "/" << TMP_FILE_PREFIX << current_pid;
post_tmpdir_str << session->thread_id << session->tmp_table++;
tmp= post_tmpdir_str.str();
transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
path_str << tmp;
if (bufflen < path_str.str().length())
length= 0;
else
length= unpack_filename(buff, path_str.str().c_str());
return length;
}
static bool mysql_create_table_no_lock(Session *session,
const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
message::Table *table_proto,
AlterInfo *alter_info,
bool internal_tmp_table,
uint32_t select_field_count)
{
char path[FN_REFLEN];
uint32_t path_length;
uint db_options, key_count;
KEY *key_info_buffer;
Cursor *file;
bool error= true;
/* Check for duplicate fields and check type of table to create */
if (!alter_info->create_list.elements)
{
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
MYF(0));
return true;
}
assert(strcmp(table_name,table_proto->name().c_str())==0);
if (check_engine(session, table_name, create_info))
return true;
db_options= create_info->table_options;
if (create_info->row_type == ROW_TYPE_DYNAMIC)
db_options|=HA_OPTION_PACK_RECORD;
/*if (!(file= create_info->db_type->getCursor((TableShare*) 0, session->mem_root)))
{
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
return true;
}*/
/* PMC - Done to avoid getting the partition handler by mistake! */
if (!(file= new (session->mem_root) ha_xtsys(pbxt_hton, NULL)))
{
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
return true;
}
set_table_default_charset(create_info, (char*) db);
if (mysql_prepare_create_table(session,
create_info,
table_proto,
alter_info,
internal_tmp_table,
&db_options, file,
&key_info_buffer, &key_count,
select_field_count))
goto err;
/* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
path_length= build_tmptable_filename(session, path, sizeof(path));
}
else
{
#ifdef FN_DEVCHAR
/* check if the table name contains FN_DEVCHAR when defined */
if (strchr(table_name, FN_DEVCHAR))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name);
return true;
}
#endif
path_length= build_table_filename(path, sizeof(path), db, table_name, internal_tmp_table);
}
/* Check if table already exists */
if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
session->find_temporary_table(db, table_name))
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
create_info->table_existed= 1; // Mark that table existed
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
table_name);
error= 0;
goto err;
}
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
goto err;
}
//pthread_mutex_lock(&LOCK_open); /* CREATE TABLE (some confussion on naming, double check) */
if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
if (plugin::StorageEngine::getTableDefinition(*session,
path,
db,
table_name,
internal_tmp_table) == EEXIST)
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
error= false;
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
table_name);
create_info->table_existed= 1; // Mark that table existed
}
else
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto unlock_and_end;
}
/*
* We don't assert here, but check the result, because the table could be
* in the table definition cache and in the same time the .frm could be
* missing from the disk, in case of manual intervention which deletes
* the .frm file. The user has to use FLUSH TABLES; to clear the cache.
* Then she could create the table. This case is pretty obscure and
* therefore we don't introduce a new error message only for it.
* */
if (TableShare::getShare(db, table_name))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
goto unlock_and_end;
}
}
/*
* Check that table with given name does not already
* exist in any storage engine. In such a case it should
* be discovered and the error ER_TABLE_EXISTS_ERROR be returned
* unless user specified CREATE TABLE IF EXISTS
* The LOCK_open mutex has been locked to make sure no
* one else is attempting to discover the table. Since
* it's not on disk as a frm file, no one could be using it!
* */
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
bool create_if_not_exists =
create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
char table_path[FN_REFLEN];
uint32_t table_path_length;
table_path_length= build_table_filename(table_path, sizeof(table_path),
db, table_name, false);
int retcode= plugin::StorageEngine::getTableDefinition(*session,
table_path,
db,
table_name,
false);
switch (retcode)
{
case ENOENT:
/* Normal case, no table exists. we can go and create it */
break;
case EEXIST:
if (create_if_not_exists)
{
error= false;
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
table_name);
create_info->table_existed= 1; // Mark that table existed
goto unlock_and_end;
}
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto unlock_and_end;
default:
my_error(retcode, MYF(0),table_name);
goto unlock_and_end;
}
}
session->set_proc_info("creating table");
create_info->table_existed= 0; // Mark that table is created
create_info->table_options=db_options;
if (rea_create_table(session, path, db, table_name,
table_proto,
create_info, alter_info->create_list,
key_count, key_info_buffer))
goto unlock_and_end;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
/* Open table and put in temporary table list */
if (!(session->open_temporary_table(path, db, table_name, 1, OTM_OPEN)))
{
(void) session->rm_temporary_table(create_info->db_type, path);
goto unlock_and_end;
}
}
/*
* Don't write statement if:
* - It is an internal temporary table,
* - Row-based logging is used and it we are creating a temporary table, or
* - The binary log is not open.
* Otherwise, the statement shall be binlogged.
* */
if (!internal_tmp_table &&
((!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
write_bin_log(session, session->query, session->query_length);
error= false;
unlock_and_end:
//pthread_mutex_unlock(&LOCK_open);
err:
session->set_proc_info("After create");
delete file;
return(error);
}
#else // MySQL case
///////////////////////////////
/*
* Unfortunately I cannot use the standard mysql_create_table_no_lock() because it will lock "LOCK_open"
@ -1229,13 +1487,13 @@ static bool mysql_create_table_no_lock(THD *thd,
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
/* Open table and put in temporary table list */
#if MYSQL_VERSION_ID > 60005
#if MYSQL_VERSION_ID >= 50404
if (!(open_temporary_table(thd, path, db, table_name, 1, OTM_OPEN)))
#else
if (!(open_temporary_table(thd, path, db, table_name, 1)))
#endif
{
#if MYSQL_VERSION_ID > 60005
#if MYSQL_VERSION_ID >= 50404
(void) rm_temporary_table(create_info->db_type, path, false);
#else
(void) rm_temporary_table(create_info->db_type, path);
@ -1252,11 +1510,21 @@ static bool mysql_create_table_no_lock(THD *thd,
- The binary log is not open.
Otherwise, the statement shall be binlogged.
*/
/* PBXT 1.0.09e
* Firstly we had a compile problem with MySQL 5.1.42 and
* the write_bin_log() call below:
* discover_xt.cc:1259: error: argument of type 'char* (Statement::)()' does not match 'const char*'
*
* And secondly, we should no write the BINLOG anyway because this is
* an internal PBXT system table.
*
* So I am just commenting out the code altogether.
if (!internal_tmp_table &&
(!thd->current_stmt_binlog_row_based ||
(thd->current_stmt_binlog_row_based &&
!(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
write_bin_log(thd, TRUE, thd->query, thd->query_length);
*/
error= FALSE;
unlock_and_end:
pthread_mutex_unlock(&LOCK_open);
@ -1279,37 +1547,51 @@ warn:
////// END OF CUT AND PASTES FROM sql_table.cc ////////
////////////////////////////////////////////////////////
#endif // DRIZZLED
#endif // LOCK_OPEN_HACK_REQUIRED
//------------------------------
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
{
#ifdef DRIZZLED
drizzled::message::Table table_proto;
#define MYLEX_CREATE_INFO create_info
#else
#define MYLEX_CREATE_INFO mylex.create_info
#endif
#ifdef DRIZZLED
drizzled::statement::AlterTable *stmt = new drizzled::statement::AlterTable(thd);
HA_CREATE_INFO create_info;
//AlterInfo alter_info;
drizzled::message::Table table_proto;
static const char *ext = ".dfe";
static const int ext_len = 4;
table_proto.mutable_engine()->mutable_name()->assign("PBXT");
#else
static const char *ext = ".frm";
static const int ext_len = 4;
#endif
int err = 1;
//HA_CREATE_INFO create_info = {0};
//Alter_info alter_info;
char field_length_buffer[12], *field_length_ptr;
LEX *save_lex= thd->lex, mylex;
memset(&mylex.create_info, 0, sizeof(HA_CREATE_INFO));
memset(&MYLEX_CREATE_INFO, 0, sizeof(HA_CREATE_INFO));
thd->lex = &mylex;
lex_start(thd);
lex_start(thd);
#ifdef DRIZZLED
mylex.statement = stmt;
#endif
/* setup the create info */
mylex.create_info.db_type = hton;
MYLEX_CREATE_INFO.db_type = hton;
#ifndef DRIZZLED
mylex.create_info.frm_only = 1;
#endif
mylex.create_info.default_table_charset = system_charset_info;
MYLEX_CREATE_INFO.default_table_charset = system_charset_info;
/* setup the column info. */
while (info->field_name) {
@ -1335,7 +1617,7 @@ int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *
#else
if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
info->field_flags,
#if MYSQL_VERSION_ID > 60005
#if MYSQL_VERSION_ID >= 50404
HA_SM_DISK,
COLUMN_FORMAT_TYPE_FIXED,
#endif
@ -1370,7 +1652,7 @@ int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *
table_proto.set_name(name);
table_proto.set_type(drizzled::message::Table::STANDARD);
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
if (mysql_create_table_no_lock(thd, db, name, &create_info, &table_proto, &stmt->alter_info, 1, 0))
goto error;
#else
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))

View File

@ -56,6 +56,8 @@
//#define DEBUG_TRACE_FILES
//#define INJECT_WRITE_REMAP_ERROR
/* This is required to make testing on the Mac faster: */
/* It turns of full file sync. */
#define DEBUG_FAST_MAC
#endif
#ifdef DEBUG_TRACE_FILES
@ -63,10 +65,6 @@
#define PRINTF xt_trace
#endif
#if defined(XT_MAC) && defined(F_FULLFSYNC)
#undef F_FULLFSYNC
#endif
#ifdef INJECT_WRITE_REMAP_ERROR
#define INJECT_REMAP_FILE_SIZE 1000000
#define INJECT_REMAP_FILE_TYPE "xtd"
@ -883,7 +881,7 @@ xtPublic xtBool xt_flush_file(XTOpenFilePtr of, XTIOStatsPtr stat, XTThreadPtr X
* fsync didn't really flush index pages to disk. fcntl(F_FULLFSYNC) is considered more effective
* in such case.
*/
#ifdef F_FULLFSYNC
#if defined(F_FULLFSYNC) && !defined(DEBUG_FAST_MAC)
if (fcntl(of->of_filedes, F_FULLFSYNC, 0) == -1) {
xt_register_ferrno(XT_REG_CONTEXT, errno, xt_file_path(of));
goto failed;

View File

@ -102,7 +102,7 @@ xtBool xt_fs_rename(struct XTThread *self, char *from_path, char *to_path);
#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_PTHREAD_RW)
#define FILE_MAP_LOCK_TYPE xt_rwlock_type
#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More