summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-10-13 12:48:29 +0530
committerSatya B <satya.bn@sun.com>2009-10-13 12:48:29 +0530
commit610213149cc4cd00f402387d9f687e6375956d15 (patch)
tree50afd38128334815ffd8c1fe30c27bd6415842cc /storage
parentfd246618df0fa55af3f9d6669044b0e166980de9 (diff)
parent6ba225893a2ae6e284e9f11405f969367e184711 (diff)
downloadmariadb-git-610213149cc4cd00f402387d9f687e6375956d15.tar.gz
merge to mysql-5.1-bugteam
Diffstat (limited to 'storage')
-rw-r--r--storage/myisam/ha_myisam.cc16
-rw-r--r--storage/myisam/mi_check.c10
-rw-r--r--storage/myisam/sort.c4
-rw-r--r--storage/mysql_storage_engine.cmake8
4 files changed, 18 insertions, 20 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 5198e685817..aa9a2eeb77a 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1087,22 +1087,6 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize)
ha_rows rows= file->state->records;
DBUG_ENTER("ha_myisam::repair");
- /*
- Normally this method is entered with a properly opened table. If the
- repair fails, it can be repeated with more elaborate options. Under
- special circumstances it can happen that a repair fails so that it
- closed the data file and cannot re-open it. In this case file->dfile
- is set to -1. We must not try another repair without an open data
- file. (Bug #25289)
- */
- if (file->dfile == -1)
- {
- sql_print_information("Retrying repair of: '%s' failed. "
- "Please try REPAIR EXTENDED or myisamchk",
- table->s->path.str);
- DBUG_RETURN(HA_ADMIN_FAILED);
- }
-
param.db_name= table->s->db.str;
param.table_name= table->alias;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 1c33ffa90f5..8f7b1399aa2 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -2561,8 +2561,9 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
MYF(MY_WME)));
- if (info->dfile == new_file)
- info->dfile= -1;
+ if (info->dfile == new_file) /* Retry with key cache */
+ if (unlikely(mi_open_datafile(info, share, name, -1)))
+ param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
}
@@ -3095,8 +3096,9 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
MYF(MY_WME)));
- if (info->dfile == new_file)
- info->dfile= -1;
+ if (info->dfile == new_file) /* Retry with key cache */
+ if (unlikely(mi_open_datafile(info, share, name, -1)))
+ param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
}
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index f31edbe1249..fb16af9cddf 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -788,7 +788,11 @@ static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys,
cleanup:
close_cached_file(to_file); /* This holds old result */
if (to_file == t_file)
+ {
*t_file=t_file2; /* Copy result file */
+ t_file->current_pos= &t_file->write_pos;
+ t_file->current_end= &t_file->write_end;
+ }
DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */
} /* merge_many_buff */
diff --git a/storage/mysql_storage_engine.cmake b/storage/mysql_storage_engine.cmake
index bb368494898..af8c3a85cd1 100644
--- a/storage/mysql_storage_engine.cmake
+++ b/storage/mysql_storage_engine.cmake
@@ -7,6 +7,8 @@
# Remarks:
# ${engine}_SOURCES variable containing source files to produce the library must set before
# calling this macro
+# ${engine}_LIBS variable containing extra libraries to link with may be set
+
MACRO(MYSQL_STORAGE_ENGINE engine)
IF(NOT SOURCE_SUBLIBS)
@@ -22,6 +24,9 @@ IF(NOT SOURCE_SUBLIBS)
#Create static library. The name of the library is <storage_engine>.lib
ADD_LIBRARY(${libname} ${${engine}_SOURCES})
ADD_DEPENDENCIES(${libname} GenError)
+ IF(${engine}_LIBS)
+ TARGET_LINK_LIBRARIES(${libname} ${${engine}_LIBS})
+ ENDIF(${engine}_LIBS)
MESSAGE("build ${engine} as static library")
ELSEIF(${ENGINE_BUILD_TYPE} STREQUAL "DYNAMIC")
ADD_DEFINITIONS(-DMYSQL_DYNAMIC_PLUGIN)
@@ -30,6 +35,9 @@ IF(NOT SOURCE_SUBLIBS)
SET(dyn_libname ha_${libname})
ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
TARGET_LINK_LIBRARIES (${dyn_libname} mysqld)
+ IF(${engine}_LIBS)
+ TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
+ ENDIF(${engine}_LIBS)
MESSAGE("build ${engine} as DLL")
ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
ENDIF(NOT SOURCE_SUBLIBS)