Commit 80915cdf authored by marko's avatar marko

branches/zip: Merge revisions 560:583 from trunk.

parent 927ed2fd
...@@ -4136,11 +4136,6 @@ btr_copy_externally_stored_field( ...@@ -4136,11 +4136,6 @@ btr_copy_externally_stored_field(
d_stream.next_in = page + offset; d_stream.next_in = page + offset;
d_stream.avail_in = zip_size - offset; d_stream.avail_in = zip_size - offset;
/* On other BLOB pages except the first
the BLOB header always is at the page header: */
offset = FIL_PAGE_NEXT;
err = inflate(&d_stream, Z_NO_FLUSH); err = inflate(&d_stream, Z_NO_FLUSH);
switch (err) { switch (err) {
case Z_OK: case Z_OK:
...@@ -4181,6 +4176,11 @@ end_of_blob: ...@@ -4181,6 +4176,11 @@ end_of_blob:
} }
mtr_commit(&mtr); mtr_commit(&mtr);
/* On other BLOB pages except the first
the BLOB header always is at the page header: */
offset = FIL_PAGE_NEXT;
} else { } else {
byte* blob_header = page + offset; byte* blob_header = page + offset;
ulint part_len = btr_blob_get_part_len( ulint part_len = btr_blob_get_part_len(
...@@ -4192,11 +4192,6 @@ end_of_blob: ...@@ -4192,11 +4192,6 @@ end_of_blob:
page_no = btr_blob_get_next_page_no(blob_header); page_no = btr_blob_get_next_page_no(blob_header);
/* On other BLOB pages except the first the BLOB header
always is at the page data start: */
offset = FIL_PAGE_DATA;
mtr_commit(&mtr); mtr_commit(&mtr);
if (page_no == FIL_NULL) { if (page_no == FIL_NULL) {
...@@ -4207,6 +4202,11 @@ end_of_blob: ...@@ -4207,6 +4202,11 @@ end_of_blob:
return(buf); return(buf);
} }
/* On other BLOB pages except the first the BLOB header
always is at the page data start: */
offset = FIL_PAGE_DATA;
ut_a(copied_len < local_len + extern_len); ut_a(copied_len < local_len + extern_len);
} }
} }
......
...@@ -41,12 +41,21 @@ void ut_dbg_panic(void); ...@@ -41,12 +41,21 @@ void ut_dbg_panic(void);
/* Stop threads in ut_a(). */ /* Stop threads in ut_a(). */
# define UT_DBG_STOP while (0) /* We do not do this on NetWare */ # define UT_DBG_STOP while (0) /* We do not do this on NetWare */
#else /* __NETWARE__ */ #else /* __NETWARE__ */
/* Flag for indicating that all threads should stop. This will be set # if defined(__WIN__) || defined(__INTEL_COMPILER)
by ut_dbg_assertion_failed(). */ # undef UT_DBG_USE_ABORT
extern ibool ut_dbg_stop_threads; # elif defined(__GNUC__) && (__GNUC__ > 2)
# define UT_DBG_USE_ABORT
# endif
# ifndef UT_DBG_USE_ABORT
/* A null pointer that will be dereferenced to trigger a memory trap */ /* A null pointer that will be dereferenced to trigger a memory trap */
extern ulint* ut_dbg_null_ptr; extern ulint* ut_dbg_null_ptr;
# endif
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/* Flag for indicating that all threads should stop. This will be set
by ut_dbg_assertion_failed(). */
extern ibool ut_dbg_stop_threads;
/***************************************************************** /*****************************************************************
Stop a thread after assertion failure. */ Stop a thread after assertion failure. */
...@@ -56,15 +65,23 @@ ut_dbg_stop_thread( ...@@ -56,15 +65,23 @@ ut_dbg_stop_thread(
/*===============*/ /*===============*/
const char* file, const char* file,
ulint line); ulint line);
# endif
# ifdef UT_DBG_USE_ABORT
/* Abort the execution. */
# define UT_DBG_PANIC abort()
/* Stop threads (null operation) */
# define UT_DBG_STOP while (0)
# else /* UT_DBG_USE_ABORT */
/* Abort the execution. */ /* Abort the execution. */
# define UT_DBG_PANIC \ # define UT_DBG_PANIC \
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL
/* Stop threads in ut_a(). */ /* Stop threads in ut_a(). */
# define UT_DBG_STOP do \ # define UT_DBG_STOP do \
if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \ if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \
ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \ ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \
} while (0) } while (0)
# endif /* UT_DBG_USE_ABORT */
#endif /* __NETWARE__ */ #endif /* __NETWARE__ */
/* Abort execution if EXPR does not evaluate to nonzero. */ /* Abort execution if EXPR does not evaluate to nonzero. */
......
...@@ -29,13 +29,25 @@ typedef struct ib_list_node_struct ib_list_node_t; ...@@ -29,13 +29,25 @@ typedef struct ib_list_node_struct ib_list_node_t;
typedef struct ib_list_helper_struct ib_list_helper_t; typedef struct ib_list_helper_struct ib_list_helper_t;
/******************************************************************** /********************************************************************
Create a new list. */ Create a new list using mem_alloc. Lists created with this function must be
freed with ib_list_free. */
ib_list_t* ib_list_t*
ib_list_create(void); ib_list_create(void);
/*=================*/ /*=================*/
/* out: list */ /* out: list */
/********************************************************************
Create a new list using the given heap. ib_list_free MUST NOT BE CALLED for
lists created with this function. */
ib_list_t*
ib_list_create_heap(
/*================*/
/* out: list */
mem_heap_t* heap); /* in: memory heap to use */
/******************************************************************** /********************************************************************
Free a list. */ Free a list. */
...@@ -110,6 +122,8 @@ ib_list_get_last( ...@@ -110,6 +122,8 @@ ib_list_get_last(
struct ib_list_struct { struct ib_list_struct {
ib_list_node_t* first; /* first node */ ib_list_node_t* first; /* first node */
ib_list_node_t* last; /* last node */ ib_list_node_t* last; /* last node */
ibool is_heap_list; /* TRUE if this list was
allocated through a heap */
}; };
/* A list node. */ /* A list node. */
......
...@@ -2540,10 +2540,10 @@ do not allow the discard. We also reserve the data dictionary latch. */ ...@@ -2540,10 +2540,10 @@ do not allow the discard. We also reserve the data dictionary latch. */
} }
funct_exit: funct_exit:
row_mysql_unlock_data_dictionary(trx);
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
trx->op_info = ""; trx->op_info = "";
return((int) err); return((int) err);
...@@ -2673,10 +2673,10 @@ row_import_tablespace_for_mysql( ...@@ -2673,10 +2673,10 @@ row_import_tablespace_for_mysql(
} }
funct_exit: funct_exit:
row_mysql_unlock_data_dictionary(trx);
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
trx->op_info = ""; trx->op_info = "";
return((int) err); return((int) err);
...@@ -3304,6 +3304,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3304,6 +3304,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
} }
funct_exit: funct_exit:
trx_commit_for_mysql(trx);
if (locked_dictionary) { if (locked_dictionary) {
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
...@@ -3312,8 +3314,6 @@ funct_exit: ...@@ -3312,8 +3314,6 @@ funct_exit:
mem_free(dir_path_of_temp_table); mem_free(dir_path_of_temp_table);
} }
trx_commit_for_mysql(trx);
trx->op_info = ""; trx->op_info = "";
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
...@@ -3392,10 +3392,10 @@ loop: ...@@ -3392,10 +3392,10 @@ loop:
} }
} }
row_mysql_unlock_data_dictionary(trx);
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
trx->op_info = ""; trx->op_info = "";
return(err); return(err);
...@@ -3788,6 +3788,8 @@ end: ...@@ -3788,6 +3788,8 @@ end:
} }
funct_exit: funct_exit:
trx_commit_for_mysql(trx);
if (!recovering_temp_table) { if (!recovering_temp_table) {
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
...@@ -3796,8 +3798,6 @@ funct_exit: ...@@ -3796,8 +3798,6 @@ funct_exit:
mem_heap_free(heap); mem_heap_free(heap);
} }
trx_commit_for_mysql(trx);
trx->op_info = ""; trx->op_info = "";
return((int) err); return((int) err);
......
...@@ -2562,9 +2562,6 @@ row_sel_store_mysql_rec( ...@@ -2562,9 +2562,6 @@ row_sel_store_mysql_rec(
templ = prebuilt->mysql_template + i; templ = prebuilt->mysql_template + i;
data = rec_get_nth_field(rec, offsets,
templ->rec_field_no, &len);
if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
templ->rec_field_no))) { templ->rec_field_no))) {
...@@ -2584,6 +2581,11 @@ row_sel_store_mysql_rec( ...@@ -2584,6 +2581,11 @@ row_sel_store_mysql_rec(
extern_field_heap); extern_field_heap);
ut_a(len != UNIV_SQL_NULL); ut_a(len != UNIV_SQL_NULL);
} else {
/* Field is stored in the row. */
data = rec_get_nth_field(rec, offsets,
templ->rec_field_no, &len);
} }
if (len != UNIV_SQL_NULL) { if (len != UNIV_SQL_NULL) {
......
...@@ -116,6 +116,37 @@ static int inno_bcmp(register const char *s1, register const char *s2, ...@@ -116,6 +116,37 @@ static int inno_bcmp(register const char *s1, register const char *s2,
#define memcmp(A,B,C) inno_bcmp((A),(B),(C)) #define memcmp(A,B,C) inno_bcmp((A),(B),(C))
#endif #endif
static
char*
srv_parse_megabytes(
/*================*/
/* out: next character in string */
char* str, /* in: string containing a quantity in bytes */
ulint* megs) /* out: the number in megabytes */
{
char* endp;
ulint size;
size = strtoul(str, &endp, 10);
str = endp;
switch (*str) {
case 'G': case 'g':
size *= 1024;
/* fall through */
case 'M': case 'm':
str++;
break;
default:
size /= 1024 * 1024;
break;
}
*megs = size;
return(str);
}
/************************************************************************* /*************************************************************************
Reads the data files and their sizes from a character string given in Reads the data files and their sizes from a character string given in
the .cnf file. */ the .cnf file. */
...@@ -140,7 +171,6 @@ srv_parse_data_file_paths_and_sizes( ...@@ -140,7 +171,6 @@ srv_parse_data_file_paths_and_sizes(
last file if specified, 0 if not */ last file if specified, 0 if not */
{ {
char* input_str; char* input_str;
char* endp;
char* path; char* path;
ulint size; ulint size;
ulint i = 0; ulint i = 0;
...@@ -170,18 +200,7 @@ srv_parse_data_file_paths_and_sizes( ...@@ -170,18 +200,7 @@ srv_parse_data_file_paths_and_sizes(
str++; str++;
size = strtoul(str, &endp, 10); str = srv_parse_megabytes(str, &size);
str = endp;
if (*str != 'M' && *str != 'G') {
size = size / (1024 * 1024);
} else if (*str == 'G') {
size = size * 1024;
str++;
} else {
str++;
}
if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) { if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
...@@ -191,18 +210,7 @@ srv_parse_data_file_paths_and_sizes( ...@@ -191,18 +210,7 @@ srv_parse_data_file_paths_and_sizes(
str += (sizeof ":max:") - 1; str += (sizeof ":max:") - 1;
size = strtoul(str, &endp, 10); str = srv_parse_megabytes(str, &size);
str = endp;
if (*str != 'M' && *str != 'G') {
size = size / (1024 * 1024);
} else if (*str == 'G') {
size = size * 1024;
str++;
} else {
str++;
}
} }
if (*str != '\0') { if (*str != '\0') {
...@@ -275,18 +283,7 @@ srv_parse_data_file_paths_and_sizes( ...@@ -275,18 +283,7 @@ srv_parse_data_file_paths_and_sizes(
str++; str++;
} }
size = strtoul(str, &endp, 10); str = srv_parse_megabytes(str, &size);
str = endp;
if ((*str != 'M') && (*str != 'G')) {
size = size / (1024 * 1024);
} else if (*str == 'G') {
size = size * 1024;
str++;
} else {
str++;
}
(*data_file_names)[i] = path; (*data_file_names)[i] = path;
(*data_file_sizes)[i] = size; (*data_file_sizes)[i] = size;
...@@ -301,20 +298,8 @@ srv_parse_data_file_paths_and_sizes( ...@@ -301,20 +298,8 @@ srv_parse_data_file_paths_and_sizes(
str += (sizeof ":max:") - 1; str += (sizeof ":max:") - 1;
size = strtoul(str, &endp, 10); str = srv_parse_megabytes(str,
max_auto_extend_size);
str = endp;
if (*str != 'M' && *str != 'G') {
size = size / (1024 * 1024);
} else if (*str == 'G') {
size = size * 1024;
str++;
} else {
str++;
}
*max_auto_extend_size = size;
} }
if (*str != '\0') { if (*str != '\0') {
......
...@@ -14,19 +14,21 @@ Created 1/30/1994 Heikki Tuuri ...@@ -14,19 +14,21 @@ Created 1/30/1994 Heikki Tuuri
ulint ut_dbg_zero = 0; ulint ut_dbg_zero = 0;
#endif #endif
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/* If this is set to TRUE all threads will stop into the next assertion /* If this is set to TRUE all threads will stop into the next assertion
and assert */ and assert */
ibool ut_dbg_stop_threads = FALSE; ibool ut_dbg_stop_threads = FALSE;
#endif
#ifdef __NETWARE__ #ifdef __NETWARE__
ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there
happens an InnoDB assertion failure or other happens an InnoDB assertion failure or other
fatal error condition that requires an fatal error condition that requires an
immediate shutdown. */ immediate shutdown. */
#else /* __NETWARE__ */ #elif !defined(UT_DBG_USE_ABORT)
/* Null pointer used to generate memory trap */ /* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL; ulint* ut_dbg_null_ptr = NULL;
#endif /* __NETWARE__ */ #endif
/***************************************************************** /*****************************************************************
Report a failed assertion. */ Report a failed assertion. */
...@@ -56,7 +58,9 @@ ut_dbg_assertion_failed( ...@@ -56,7 +58,9 @@ ut_dbg_assertion_failed(
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n" "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n" "InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr); "InnoDB: about forcing recovery.\n", stderr);
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
ut_dbg_stop_threads = TRUE; ut_dbg_stop_threads = TRUE;
#endif
} }
#ifdef __NETWARE__ #ifdef __NETWARE__
...@@ -74,6 +78,7 @@ ut_dbg_panic(void) ...@@ -74,6 +78,7 @@ ut_dbg_panic(void)
exit(1); exit(1);
} }
#else /* __NETWARE__ */ #else /* __NETWARE__ */
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/***************************************************************** /*****************************************************************
Stop a thread after assertion failure. */ Stop a thread after assertion failure. */
...@@ -87,4 +92,5 @@ ut_dbg_stop_thread( ...@@ -87,4 +92,5 @@ ut_dbg_stop_thread(
os_thread_pf(os_thread_get_curr_id()), file, line); os_thread_pf(os_thread_get_curr_id()), file, line);
os_thread_sleep(1000000000); os_thread_sleep(1000000000);
} }
# endif
#endif /* __NETWARE__ */ #endif /* __NETWARE__ */
...@@ -15,6 +15,26 @@ ib_list_create(void) ...@@ -15,6 +15,26 @@ ib_list_create(void)
list->first = NULL; list->first = NULL;
list->last = NULL; list->last = NULL;
list->is_heap_list = FALSE;
return(list);
}
/********************************************************************
Create a new list using the given heap. ib_list_free MUST NOT BE CALLED for
lists created with this function. */
ib_list_t*
ib_list_create_heap(
/*================*/
/* out: list */
mem_heap_t* heap) /* in: memory heap to use */
{
ib_list_t* list = mem_heap_alloc(heap, sizeof(ib_list_t));
list->first = NULL;
list->last = NULL;
list->is_heap_list = TRUE;
return(list); return(list);
} }
...@@ -27,6 +47,8 @@ ib_list_free( ...@@ -27,6 +47,8 @@ ib_list_free(
/*=========*/ /*=========*/
ib_list_t* list) /* in: list */ ib_list_t* list) /* in: list */
{ {
ut_a(!list->is_heap_list);
/* We don't check that the list is empty because it's entirely valid /* We don't check that the list is empty because it's entirely valid
to e.g. have all the nodes allocated from a single heap that is then to e.g. have all the nodes allocated from a single heap that is then
freed after the list itself is freed. */ freed after the list itself is freed. */
......
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