[Maria-developers] Removing very old options for --old, --new, --safe-mode
![](https://secure.gravatar.com/avatar/06b8a7f236cf59aa9a83cab1a0551ca8.jpg?s=120&d=mm&r=g)
Hi! I did notice that we haven't cleaned up the usage of the --old, --new, --safe-mode and --skip-new options in a long time. Here is a cleanup of this for MariaDB 5.2 (soon to be made gamma). After this suggested change, here is how the options would work: --new Use new functionality that will exist in next version of MariaDB. This function exist to make it easier to prepare for an upgrade. For version 5.1 this functions enables the LIST and RANGE partitions functions for ndbcluster. --old Use compatible behavior with previous main version for some functionality. For MariaDB 5.1 this means that we are using the old, MySQL 5.1 compatible, way to calculate checksums for records. If you are using --old, CHECKSUM TABLE will always do a full table scan. --safe_mode Disable some potential unsafe optimization. For 5.2 these are: INSERT DELAYED is disabled, myisam_recover_options is set to DEFAULT (automatically recover crashed MyISAM files). For Aria table, disable bulk insert optimization to enable one to use maria_read_log to recover tables even if tables are deleted (good for testing recovery). --skip-new Skip some new potentially unsafe functions. For 5.2 these are: INSERT DELAYED is disabled, Query cache size is reset. Here is the patch against MariaDB 5.2: === modified file 'sql/field.cc' --- sql/field.cc 2010-08-05 19:56:11 +0000 +++ sql/field.cc 2010-09-14 15:45:01 +0000 @@ -6703,8 +6703,7 @@ void Field_string::sql_type(String &res) length= cs->cset->snprintf(cs,(char*) res.ptr(), res.alloced_length(), "%s(%d)", - ((type() == MYSQL_TYPE_VAR_STRING && - !thd->variables.new_mode) ? + (type() == MYSQL_TYPE_VAR_STRING ? (has_charset() ? "varchar" : "varbinary") : (has_charset() ? "char" : "binary")), (int) field_length / charset()->mbmaxlen); === modified file 'sql/item_cmpfunc.cc' --- sql/item_cmpfunc.cc 2010-08-05 19:56:11 +0000 +++ sql/item_cmpfunc.cc 2010-09-14 16:41:01 +0000 @@ -4683,8 +4683,7 @@ bool Item_func_like::fix_fields(THD *thd We could also do boyer-more for non-const items, but as we would have to recompute the tables for each row it's not worth it. */ - if (args[1]->const_item() && !use_strnxfrm(collation.collation) && - !(specialflag & SPECIAL_NO_NEW_FUNC)) + if (args[1]->const_item() && !use_strnxfrm(collation.collation)) { String* res2 = args[1]->val_str(&cmp.value2); if (!res2) === modified file 'sql/mysqld.cc' --- sql/mysqld.cc 2010-08-24 22:44:50 +0000 +++ sql/mysqld.cc 2010-09-14 16:40:09 +0000 @@ -8725,11 +8725,7 @@ mysqld_get_one_option(int optid, case (int) OPT_SKIP_NEW: opt_specialflag|= SPECIAL_NO_NEW_FUNC; delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; - myisam_concurrent_insert=0; - myisam_recover_options= HA_RECOVER_NONE; - sp_automatic_privileges=0; - my_use_symdir=0; - ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE); + ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE); #ifdef HAVE_QUERY_CACHE query_cache_size=0; #endif === modified file 'sql/records.cc' --- sql/records.cc 2010-07-17 19:58:08 +0000 +++ sql/records.cc 2010-09-14 16:40:09 +0000 @@ -216,7 +216,6 @@ bool init_read_record(READ_RECORD *info, */ if (!disable_rr_cache && !table->sort.addon_field && - ! (specialflag & SPECIAL_SAFE_MODE) && thd->variables.read_rnd_buff_size && !(table->file->ha_table_flags() & HA_FAST_KEY_READ) && (table->db_stat & HA_READ_ONLY || === modified file 'sql/sql_delete.cc' --- sql/sql_delete.cc 2010-08-05 19:56:11 +0000 +++ sql/sql_delete.cc 2010-09-14 16:40:10 +0000 @@ -130,7 +130,6 @@ bool mysql_delete(THD *thd, TABLE_LIST * - there should be no delete triggers associated with the table. */ if (!using_limit && const_cond_result && - !(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) && (thd->lex->sql_command == SQLCOM_TRUNCATE || (!thd->current_stmt_binlog_row_based && !(table->triggers && table->triggers->has_delete_triggers())))) === modified file 'sql/sql_parse.cc' --- sql/sql_parse.cc 2010-08-05 19:56:11 +0000 +++ sql/sql_parse.cc 2010-09-14 16:40:09 +0000 @@ -3086,9 +3086,7 @@ end_with_restore_list: goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; thd->query_plan_flags|= QPLAN_ADMIN; - res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ? - mysql_recreate_table(thd, first_table) : - mysql_optimize_table(thd, first_table, &lex->check_opt); + res= mysql_optimize_table(thd, first_table, &lex->check_opt); /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) { === modified file 'sql/sql_select.cc' --- sql/sql_select.cc 2010-08-24 22:44:50 +0000 +++ sql/sql_select.cc 2010-09-14 16:39:57 +0000 @@ -7187,8 +7187,6 @@ eq_ref_table(JOIN *join, ORDER *start_or static bool only_eq_ref_tables(JOIN *join,ORDER *order,table_map tables) { - if (specialflag & SPECIAL_SAFE_MODE) - return 0; // skip this optimize /* purecov: inspected */ tables&= ~PSEUDO_TABLE_BITS; for (JOIN_TAB **tab=join->map2table ; tables ; tab++, tables>>=1) { ------------- Any comments ? Regards, Monty
![](https://secure.gravatar.com/avatar/3c2329333dd5898f2e72818af773243d.jpg?s=120&d=mm&r=g)
Hi, Michael! On Sep 14, Michael Widenius wrote:
Hi!
I did notice that we haven't cleaned up the usage of the --old, --new, --safe-mode and --skip-new options in a long time.
Here is a cleanup of this for MariaDB 5.2 (soon to be made gamma). After this suggested change, here is how the options would work:
--new Use new functionality that will exist in next version of MariaDB. This function exist to make it easier to prepare for an upgrade. For version 5.1 this functions enables the LIST and RANGE partitions functions for ndbcluster.
--old Use compatible behavior with previous main version for some functionality. For MariaDB 5.1 this means that we are using the old, MySQL 5.1 compatible, way to calculate checksums for records. If you are using --old, CHECKSUM TABLE will always do a full table scan.
--safe_mode Disable some potential unsafe optimization. For 5.2 these are: INSERT DELAYED is disabled, myisam_recover_options is set to DEFAULT (automatically recover crashed MyISAM files). For Aria table, disable bulk insert optimization to enable one to use maria_read_log to recover tables even if tables are deleted (good for testing recovery).
--skip-new Skip some new potentially unsafe functions. For 5.2 these are: INSERT DELAYED is disabled, Query cache size is reset.
...
Any comments ?
Yes. my_getopt supports skip- prefix for all options. Having --skip-new that is different from --skip-new is very confusing. No, "very" is an understatement, Very, VERY, terribly, awfully, deadly confusing. In fact - really! - before I saw this your email, I did not realize there is --skip-new option, and naively thought it's just --skip-new. So, please, please, remove --skip-new option altogether, and let --skip-new to mean what it should (according to the principle of the least surprise) - disabling previously enabled --new. Regards, Sergei P.S. If you cannot see the difference between --skip-new and --skip-new, please replace every second "--skip-new" in this email with --new=0 or --disable-new :)
![](https://secure.gravatar.com/avatar/06b8a7f236cf59aa9a83cab1a0551ca8.jpg?s=120&d=mm&r=g)
Hi!
"Sergei" == Sergei Golubchik
writes:
Sergei> Hi, Michael! Sergei> On Sep 14, Michael Widenius wrote:
Hi!
I did notice that we haven't cleaned up the usage of the --old, --new, --safe-mode and --skip-new options in a long time.
Here is a cleanup of this for MariaDB 5.2 (soon to be made gamma). After this suggested change, here is how the options would work:
--new Use new functionality that will exist in next version of MariaDB. This function exist to make it easier to prepare for an upgrade. For version 5.1 this functions enables the LIST and RANGE partitions functions for ndbcluster.
<cut>
--safe_mode Disable some potential unsafe optimization. For 5.2 these are: INSERT DELAYED is disabled, myisam_recover_options is set to DEFAULT (automatically recover crashed MyISAM files). For Aria table, disable bulk insert optimization to enable one to use maria_read_log to recover tables even if tables are deleted (good for testing recovery).
--skip-new Skip some new potentially unsafe functions. For 5.2 these are: INSERT DELAYED is disabled, Query cache size is reset. Sergei> ... Any comments ?
Sergei> Yes. Sergei> my_getopt supports skip- prefix for all options. Sergei> Having --skip-new that is different from --skip-new is very confusing. Sergei> No, "very" is an understatement, Very, VERY, terribly, awfully, deadly Sergei> confusing. Sergei> In fact - really! - before I saw this your email, I did not realize Sergei> there is --skip-new option, and naively thought it's just --skip-new. Sergei> So, please, please, remove --skip-new option altogether, and let Sergei> --skip-new to mean what it should (according to the principle of the Sergei> least surprise) - disabling previously enabled --new. I agree it's confusing. Changing this is not compatible with old versions, but as one shouldn't use --skip-new except temporally to go around a bug, it should be a safe change. I will change so that what is now disabled with --skip-new will be moved to --safe-mode, where it should have been from the start. I will do this in a separate changeset and push with the my_bool -> bool fix (when I have got approval for that) Regards, Monty
participants (2)
-
Michael Widenius
-
Sergei Golubchik