Commit a7bc87b3 authored by Kristofer Pettersson's avatar Kristofer Pettersson

Automerge

parents 58a4beef 66e14f22
......@@ -2714,6 +2714,9 @@ then
sql_server="vio sql"
fi
# "innochecksum" is not in the "innobase/" subdirectory, but should be switched
AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$with_plugin_innobase" = Xyes])
# IMPORTANT - do not modify LIBS past this line - this hack is the only way
# I know to add the static NSS magic if we have static NSS libraries with
# glibc - Sasha
......
......@@ -43,7 +43,12 @@ $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
bin_PROGRAMS = replace perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid innochecksum
resolve_stack_dump mysql_waitpid
# "innochecksum" should be switched
if BUILD_INNODB_TOOLS
bin_PROGRAMS += innochecksum
endif
noinst_PROGRAMS = charset2html
EXTRA_PROGRAMS = comp_err
EXTRA_DIST = CMakeLists.txt
......
......@@ -21,5 +21,9 @@ man1_MANS = @man1_files@
man8_MANS = @man8_files@
EXTRA_DIST = $(man1_MANS) $(man8_MANS)
# "make_win_*" are not needed in Unix binary packages,
install-data-hook:
rm -f $(DESTDIR)$(manlibdir)/man1/make_win_*
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -1098,6 +1098,17 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
drop table t1;
CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2);
INSERT INTO t1 VALUES ('a');
SET @@sql_mode=pad_char_to_full_length;
SELECT HEX(s1) FROM t1;
HEX(s1)
00610020002000200020
SET @@sql_mode=default;
SELECT HEX(s1) FROM t1;
HEX(s1)
0061
DROP TABLE t1;
set collation_connection=ucs2_general_ci;
drop table if exists t1;
create table t1 as
......
Bug#37938 - Test "mysqldump" lacks various insert statements
Turn off concurrent inserts to avoid random errors
NOTE: We reset the variable back to saved value at the end of test
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;
drop database if exists db1;
......@@ -4089,6 +4094,7 @@ DROP DATABASE mysqldump_test_db;
# -- End of test case for Bug#32538.
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
#
# End of 5.1 tests
#
......@@ -354,16 +354,52 @@ select * from t1 where a = 12;
a b c
12 403 NULL
drop table t1;
create table t1 (a int not null, b varchar(10)) engine=ndb;
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
create table t1(a int not null) engine=ndb;
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
PRIMARY KEY($PK) - UniqueHashIndex
insert into t1 values (1),(2),(3);
alter table t1 add primary key (a);
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 0 NULL NULL BTREE
a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
PRIMARY KEY(a) - UniqueHashIndex
PRIMARY(a) - OrderedIndex
update t1 set a = 17 where a = 1;
select * from t1 order by a;
a
2
3
17
alter table t1 drop primary key;
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
PRIMARY KEY($PK) - UniqueHashIndex
update t1 set a = 1 where a = 17;
select * from t1 order by a;
a
1
2
3
drop table t1;
create table t1(a int not null) engine=ndb;
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
PRIMARY KEY($PK) - UniqueHashIndex
insert into t1 values (1),(2),(3);
create unique index pk on t1(a);
a Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
PRIMARY KEY(a) - UniqueHashIndex
update t1 set a = 17 where a = 1;
select * from t1 order by a;
a
2
3
17
alter table t1 drop index pk;
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
PRIMARY KEY($PK) - UniqueHashIndex
update t1 set a = 1 where a = 17;
select * from t1 order by a;
a
1
2
3
drop table t1;
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
show create table t1;
......
......@@ -411,13 +411,32 @@ select * from t1 where a = 12;
drop table t1;
# some other ALTER combinations
# add/drop pk
create table t1 (a int not null, b varchar(10)) engine=ndb;
show index from t1;
# Check add/drop primary key (not supported on-line)
create table t1(a int not null) engine=ndb;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
insert into t1 values (1),(2),(3);
alter table t1 add primary key (a);
show index from t1;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
update t1 set a = 17 where a = 1;
select * from t1 order by a;
alter table t1 drop primary key;
show index from t1;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
update t1 set a = 1 where a = 17;
select * from t1 order by a;
drop table t1;
# bug#31233 mysql_alter_table() fails to drop UNIQUE KEY
create table t1(a int not null) engine=ndb;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
insert into t1 values (1),(2),(3);
create unique index pk on t1(a);
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
update t1 set a = 17 where a = 1;
select * from t1 order by a;
alter table t1 drop index pk;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep PRIMARY
update t1 set a = 1 where a = 17;
select * from t1 order by a;
drop table t1;
# alter .. alter
......
......@@ -32,13 +32,13 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 223 Query 1 287 BEGIN
master-bin.000001 287 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
master-bin.000001 385 Write_rows 1 157 table_id: #
master-bin.000001 444 Write_rows 1 204 table_id: # flags: STMT_END_F
master-bin.000001 491 Query 1 556 COMMIT
master-bin.000001 556 Query 1 636 use `test`; TRUNCATE TABLE t1
master-bin.000001 636 Query 1 712 use `test`; DROP TABLE t1
master-bin.000001 287 Table_map 1 330 table_id: # (test.t1)
master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status)
master-bin.000001 392 Write_rows 1 451 table_id: #
master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F
master-bin.000001 498 Query 1 563 COMMIT
master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1
master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1
**** On Master ****
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2);
......@@ -68,24 +68,24 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 223 Query 1 287 BEGIN
master-bin.000001 287 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
master-bin.000001 385 Write_rows 1 157 table_id: #
master-bin.000001 444 Write_rows 1 204 table_id: # flags: STMT_END_F
master-bin.000001 491 Query 1 556 COMMIT
master-bin.000001 556 Query 1 636 use `test`; TRUNCATE TABLE t1
master-bin.000001 636 Query 1 712 use `test`; DROP TABLE t1
master-bin.000001 712 Query 1 829 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 829 Query 1 893 BEGIN
master-bin.000001 893 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 933 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
master-bin.000001 991 Write_rows 1 157 table_id: #
master-bin.000001 1050 Write_rows 1 204 table_id: # flags: STMT_END_F
master-bin.000001 1097 Query 1 1162 COMMIT
master-bin.000001 1162 Query 1 1226 BEGIN
master-bin.000001 1226 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 1266 Table_map 1 98 table_id: # (mysql.ndb_apply_status)
master-bin.000001 1324 Write_rows 1 157 table_id: #
master-bin.000001 1383 Delete_rows 1 196 table_id: # flags: STMT_END_F
master-bin.000001 1422 Query 1 1487 COMMIT
master-bin.000001 1487 Query 1 1563 use `test`; DROP TABLE t1
master-bin.000001 287 Table_map 1 330 table_id: # (test.t1)
master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status)
master-bin.000001 392 Write_rows 1 451 table_id: #
master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F
master-bin.000001 498 Query 1 563 COMMIT
master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1
master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1
master-bin.000001 719 Query 1 836 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 836 Query 1 900 BEGIN
master-bin.000001 900 Table_map 1 943 table_id: # (test.t1)
master-bin.000001 943 Table_map 1 1005 table_id: # (mysql.ndb_apply_status)
master-bin.000001 1005 Write_rows 1 1064 table_id: #
master-bin.000001 1064 Write_rows 1 1111 table_id: # flags: STMT_END_F
master-bin.000001 1111 Query 1 1176 COMMIT
master-bin.000001 1176 Query 1 1240 BEGIN
master-bin.000001 1240 Table_map 1 1283 table_id: # (test.t1)
master-bin.000001 1283 Table_map 1 1345 table_id: # (mysql.ndb_apply_status)
master-bin.000001 1345 Write_rows 1 1404 table_id: #
master-bin.000001 1404 Delete_rows 1 1443 table_id: # flags: STMT_END_F
master-bin.000001 1443 Query 1 1508 COMMIT
master-bin.000001 1508 Query 1 1584 use `test`; DROP TABLE t1
# Same test as rpl_truncate_7ndb.test, but with mixed mode
# This is marked with 'big_test' just because the rpl_truncate_7ndb test is
# so slow...
# Last Change: 2008-09-03
# Change Author: pcrews
# Change: Moved test to rpl_ndb suite, updated location of --source .test file
--source include/have_binlog_format_mixed.inc
--source include/big_test.inc
--source t/rpl_truncate_7ndb.test
--source suite/rpl_ndb/t/rpl_truncate_7ndb.test
......@@ -678,6 +678,17 @@ select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
drop table t1;
#
# Bug#35720 ucs2 + pad_char_to_full_length = failure
#
CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2);
INSERT INTO t1 VALUES ('a');
SET @@sql_mode=pad_char_to_full_length;
SELECT HEX(s1) FROM t1;
SET @@sql_mode=default;
SELECT HEX(s1) FROM t1;
DROP TABLE t1;
set collation_connection=ucs2_general_ci;
--source include/ctype_regex.inc
set names latin1;
......
......@@ -5,6 +5,14 @@
# Binlog is required
--source include/have_log_bin.inc
--echo Bug#37938 - Test "mysqldump" lacks various insert statements
--echo Turn off concurrent inserts to avoid random errors
--echo NOTE: We reset the variable back to saved value at the end of test
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;
......@@ -1593,6 +1601,7 @@ DROP TABLE t1,t2;
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
--exec $MYSQL_DUMP test
--echo #
--echo # End of 5.0 tests
--echo #
......@@ -1859,6 +1868,10 @@ DROP DATABASE mysqldump_test_db;
--echo # -- End of test case for Bug#32538.
--echo
# We reset concurrent_inserts value to whatever it was at the start of the test
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
###########################################################################
--echo #
......
......@@ -317,6 +317,7 @@ void my_write_core(int sig)
#else /* __WIN__*/
#include <dbghelp.h>
#include <tlhelp32.h>
/*
Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll)
......@@ -409,6 +410,63 @@ void my_set_exception_pointers(EXCEPTION_POINTERS *ep)
exception_ptrs = ep;
}
/*
Get symbol path - semicolon-separated list of directories to search for debug
symbols. We expect PDB in the same directory as corresponding exe or dll,
so the path is build from directories of the loaded modules. If environment
variable _NT_SYMBOL_PATH is set, it's value appended to the symbol search path
*/
static void get_symbol_path(char *path, size_t size)
{
HANDLE hSnap;
char *envvar;
path[0]= '\0';
/*
Enumerate all modules, and add their directories to the path.
Avoid duplicate entries.
*/
hSnap= CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
if (hSnap != INVALID_HANDLE_VALUE)
{
BOOL ret;
MODULEENTRY32 mod;
mod.dwSize= sizeof(MODULEENTRY32);
for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod))
{
char *module_dir= mod.szExePath;
char *p= strrchr(module_dir,'\\');
if (!p)
{
/*
Path separator was not found. Not known to happen, if ever happens,
will indicate current directory.
*/
module_dir[0]= '.';
p= module_dir + 1;
}
*p++= ';';
*p= '\0';
if (!strstr(path, module_dir))
{
strncat(path, module_dir, size);
}
}
CloseHandle(hSnap);
}
/* Add _NT_SYMBOL_PATH, if present. */
envvar= getenv("_NT_SYMBOL_PATH");
if(envvar)
{
strncat(path, envvar, size);
}
}
#define MAX_SYMBOL_PATH 32768
/* Platform SDK in VS2003 does not have definition for SYMOPT_NO_PROMPTS*/
#ifndef SYMOPT_NO_PROMPTS
#define SYMOPT_NO_PROMPTS 0
......@@ -425,6 +483,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
int i;
CONTEXT context;
STACKFRAME64 frame={0};
static char symbol_path[MAX_SYMBOL_PATH+1];
if(!exception_ptrs || !init_dbghelp_functions())
return;
......@@ -433,7 +492,8 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
context = *(exception_ptrs->ContextRecord);
/*Initialize symbols.*/
pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
pSymInitialize(hProcess,NULL,TRUE);
get_symbol_path(symbol_path, MAX_SYMBOL_PATH);
pSymInitialize(hProcess, symbol_path, TRUE);
/*Prepare stackframe for the first StackWalk64 call*/
frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat;
......
......@@ -385,6 +385,9 @@ copyfileto $BASE/include config.h include/*
rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
# In a NetWare binary package, these tools and their manuals are not useful
rm -f $BASE/man/man1/make_win_*
copyfileto $BASE/support-files support-files/*
copyfileto $BASE/share scripts/*.sql
......@@ -427,6 +430,7 @@ fi
rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
$BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
$BASE/bin/make_win_* \
$BASE/bin/setsomevars $BASE/support-files/Makefile* \
$BASE/support-files/*.sh
......
......@@ -6610,7 +6610,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
uint length;
if (table->in_use->variables.sql_mode &
MODE_PAD_CHAR_TO_FULL_LENGTH)
length= my_charpos(field_charset, ptr, ptr + field_length, field_length);
length= my_charpos(field_charset, ptr, ptr + field_length,
field_length / field_charset->mbmaxlen);
else
length= field_charset->cset->lengthsp(field_charset, (const char*) ptr,
field_length);
......
......@@ -9971,34 +9971,23 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
if (table_changes != IS_EQUAL_YES)
DBUG_RETURN(COMPATIBLE_DATA_NO);
/**
* Changing from/to primary key
*
* This is _not_ correct, but check_if_incompatible_data-interface
* doesnt give more info, so I guess that we can't do any
* online add index if not using primary key
*
* This as mysql will handle a unique not null index as primary
* even wo/ user specifiying it... :-(
*
*/
if ((table_share->primary_key == MAX_KEY && pk) ||
(table_share->primary_key != MAX_KEY && !pk) ||
(table_share->primary_key == MAX_KEY && !pk && ai))
{
DBUG_RETURN(COMPATIBLE_DATA_NO);
}
/* Check that auto_increment value was not changed */
if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
create_info->auto_increment_value != 0)
{
DBUG_PRINT("info", ("auto_increment value changed"));
DBUG_RETURN(COMPATIBLE_DATA_NO);
}
/* Check that row format didn't change */
if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
get_row_type() != create_info->row_type)
{
DBUG_PRINT("info", ("row format changed"));
DBUG_RETURN(COMPATIBLE_DATA_NO);
}
DBUG_PRINT("info", ("new table seems compatible"));
DBUG_RETURN(COMPATIBLE_DATA_YES);
}
......
......@@ -2240,6 +2240,7 @@ uint build_table_shadow_filename(char *buff, size_t bufflen,
#define FN_TO_IS_TMP (1 << 1)
#define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP)
#define NO_FRM_RENAME (1 << 2)
#define FRM_ONLY (1 << 3)
/* from hostname.cc */
struct in_addr;
......
......@@ -1835,8 +1835,9 @@ bool quick_rm_table(handlerton *base,const char *db,
if (my_delete(path,MYF(0)))
error= 1; /* purecov: inspected */
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
DBUG_RETURN(ha_delete_table(current_thd, base, path, db, table_name, 0) ||
error);
if (!(flags & FRM_ONLY))
error|= ha_delete_table(current_thd, base, path, db, table_name, 0);
DBUG_RETURN(error);
}
/*
......@@ -5163,6 +5164,7 @@ err:
index_drop_count OUT The number of elements in the array.
index_add_buffer OUT An array of offsets into key_info_buffer.
index_add_count OUT The number of elements in the array.
candidate_key_count OUT The number of candidate keys in original table.
DESCRIPTION
'table' (first argument) contains information of the original
......@@ -5193,7 +5195,8 @@ compare_tables(TABLE *table,
enum_alter_table_change_level *need_copy_table,
KEY **key_info_buffer,
uint **index_drop_buffer, uint *index_drop_count,
uint **index_add_buffer, uint *index_add_count)
uint **index_add_buffer, uint *index_add_count,
uint *candidate_key_count)
{
Field **f_ptr, *field;
uint changes= 0, tmp;
......@@ -5208,6 +5211,9 @@ compare_tables(TABLE *table,
create_info->varchar will be reset in mysql_prepare_create_table.
*/
bool varchar= create_info->varchar;
bool not_nullable= true;
DBUG_ENTER("compare_tables");
/*
Create a copy of alter_info.
To compare the new and old table definitions, we need to "prepare"
......@@ -5225,24 +5231,21 @@ compare_tables(TABLE *table,
*/
Alter_info tmp_alter_info(*alter_info, thd->mem_root);
uint db_options= 0; /* not used */
DBUG_ENTER("compare_tables");
/* Create the prepared information. */
if (mysql_prepare_create_table(thd, create_info,
&tmp_alter_info,
(table->s->tmp_table != NO_TMP_TABLE),
&db_options,
table->file, key_info_buffer,
&key_count, 0))
&tmp_alter_info,
(table->s->tmp_table != NO_TMP_TABLE),
&db_options,
table->file, key_info_buffer,
&key_count, 0))
DBUG_RETURN(1);
/* Allocate result buffers. */
if (! (*index_drop_buffer=
(uint*) thd->alloc(sizeof(uint) * table->s->keys)) ||
(uint*) thd->alloc(sizeof(uint) * table->s->keys)) ||
! (*index_add_buffer=
(uint*) thd->alloc(sizeof(uint) * tmp_alter_info.key_list.elements)))
(uint*) thd->alloc(sizeof(uint) * tmp_alter_info.key_list.elements)))
DBUG_RETURN(1);
/*
Some very basic checks. If number of fields changes, or the
handler, we need to run full ALTER TABLE. In the future
......@@ -5355,12 +5358,29 @@ compare_tables(TABLE *table,
*/
*index_drop_count= 0;
*index_add_count= 0;
*candidate_key_count= 0;
for (table_key= table->key_info; table_key < table_key_end; table_key++)
{
KEY_PART_INFO *table_part;
KEY_PART_INFO *table_part_end= table_key->key_part + table_key->key_parts;
KEY_PART_INFO *new_part;
/*
Check if key is a candidate key, i.e. a unique index with no index
fields nullable, then key is either already primary key or could
be promoted to primary key if the original primary key is dropped.
Count all candidate keys.
*/
not_nullable= true;
for (table_part= table_key->key_part;
table_part < table_part_end;
table_part++)
{
not_nullable= not_nullable && (! table_part->field->maybe_null());
}
if ((table_key->flags & HA_NOSAME) && not_nullable)
(*candidate_key_count)++;
/* Search a new key with the same name. */
for (new_key= *key_info_buffer; new_key < new_key_end; new_key++)
{
......@@ -5986,13 +6006,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint *index_drop_buffer;
uint index_add_count;
uint *index_add_buffer;
uint candidate_key_count;
bool committed= 0;
bool no_pk;
DBUG_ENTER("mysql_alter_table");
LINT_INIT(index_add_count);
LINT_INIT(index_drop_count);
LINT_INIT(index_add_buffer);
LINT_INIT(index_drop_buffer);
LINT_INIT(candidate_key_count);
/*
Check if we attempt to alter mysql.slow_log or
......@@ -6403,7 +6426,8 @@ view_err:
&need_copy_table_res,
&key_info_buffer,
&index_drop_buffer, &index_drop_count,
&index_add_buffer, &index_add_count))
&index_add_buffer, &index_add_count,
&candidate_key_count))
goto err;
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
......@@ -6437,20 +6461,40 @@ view_err:
DBUG_PRINT("info", ("index dropped: '%s'", key->name));
if (key->flags & HA_NOSAME)
{
/* Unique key. Check for "PRIMARY". */
if (! my_strcasecmp(system_charset_info,
key->name, primary_key_name))
/*
Unique key. Check for "PRIMARY".
or if dropping last unique key
*/
if ((uint) (key - table->key_info) == table->s->primary_key)
{
DBUG_PRINT("info", ("Dropping primary key"));
/* Primary key. */
needed_online_flags|= HA_ONLINE_DROP_PK_INDEX;
needed_fast_flags|= HA_ONLINE_DROP_PK_INDEX_NO_WRITES;
pk_changed++;
candidate_key_count--;
}
else
{
KEY_PART_INFO *part_end= key->key_part + key->key_parts;
bool is_candidate_key= true;
/* Non-primary unique key. */
needed_online_flags|= HA_ONLINE_DROP_UNIQUE_INDEX;
needed_fast_flags|= HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES;
/*
Check if all fields in key are declared
NOT NULL and adjust candidate_key_count
*/
for (KEY_PART_INFO *key_part= key->key_part;
key_part < part_end;
key_part++)
is_candidate_key=
(is_candidate_key &&
(! table->field[key_part->fieldnr-1]->maybe_null()));
if (is_candidate_key)
candidate_key_count--;
}
}
else
......@@ -6460,7 +6504,8 @@ view_err:
needed_fast_flags|= HA_ONLINE_DROP_INDEX_NO_WRITES;
}
}
no_pk= ((table->s->primary_key == MAX_KEY) ||
(needed_online_flags & HA_ONLINE_DROP_PK_INDEX));
/* Check added indexes. */
for (idx_p= index_add_buffer, idx_end_p= idx_p + index_add_count;
idx_p < idx_end_p;
......@@ -6470,14 +6515,38 @@ view_err:
DBUG_PRINT("info", ("index added: '%s'", key->name));
if (key->flags & HA_NOSAME)
{
/* Unique key. Check for "PRIMARY". */
if (! my_strcasecmp(system_charset_info,
key->name, primary_key_name))
/* Unique key */
KEY_PART_INFO *part_end= key->key_part + key->key_parts;
bool is_candidate_key= true;
/*
Check if all fields in key are declared
NOT NULL
*/
for (KEY_PART_INFO *key_part= key->key_part;
key_part < part_end;
key_part++)
is_candidate_key=
(is_candidate_key &&
(! table->field[key_part->fieldnr]->maybe_null()));
/*
Check for "PRIMARY"
or if adding first unique key
defined on non-nullable fields
*/
if ((!my_strcasecmp(system_charset_info,
key->name, primary_key_name)) ||
(no_pk && candidate_key_count == 0 && is_candidate_key))
{
DBUG_PRINT("info", ("Adding primary key"));
/* Primary key. */
needed_online_flags|= HA_ONLINE_ADD_PK_INDEX;
needed_fast_flags|= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
pk_changed++;
no_pk= false;
}
else
{
......@@ -6494,6 +6563,20 @@ view_err:
}
}
if ((candidate_key_count > 0) &&
(needed_online_flags & HA_ONLINE_DROP_PK_INDEX))
{
/*
Dropped primary key when there is some other unique
not null key that should be converted to primary key
*/
needed_online_flags|= HA_ONLINE_ADD_PK_INDEX;
needed_fast_flags|= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
pk_changed= 2;
}
DBUG_PRINT("info", ("needed_online_flags: 0x%lx, needed_fast_flags: 0x%lx",
needed_online_flags, needed_fast_flags));
/*
Online or fast add/drop index is possible only if
the primary key is not added and dropped in the same statement.
......@@ -6992,7 +7075,10 @@ err1:
close_temporary_table(thd, new_table, 1, 1);
}
else
VOID(quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP));
VOID(quick_rm_table(new_db_type, new_db, tmp_name,
create_info->frm_only
? FN_IS_TMP | FRM_ONLY
: FN_IS_TMP));
err:
/*
......
......@@ -32,11 +32,6 @@
%{?_with_cluster:%define CLUSTER_BUILD 1}
%{!?_with_cluster:%define CLUSTER_BUILD 0}
# use "rpmbuild --with federated" or "rpm --define '_with_federated 1'" (for RPM 3.x)
# to build with federated support (off by default)
%{?_with_federated:%define FEDERATED_BUILD 1}
%{!?_with_federated:%define FEDERATED_BUILD 0}
%if %{STATIC_BUILD}
%define release 0
%else
......@@ -342,11 +337,7 @@ BuildMySQL "--enable-shared \
--with-archive-storage-engine \
--with-csv-storage-engine \
--with-blackhole-storage-engine \
%if %{FEDERATED_BUILD}
--with-federated-storage-engine \
%else
--without-federated-storage-engine \
%endif
--with-partition \
--with-big-tables \
--with-comment=\"MySQL Community Server - Debug (GPL)\"")
......@@ -378,11 +369,7 @@ BuildMySQL "--enable-shared \
--with-archive-storage-engine \
--with-csv-storage-engine \
--with-blackhole-storage-engine \
%if %{FEDERATED_BUILD}
--with-federated-storage-engine \
%else
--without-federated-storage-engine \
%endif
--with-partition \
--with-embedded-server \
--with-big-tables \
......@@ -445,6 +432,9 @@ install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
# Install embedded server library in the build root
install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/
# in RPMs, it is unlikely that anybody should use "sql-bench"
rm -fr $RBR%{_datadir}/sql-bench
# Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this.
ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql
......@@ -636,6 +626,7 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info*
%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1*
%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
......@@ -654,12 +645,14 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1*
%doc %attr(644, root, man) %{_mandir}/man1/perror.1*
%doc %attr(644, root, man) %{_mandir}/man1/replace.1*
%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
%ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd
%attr(755, root, root) %{_bindir}/innochecksum
%attr(755, root, root) %{_bindir}/my_print_defaults
%attr(755, root, root) %{_bindir}/myisam_ftdump
%attr(755, root, root) %{_bindir}/myisamchk
......@@ -700,6 +693,7 @@ fi
%attr(755, root, root) %{_bindir}/msql2mysql
%attr(755, root, root) %{_bindir}/mysql
%attr(755, root, root) %{_bindir}/mysql_find_rows
%attr(755, root, root) %{_bindir}/mysql_upgrade_shell
%attr(755, root, root) %{_bindir}/mysql_waitpid
%attr(755, root, root) %{_bindir}/mysqlaccess
%attr(755, root, root) %{_bindir}/mysqladmin
......@@ -712,6 +706,7 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/msql2mysql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_find_rows.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlaccess.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqladmin.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbinlog.1*
......@@ -757,6 +752,8 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/ndb_config.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_desc.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_error_reporter.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_mgm.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_restore.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_print_backup_file.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_print_schema_file.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_print_sys_file.1*
......@@ -768,13 +765,14 @@ fi
%files ndb-extra
%defattr(-,root,root,0755)
%attr(755, root, root) %{_sbindir}/ndb_cpcd
%attr(755, root, root) %{_bindir}/ndb_delete_all
%attr(755, root, root) %{_bindir}/ndb_drop_index
%attr(755, root, root) %{_bindir}/ndb_drop_table
%attr(755, root, root) %{_sbindir}/ndb_cpcd
%doc %attr(644, root, man) %{_mandir}/man1/ndb_delete_all.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_index.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_table.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_cpcd.1*
%endif
%files devel
......@@ -785,6 +783,7 @@ fi
%dir %attr(755, root, root) %{_includedir}/mysql
%dir %attr(755, root, root) %{_libdir}/mysql
%{_includedir}/mysql/*
%{_datadir}/aclocal/mysql.m4
%{_libdir}/mysql/libdbug.a
%{_libdir}/mysql/libheap.a
%if %{have_libgcc}
......@@ -834,6 +833,24 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Fri Aug 29 2008 Kent Boortz <kent@mysql.com>
- Removed the "Federated" storage engine option, and enabled in all
* Tue Aug 26 2008 Joerg Bruehe <joerg@mysql.com>
- Get rid of the "warning: Installed (but unpackaged) file(s) found:"
Some generated files aren't needed in RPMs:
- the "sql-bench/" subdirectory
Some files were missing:
- /usr/share/aclocal/mysql.m4 ("devel" subpackage)
- Manual "mysqlbug" ("server" subpackage)
- Program "innochecksum" and its manual ("server" subpackage)
- Manual "mysql_find_rows" ("client" subpackage)
- Script "mysql_upgrade_shell" ("client" subpackage)
- Program "ndb_cpcd" and its manual ("ndb-extra" subpackage)
- Manuals "ndb_mgm" + "ndb_restore" ("ndb-tools" subpackage)
* Mon Mar 31 2008 Kent Boortz <kent@mysql.com>
- Made the "Federated" storage engine an option
......
......@@ -31,7 +31,17 @@ try
var end= supp_version.indexOf("-");
if (end == -1) end= supp_version.length;
var app_version= supp_version.substring(0, end);
app_version+= ".0";
var fourth_element= 0;
if(app_version.match(/[a-z]$/)) {
fourth_element+= (1 + app_version.charCodeAt(end-1) - "a".charCodeAt(0));
app_version= app_version.substring(0,--end);
}
if(app_version.match(/sp[1-9]$/)) {
fourth_element+= 100*(app_version.charCodeAt(end-1) - "0".charCodeAt(0));
app_version= app_version.substring(0, end-3);
end-= 3;
}
app_version+= "." + fourth_element;
break;
case "arch":
var app_arch= parts[1];
......
......@@ -7,10 +7,10 @@
/* @(#) $Id$ */
#include "zutil.h"
#include <stdio.h>
#include "zutil.h"
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment