Skip to content
Snippets Groups Projects
Commit cca1616b authored by Danny Auble's avatar Danny Auble
Browse files

MYSQL - Fix issue where 'alter ignore' isn't supported in MySQL

anymore.
parent bf6462f3
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,14 @@ AC_DEFUN([X_AC_DATABASES], ...@@ -42,6 +42,14 @@ AC_DEFUN([X_AC_DATABASES],
AC_MSG_WARN([*** mysql-$mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version available, we need >= mysql-5.0.0 installed for the mysql interface.]) AC_MSG_WARN([*** mysql-$mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version available, we need >= mysql-5.0.0 installed for the mysql interface.])
ac_have_mysql="no" ac_have_mysql="no"
else else
# In mysql 5.7.4 we can't use the 'IGNORE' option when
# altering tables so deal with it then.
if test $mysql_config_minor_version -gt 7 ||
(test $mysql_config_minor_version -eq 7 &&
test $mysql_config_micro_version -gt 3); then
AC_DEFINE(NO_ALTER_IGNORE_MYSQL, 1, [Define to 1 if we can't use the alter ignore when messing with a database table])
fi
# mysql_config puts -I on the front of the dir. We don't # mysql_config puts -I on the front of the dir. We don't
# want that so we remove it. # want that so we remove it.
MYSQL_CFLAGS=`$HAVEMYSQLCONFIG --include` MYSQL_CFLAGS=`$HAVEMYSQLCONFIG --include`
...@@ -60,7 +68,7 @@ AC_DEFUN([X_AC_DATABASES], ...@@ -60,7 +68,7 @@ AC_DEFUN([X_AC_DATABASES],
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS" LIBS="$save_LIBS"
if test "$ac_have_mysql" = yes; then if test "$ac_have_mysql" = yes; then
AC_MSG_RESULT([MySQL test program built properly.]) AC_MSG_RESULT([MySQL $mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version test program built properly.])
AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_LIBS)
AC_SUBST(MYSQL_CFLAGS) AC_SUBST(MYSQL_CFLAGS)
AC_DEFINE(HAVE_MYSQL, 1, [Define to 1 if using MySQL libaries]) AC_DEFINE(HAVE_MYSQL, 1, [Define to 1 if using MySQL libaries])
......
...@@ -504,6 +504,10 @@ ...@@ -504,6 +504,10 @@
/* Define to 1 if you are building a production release. */ /* Define to 1 if you are building a production release. */
#undef NDEBUG #undef NDEBUG
/* Define to 1 if we can't use the alter ignore when messing with a database
table */
#undef NO_ALTER_IGNORE_MYSQL
/* Define to the address where bug reports for this package should be sent. */ /* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT
......
...@@ -23240,6 +23240,16 @@ $as_echo "$as_me: WARNING: *** mysql_config not found. Evidently no MySQL develo ...@@ -23240,6 +23240,16 @@ $as_echo "$as_me: WARNING: *** mysql_config not found. Evidently no MySQL develo
$as_echo "$as_me: WARNING: *** mysql-$mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version available, we need >= mysql-5.0.0 installed for the mysql interface." >&2;} $as_echo "$as_me: WARNING: *** mysql-$mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version available, we need >= mysql-5.0.0 installed for the mysql interface." >&2;}
ac_have_mysql="no" ac_have_mysql="no"
else else
# In mysql 5.7.4 we can't use the 'IGNORE' option when
# altering tables so deal with it then.
if test $mysql_config_minor_version -gt 7 ||
(test $mysql_config_minor_version -eq 7 &&
test $mysql_config_micro_version -gt 3); then
$as_echo "#define NO_ALTER_IGNORE_MYSQL 1" >>confdefs.h
fi
# mysql_config puts -I on the front of the dir. We don't # mysql_config puts -I on the front of the dir. We don't
# want that so we remove it. # want that so we remove it.
MYSQL_CFLAGS=`$HAVEMYSQLCONFIG --include` MYSQL_CFLAGS=`$HAVEMYSQLCONFIG --include`
...@@ -23273,8 +23283,8 @@ rm -f core conftest.err conftest.$ac_objext \ ...@@ -23273,8 +23283,8 @@ rm -f core conftest.err conftest.$ac_objext \
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS" LIBS="$save_LIBS"
if test "$ac_have_mysql" = yes; then if test "$ac_have_mysql" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: MySQL test program built properly." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: MySQL $mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version test program built properly." >&5
$as_echo "MySQL test program built properly." >&6; } $as_echo "MySQL $mysql_config_major_version.$mysql_config_minor_version.$mysql_config_micro_version test program built properly." >&6; }
   
   
   
......
...@@ -264,8 +264,18 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name, ...@@ -264,8 +264,18 @@ static int _mysql_make_table_current(mysql_conn_t *mysql_conn, char *table_name,
itr = list_iterator_create(columns); itr = list_iterator_create(columns);
#ifdef NO_ALTER_IGNORE_MYSQL
/* In MySQL 5.7.4 we lost the ability to run 'alter ignore'. This was
* needed when converting old tables to new schemas. If people convert
* in the future from an older version of Slurm that needed the ignore
* to work they will have to downgrade mysql to <= 5.7.3 to make things
* work correctly or manually edit the database to get things to work.
*/
query = xstrdup_printf("alter table %s", table_name);
#else
query = xstrdup_printf("alter ignore table %s", table_name); query = xstrdup_printf("alter ignore table %s", table_name);
correct_query = xstrdup_printf("alter ignore table %s", table_name); #endif
correct_query = xstrdup(query);
START_TIMER; START_TIMER;
while (fields[i].name) { while (fields[i].name) {
int found = 0; int found = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment