Commit c4f98591 authored by Andrei Elkin's avatar Andrei Elkin

merge from 5.5 to local tree.

parents 95fdeb89 bd71cfc4
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=18 MYSQL_VERSION_PATCH=19
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=
...@@ -156,6 +156,7 @@ ${CURSES_INCLUDE_PATH} ...@@ -156,6 +156,7 @@ ${CURSES_INCLUDE_PATH}
SET(LIBEDIT_SOURCES SET(LIBEDIT_SOURCES
chared.c chared.c
chartype.c
el.c el.c
eln.c eln.c
history.c history.c
......
...@@ -42,7 +42,7 @@ then merge remaining bits by hand. All MySQL-specific changes should be ...@@ -42,7 +42,7 @@ then merge remaining bits by hand. All MySQL-specific changes should be
marked with XXXMYSQL to make them easier to identify and merge. To generate marked with XXXMYSQL to make them easier to identify and merge. To generate
a 'clean' diff against upstream you can use the above commands but use a 'clean' diff against upstream you can use the above commands but use
cvs co -D "2011/10/04 15:27:04" [..] cvs co -D "2011/10/23 17:37:55" [..]
to fetch the baseline of most recent merge. to fetch the baseline of most recent merge.
......
/* $NetBSD: chared.c,v 1.35 2011/08/16 16:25:15 christos Exp $ */ /* $NetBSD: chared.c,v 1.36 2011/10/23 17:37:55 christos Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
...@@ -200,7 +200,7 @@ c_delbefore1(EditLine *el) ...@@ -200,7 +200,7 @@ c_delbefore1(EditLine *el)
protected int protected int
ce__isword(Int p) ce__isword(Int p)
{ {
return Isalnum(p || Strchr(STR("*?_-.[]~="), p) != NULL); return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL;
} }
......
...@@ -258,9 +258,6 @@ out: ...@@ -258,9 +258,6 @@ out:
return NULL; return NULL;
} }
#ifdef WIDECHAR
int wcwidth(wchar_t wc); // Signature.
#endif
protected int protected int
ct_visual_width(Char c) ct_visual_width(Char c)
......
...@@ -247,15 +247,6 @@ int tok_str(Tokenizer *, const char *, ...@@ -247,15 +247,6 @@ int tok_str(Tokenizer *, const char *,
/* /*
* Begin Wide Character Support * Begin Wide Character Support
*/ */
#ifdef __linux__
/* Apparently we need _GNU_SOURCE defined to get access to wcsdup on Linux */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif
#include <wchar.h>
#include <wctype.h>
/* /*
* Wide character versions * Wide character versions
......
...@@ -40,8 +40,6 @@ static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; ...@@ -40,8 +40,6 @@ static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
#endif #endif
#endif /* not lint && not SCCSID */ #endif /* not lint && not SCCSID */
#include "chartype.c" /* XXXMYSQL */
/* /*
* refresh.c: Lower level screen refreshing functions * refresh.c: Lower level screen refreshing functions
*/ */
......
...@@ -92,8 +92,21 @@ size_t strlcpy(char *dst, const char *src, size_t size); ...@@ -92,8 +92,21 @@ size_t strlcpy(char *dst, const char *src, size_t size);
char *fgetln(FILE *fp, size_t *len); char *fgetln(FILE *fp, size_t *len);
#endif #endif
#ifndef HAVE_WCSDUP #ifdef __linux__
/* Apparently we need _GNU_SOURCE defined to get access to wcsdup on Linux */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include <wchar.h> #include <wchar.h>
#include <wctype.h>
#ifndef HAVE_WCSDUP
wchar_t *wcsdup(const wchar_t *); wchar_t *wcsdup(const wchar_t *);
#endif #endif
......
...@@ -636,9 +636,6 @@ mc_again: ...@@ -636,9 +636,6 @@ mc_again:
el->el_cursor.h = where; /* now where is here */ el->el_cursor.h = where; /* now where is here */
} }
#ifdef WIDECHAR
int wcwidth(wchar_t); // Signature.
#endif
/* terminal_overwrite(): /* terminal_overwrite():
* Overstrike num characters * Overstrike num characters
......
...@@ -12823,3 +12823,22 @@ a b c d e f ...@@ -12823,3 +12823,22 @@ a b c d e f
-1 b c d e 1 -1 b c d e 1
DROP TABLE t1; DROP TABLE t1;
SET sort_buffer_size=DEFAULT; SET sort_buffer_size=DEFAULT;
#
# BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS
# TESTS: CRASH, CORRUPTION, 4G MEMOR
# (to be executed with valgrind)
CREATE TABLE t1(a BLOB, b VARCHAR(200)) ENGINE=ARCHIVE;
INSERT INTO t1 VALUES(NULL, '');
FLUSH TABLE t1;
# we need this select to workaround BUG#11764364
SELECT * FROM t1;
a b
NULL
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 286155052
FLUSH TABLE t1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
...@@ -2414,6 +2414,30 @@ CARDINALITY ...@@ -2414,6 +2414,30 @@ CARDINALITY
DROP TABLE t1; DROP TABLE t1;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_repair_threads=@@global.myisam_repair_threads;
#
# BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN
# USING MYISAM_USE_MMAP ON WINDOWS
#
SET GLOBAL myisam_use_mmap=1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1),(2);
DELETE FROM t1 WHERE a=1;
FLUSH TABLE t1;
LOCK TABLE t1 WRITE;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
INSERT INTO t1 VALUES(3);
UNLOCK TABLES;
SELECT * FROM t1;
a
2
3
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
End of 5.1 tests End of 5.1 tests
# #
# Bug#51327 MyISAM table is automatically repaired on ALTER # Bug#51327 MyISAM table is automatically repaired on ALTER
......
...@@ -1745,3 +1745,18 @@ INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6; ...@@ -1745,3 +1745,18 @@ INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
SELECT * FROM t1 ORDER BY f LIMIT 1; SELECT * FROM t1 ORDER BY f LIMIT 1;
DROP TABLE t1; DROP TABLE t1;
SET sort_buffer_size=DEFAULT; SET sort_buffer_size=DEFAULT;
--echo #
--echo # BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS
--echo # TESTS: CRASH, CORRUPTION, 4G MEMOR
--echo # (to be executed with valgrind)
CREATE TABLE t1(a BLOB, b VARCHAR(200)) ENGINE=ARCHIVE;
INSERT INTO t1 VALUES(NULL, '');
FLUSH TABLE t1;
--echo # we need this select to workaround BUG#11764364
SELECT * FROM t1;
CHECKSUM TABLE t1 EXTENDED;
FLUSH TABLE t1;
OPTIMIZE TABLE t1;
DROP TABLE t1;
...@@ -1647,6 +1647,24 @@ DROP TABLE t1; ...@@ -1647,6 +1647,24 @@ DROP TABLE t1;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_repair_threads=@@global.myisam_repair_threads;
--echo #
--echo # BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN
--echo # USING MYISAM_USE_MMAP ON WINDOWS
--echo #
SET GLOBAL myisam_use_mmap=1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1),(2);
DELETE FROM t1 WHERE a=1;
FLUSH TABLE t1;
LOCK TABLE t1 WRITE;
OPTIMIZE TABLE t1;
INSERT INTO t1 VALUES(3);
UNLOCK TABLES;
SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
--echo End of 5.1 tests --echo End of 5.1 tests
......
...@@ -4810,10 +4810,11 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags, ...@@ -4810,10 +4810,11 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
} }
/* /*
temporary mem_root for new .frm parsing. Initialize temporary MEM_ROOT for new .FRM parsing. Do not allocate
TODO: variables for size anything yet, to avoid penalty for statements which don't use views
and thus new .FRM format.
*/ */
init_sql_alloc(&new_frm_mem, 8024, 8024); init_sql_alloc(&new_frm_mem, 8024, 0);
thd->current_tablenr= 0; thd->current_tablenr= 0;
restart: restart:
......
...@@ -819,6 +819,7 @@ uint32 ha_archive::max_row_length(const uchar *buf) ...@@ -819,6 +819,7 @@ uint32 ha_archive::max_row_length(const uchar *buf)
ptr != end ; ptr != end ;
ptr++) ptr++)
{ {
if (!table->field[*ptr]->is_null())
length += 2 + ((Field_blob*)table->field[*ptr])->get_length(); length += 2 + ((Field_blob*)table->field[*ptr])->get_length();
} }
...@@ -1178,6 +1179,17 @@ int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record) ...@@ -1178,6 +1179,17 @@ int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record)
/* Copy null bits */ /* Copy null bits */
const uchar *ptr= record_buffer->buffer; const uchar *ptr= record_buffer->buffer;
/*
Field::unpack() is not called when field is NULL. For VARCHAR
Field::unpack() only unpacks as much bytes as occupied by field
value. In these cases respective memory area on record buffer is
not initialized.
These uninitialized areas may be accessed by CHECKSUM TABLE or
by optimizer using temporary table (BUG#12997905). We may remove
this memset() when they're fixed.
*/
memset(record, 0, table->s->reclength);
memcpy(record, ptr, table->s->null_bytes); memcpy(record, ptr, table->s->null_bytes);
ptr+= table->s->null_bytes; ptr+= table->s->null_bytes;
for (Field **field=table->field ; *field ; field++) for (Field **field=table->field ; *field ; field++)
......
...@@ -3542,16 +3542,11 @@ btr_record_not_null_field_in_rec( ...@@ -3542,16 +3542,11 @@ btr_record_not_null_field_in_rec(
} }
for (i = 0; i < n_unique; i++) { for (i = 0; i < n_unique; i++) {
ulint rec_len; if (rec_offs_nth_sql_null(offsets, i)) {
rec_get_nth_field_offs(offsets, i, &rec_len);
if (rec_len != UNIV_SQL_NULL) {
n_not_null[i]++;
} else {
/* Break if we hit the first NULL value */
break; break;
} }
n_not_null[i]++;
} }
} }
...@@ -3694,8 +3689,7 @@ btr_estimate_number_of_different_key_vals( ...@@ -3694,8 +3689,7 @@ btr_estimate_number_of_different_key_vals(
if (n_not_null) { if (n_not_null) {
btr_record_not_null_field_in_rec( btr_record_not_null_field_in_rec(
n_cols, offsets_next_rec, n_cols, offsets_next_rec, n_not_null);
n_not_null);
} }
total_external_size total_external_size
......
...@@ -5806,7 +5806,7 @@ ha_innobase::innobase_get_index( ...@@ -5806,7 +5806,7 @@ ha_innobase::innobase_get_index(
table. Only print message if the index translation table. Only print message if the index translation
table exists */ table exists */
if (share->idx_trans_tbl.index_mapping) { if (share->idx_trans_tbl.index_mapping) {
sql_print_error("InnoDB could not find " sql_print_warning("InnoDB could not find "
"index %s key no %u for " "index %s key no %u for "
"table %s through its " "table %s through its "
"index translation table", "index translation table",
...@@ -8285,7 +8285,10 @@ ha_innobase::check( ...@@ -8285,7 +8285,10 @@ ha_innobase::check(
putc('\n', stderr); putc('\n', stderr);
#endif #endif
if (!btr_validate_index(index, prebuilt->trx)) { /* If this is an index being created, break */
if (*index->name == TEMP_INDEX_PREFIX) {
break;
} else if (!btr_validate_index(index, prebuilt->trx)) {
is_ok = FALSE; is_ok = FALSE;
innobase_format_name( innobase_format_name(
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2000, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -3995,6 +3995,7 @@ end: ...@@ -3995,6 +3995,7 @@ end:
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, NULL); trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
err = DB_ERROR;
goto funct_exit; goto funct_exit;
} }
......
...@@ -1026,6 +1026,18 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize) ...@@ -1026,6 +1026,18 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize)
mi_get_mask_all_keys_active(share->base.keys) : mi_get_mask_all_keys_active(share->base.keys) :
share->state.key_map); share->state.key_map);
uint testflag=param.testflag; uint testflag=param.testflag;
#ifdef HAVE_MMAP
bool remap= test(share->file_map);
/*
mi_repair*() functions family use file I/O even if memory
mapping is available.
Since mixing mmap I/O and file I/O may cause various artifacts,
memory mapping must be disabled.
*/
if (remap)
mi_munmap_file(file);
#endif
if (mi_test_if_sort_rep(file,file->state->records,key_map,0) && if (mi_test_if_sort_rep(file,file->state->records,key_map,0) &&
(local_testflag & T_REP_BY_SORT)) (local_testflag & T_REP_BY_SORT))
{ {
...@@ -1057,6 +1069,10 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize) ...@@ -1057,6 +1069,10 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize)
error= mi_repair(&param, file, fixed_name, error= mi_repair(&param, file, fixed_name,
param.testflag & T_QUICK); param.testflag & T_QUICK);
} }
#ifdef HAVE_MMAP
if (remap)
mi_dynmap_file(file, file->state->data_file_length);
#endif
param.testflag=testflag; param.testflag=testflag;
optimize_done=1; optimize_done=1;
} }
......
...@@ -61,11 +61,6 @@ int mi_delete_all_rows(MI_INFO *info) ...@@ -61,11 +61,6 @@ int mi_delete_all_rows(MI_INFO *info)
mysql_file_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME))) mysql_file_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)))
goto err; goto err;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
#ifdef HAVE_MMAP
/* Map again */
if (share->file_map)
mi_dynmap_file(info, (my_off_t) 0);
#endif
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
......
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