mariadb/client/mysqlslap.c

2317 lines
66 KiB
C
Raw Normal View History

2011-06-30 17:37:13 +02:00
/*
2015-08-01 14:56:18 +02:00
Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2017, MariaDB
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
Many files: Changed header to GPL version 2 only client/mysqlslap.c: Changed header to GPL version 2 only include/atomic/nolock.h: Changed header to GPL version 2 only include/atomic/rwlock.h: Changed header to GPL version 2 only include/atomic/x86-gcc.h: Changed header to GPL version 2 only include/atomic/x86-msvc.h: Changed header to GPL version 2 only include/my_atomic.h: Changed header to GPL version 2 only include/my_trie.h: Changed header to GPL version 2 only include/my_vle.h: Changed header to GPL version 2 only include/mysql/plugin.h: Changed header to GPL version 2 only mysys/my_atomic.c: Changed header to GPL version 2 only mysys/my_getncpus.c: Changed header to GPL version 2 only mysys/my_memmem.c: Changed header to GPL version 2 only mysys/my_vle.c: Changed header to GPL version 2 only mysys/trie.c: Changed header to GPL version 2 only plugin/Makefile.am: Changed header to GPL version 2 only server-tools/instance-manager/IMService.h: Changed header to GPL version 2 only server-tools/instance-manager/WindowsService.h: Changed header to GPL version 2 only server-tools/instance-manager/exit_codes.h: Changed header to GPL version 2 only server-tools/instance-manager/user_management_commands.h: Changed header to GPL version 2 only sql/authors.h: Changed header to GPL version 2 only sql/contributors.h: Changed header to GPL version 2 only sql/event_data_objects.cc: Changed header to GPL version 2 only sql/event_data_objects.h: Changed header to GPL version 2 only sql/event_db_repository.cc: Changed header to GPL version 2 only sql/event_db_repository.h: Changed header to GPL version 2 only sql/event_queue.cc: Changed header to GPL version 2 only sql/event_queue.h: Changed header to GPL version 2 only sql/event_scheduler.cc: Changed header to GPL version 2 only sql/event_scheduler.h: Changed header to GPL version 2 only sql/events.cc: Changed header to GPL version 2 only sql/events.h: Changed header to GPL version 2 only sql/ha_ndbcluster_binlog.cc: Changed header to GPL version 2 only sql/ha_ndbcluster_binlog.h: Changed header to GPL version 2 only sql/ha_ndbcluster_tables.h: Changed header to GPL version 2 only sql/ha_partition.cc: Changed header to GPL version 2 only sql/ha_partition.h: Changed header to GPL version 2 only sql/item_xmlfunc.cc: Changed header to GPL version 2 only sql/item_xmlfunc.h: Changed header to GPL version 2 only sql/log.h: Changed header to GPL version 2 only sql/partition_element.h: Changed header to GPL version 2 only sql/partition_info.cc: Changed header to GPL version 2 only sql/partition_info.h: Changed header to GPL version 2 only sql/rpl_filter.cc: Changed header to GPL version 2 only sql/rpl_filter.h: Changed header to GPL version 2 only sql/rpl_injector.cc: Changed header to GPL version 2 only sql/rpl_injector.h: Changed header to GPL version 2 only sql/rpl_mi.cc: Changed header to GPL version 2 only sql/rpl_mi.h: Changed header to GPL version 2 only sql/rpl_rli.cc: Changed header to GPL version 2 only sql/rpl_rli.h: Changed header to GPL version 2 only sql/rpl_tblmap.cc: Changed header to GPL version 2 only sql/rpl_tblmap.h: Changed header to GPL version 2 only sql/rpl_utility.cc: Changed header to GPL version 2 only sql/rpl_utility.h: Changed header to GPL version 2 only sql/sql_binlog.cc: Changed header to GPL version 2 only sql/sql_partition.cc: Changed header to GPL version 2 only sql/sql_partition.h: Changed header to GPL version 2 only sql/sql_plugin.cc: Changed header to GPL version 2 only sql/sql_plugin.h: Changed header to GPL version 2 only sql/sql_servers.cc: Changed header to GPL version 2 only sql/sql_servers.h: Changed header to GPL version 2 only sql/sql_tablespace.cc: Changed header to GPL version 2 only sql/sql_yacc.yy.bak: Changed header to GPL version 2 only storage/Makefile.am: Changed header to GPL version 2 only storage/archive/Makefile.am: Changed header to GPL version 2 only storage/blackhole/Makefile.am: Changed header to GPL version 2 only storage/csv/Makefile.am: Changed header to GPL version 2 only storage/example/Makefile.am: Changed header to GPL version 2 only storage/federated/Makefile.am: Changed header to GPL version 2 only storage/innobase/handler/Makefile.am: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/AllocNodeId.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/CreateObj.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DictObjOp.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DihFragCount.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DropObj.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/Extent.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/RouteOrd.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/ndbapi/NdbIndexStat.hpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/mgmapi_logevent_dual/mgmapi_logevent_dual.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/diskpage.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/lgman.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/lgman.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/pgman.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/pgman.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/print_file.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/record_types.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/restore.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/restore.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/tsman.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/tsman.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DLCFifoList.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DLCHashTable.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DynArr256.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DynArr256.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/LinearPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/NdbdSuperPool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/NdbdSuperPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/Pool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/Pool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/RWPool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/RWPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/Rope.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/SLFifoList.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/WOPool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/WOPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/bench_pool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp: Changed header to GPL version 2 only storage/ndb/src/mgmsrv/ParamInfo.cpp: Changed header to GPL version 2 only storage/ndb/src/ndbapi/NdbIndexStat.cpp: Changed header to GPL version 2 only storage/ndb/test/ndbapi/testIndexStat.cpp: Changed header to GPL version 2 only storage/ndb/test/tools/listen.cpp: Changed header to GPL version 2 only storage/ndb/tools/restore/ndb_nodegroup_map.h: Changed header to GPL version 2 only strings/my_strchr.c: Changed header to GPL version 2 only unittest/mysys/base64-t.c: Changed header to GPL version 2 only unittest/mysys/bitmap-t.c: Changed header to GPL version 2 only unittest/mysys/my_atomic-t.c: Changed header to GPL version 2 only unittest/mytap/tap.c: Changed header to GPL version 2 only unittest/mytap/tap.h: Changed header to GPL version 2 only win/Makefile.am: Changed header to GPL version 2 only
2006-12-27 02:23:51 +01:00
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*/
/*
MySQL Slap
A simple program designed to work as if multiple clients querying the database,
then reporting the timing of each stage.
MySQL slap runs three stages:
1) Create schema,table, and optionally any SP or data you want to beign
the test with. (single client)
2) Load test (many clients)
3) Cleanup (disconnection, drop table if specified, single client)
Examples:
Supply your own create and query SQL statements, with 50 clients
querying (200 selects for each):
mysqlslap --delimiter=";" \
--create="CREATE TABLE A (a int);INSERT INTO A VALUES (23)" \
--query="SELECT * FROM A" --concurrency=50 --iterations=200
Let the program build the query SQL statement with a table of two int
columns, three varchar columns, five clients querying (20 times each),
don't create the table or insert the data (using the previous test's
schema and data):
mysqlslap --concurrency=5 --iterations=20 \
--number-int-cols=2 --number-char-cols=3 \
--auto-generate-sql
Tell the program to load the create, insert and query SQL statements from
the specified files, where the create.sql file has multiple table creation
statements delimited by ';' and multiple insert statements delimited by ';'.
The --query file will have multiple queries delimited by ';', run all the
load statements, and then run all the queries in the query file
with five clients (five times each):
mysqlslap --concurrency=5 \
--iterations=5 --query=query.sql --create=create.sql \
--delimiter=";"
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
TODO:
Add language for better tests
String length for files and those put on the command line are not
setup to handle binary data.
More stats
Break up tests and run them on multiple hosts at once.
Allow output to be fed into a database directly.
*/
fixes for test failures and small collateral changes mysql-test/lib/My/Test.pm: somehow with "print" we get truncated writes sometimes mysql-test/suite/perfschema/r/digest_table_full.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/dml_handler.result: host table is not ported over yet mysql-test/suite/perfschema/r/information_schema.result: host table is not ported over yet mysql-test/suite/perfschema/r/nesting.result: this differs, because we don't rewrite general log queries, and multi-statement packets are logged as a one entry. this result file is identical to what mysql-5.6.5 produces with the --log-raw option. mysql-test/suite/perfschema/r/relaylog.result: MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB. mysql-test/suite/perfschema/r/server_init.result: MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup. mysql-test/suite/perfschema/r/stage_mdl_global.result: this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not do that, and this causes useless mutex locks and waits. mysql-test/suite/perfschema/r/statement_digest.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_consumers.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_long_query.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result: will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result: will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
2012-09-27 20:09:46 +02:00
#define SLAP_VERSION "1.0"
#define HUGE_STRING_LENGTH 8196
#define RAND_STRING_SIZE 126
/* Types */
#define SELECT_TYPE 0
#define UPDATE_TYPE 1
#define INSERT_TYPE 2
#define UPDATE_TYPE_REQUIRES_PREFIX 3
#define CREATE_TABLE_TYPE 4
#define SELECT_TYPE_REQUIRES_PREFIX 5
#define DELETE_TYPE_REQUIRES_PREFIX 6
#include "client_priv.h"
#include <mysqld_error.h>
#include <my_dir.h>
#include <signal.h>
#include <sslopt-vars.h>
#ifndef __WIN__
#include <sys/wait.h>
#endif
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
#include <ctype.h>
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
#ifdef __WIN__
#define srandom srand
#define random rand
#define snprintf _snprintf
#endif
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
/* Global Thread counter */
uint thread_counter;
pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold;
uint master_wakeup;
pthread_mutex_t sleeper_mutex;
pthread_cond_t sleep_threshhold;
static char **defaults_argv;
char **primary_keys;
unsigned long long primary_keys_number_of;
static char *host= NULL, *opt_password= NULL, *user= NULL,
*user_supplied_query= NULL,
*user_supplied_pre_statements= NULL,
*user_supplied_post_statements= NULL,
*default_engine= NULL,
*pre_system= NULL,
*post_system= NULL,
*opt_mysql_unix_port= NULL,
*opt_init_command= NULL;
Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade.
2011-01-16 04:59:05 +01:00
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
const char *delimiter= "\n";
const char *create_schema_string= "mysqlslap";
static my_bool opt_preserve= TRUE, opt_no_drop= FALSE;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
static my_bool opt_only_print= FALSE;
static my_bool opt_compress= FALSE, tty_password= FALSE,
opt_silent= FALSE,
auto_generate_sql_autoincrement= FALSE,
auto_generate_sql_guid_primary= FALSE,
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
auto_generate_sql= FALSE;
const char *auto_generate_sql_type= "mixed";
static unsigned long connect_flags= CLIENT_MULTI_RESULTS |
CLIENT_MULTI_STATEMENTS |
CLIENT_REMEMBER_OPTIONS;
static int verbose;
static uint commit_rate;
static uint detach_rate;
const char *num_int_cols_opt;
const char *num_char_cols_opt;
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
2007-08-01 21:59:05 +02:00
/* Yes, we do set defaults here */
static unsigned int num_int_cols= 1;
static unsigned int num_char_cols= 1;
static unsigned int num_int_cols_index= 0;
static unsigned int num_char_cols_index= 0;
static unsigned int iterations;
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
2007-08-01 21:59:05 +02:00
static uint my_end_arg= 0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static ulonglong actual_queries= 0;
static ulonglong auto_actual_queries;
static ulonglong auto_generate_sql_unique_write_number;
static ulonglong auto_generate_sql_unique_query_number;
static unsigned int auto_generate_sql_secondary_indexes;
static ulonglong num_of_query;
static ulonglong auto_generate_sql_number;
const char *concurrency_str= NULL;
static char *create_string;
uint *concurrency;
static char mysql_charsets_dir[FN_REFLEN+1];
const char *default_dbug_option="d:t:o,/tmp/mysqlslap.trace";
const char *opt_csv_str;
File csv_file;
static uint opt_protocol= 0;
static int get_options(int *argc,char ***argv);
static uint opt_mysql_port= 0;
Ensure that all clients reads the appropriate 'client', client-mariadb and 'mariadb' sections from my.cnf The mysqld server and all clients now reads the new client-server section Fixed that mysqldumpslow supports new slow log formats and new mysqld --slow- options client/mysql.cc: Read also client-server and client-mariadb sections. client/mysql_upgrade.c: Read also client-server and client-mariadb sections. client/mysqladmin.cc: Read also client-server and client-mariadb sections. client/mysqlbinlog.cc: Read also client-server and client-mariadb sections. client/mysqlcheck.c: Read also client-server and client-mariadb sections. client/mysqldump.c: Read also client-server and client-mariadb sections. client/mysqlimport.c: Read also client-server and client-mariadb sections. client/mysqlshow.c: Read also client-server and client-mariadb sections. client/mysqltest.cc: Read also client-server and client-mariadb sections. extra/my_print_defaults.c: Updated help text scripts/mysql_fix_privilege_tables.sh: Read also sections client client-server client-mariadb scripts/mysql_install_db.pl.in: Also allow --data=* option Read also groups mariadb, server and client-server. scripts/mysql_install_db.sh: Also allow --data=* option Read also groups mariadb, server and client-server. Added --lose-skip-pbxt to bootstrap scripts/mysql_secure_installation.sh: Read also groups client-server and client-mariadb scripts/mysqld_multi.sh: Read also group mariadb scripts/mysqld_safe.sh: Read also groups mariadb server and client-server scripts/mysqldumpslow.sh: Fixed to support new slow log formats Added sorting on -ae (aggregated number of retreived rows) and e (retrieved rows) Read also group 'mariadb' If there is many instances of same option, use last one. Get slow log file from options log-slow-queries=filename or query-log-file=filename Added support for future --log-basename option sql-common/client.c: Read also groups 'client-server' and 'client-mariadb' tests/mysql_client_test.c: Read also groups 'client-server' and 'client-mariadb' tests/thread_test.c: Read also groups 'client-server' and 'client-mariadb'
2011-03-18 16:03:43 +01:00
static const char *load_default_groups[]=
{ "mysqlslap", "client", "client-server", "client-mariadb", 0 };
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
typedef struct statement statement;
struct statement {
char *string;
size_t length;
unsigned char type;
char *option;
size_t option_length;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
statement *next;
};
typedef struct option_string option_string;
struct option_string {
char *string;
size_t length;
char *option;
size_t option_length;
option_string *next;
};
typedef struct stats stats;
struct stats {
long int timing;
uint users;
unsigned long long rows;
};
typedef struct thread_context thread_context;
struct thread_context {
statement *stmt;
ulonglong limit;
};
typedef struct conclusions conclusions;
struct conclusions {
char *engine;
long int avg_timing;
long int max_timing;
long int min_timing;
uint users;
unsigned long long avg_rows;
/* The following are not used yet */
unsigned long long max_rows;
unsigned long long min_rows;
};
static option_string *engine_options= NULL;
static statement *pre_statements= NULL;
static statement *post_statements= NULL;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
static statement *create_statements= NULL,
*query_statements= NULL;
/* Prototypes */
void print_conclusions(conclusions *con);
void print_conclusions_csv(conclusions *con);
void generate_stats(conclusions *con, option_string *eng, stats *sptr);
uint parse_comma(const char *string, uint **range);
uint parse_delimiter(const char *script, statement **stmt, char delm);
int parse_option(const char *origin, option_string **stmt, char delm);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
static int drop_schema(MYSQL *mysql, const char *db);
uint get_random_string(char *buf);
static statement *build_table_string(void);
static statement *build_insert_string(void);
static statement *build_update_string(void);
static statement * build_select_string(my_bool key);
static int generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt);
static int drop_primary_key_list(void);
static int create_schema(MYSQL *mysql, const char *db, statement *stmt,
option_string *engine_stmt);
static int run_scheduler(stats *sptr, statement *stmts, uint concur,
ulonglong limit);
pthread_handler_t run_task(void *p);
void statement_cleanup(statement *stmt);
void option_cleanup(option_string *stmt);
void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr);
static int run_statements(MYSQL *mysql, statement *stmt);
int slap_connect(MYSQL *mysql);
static int run_query(MYSQL *mysql, const char *query, size_t len);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
static const char ALPHANUMERICS[]=
"0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
#define ALPHANUMERICS_SIZE (sizeof(ALPHANUMERICS)-1)
static long int timedif(struct timeval a, struct timeval b)
{
register int us, s;
us = a.tv_usec - b.tv_usec;
us /= 1000;
s = a.tv_sec - b.tv_sec;
s *= 1000;
return s + us;
}
#ifdef __WIN__
static int gettimeofday(struct timeval *tp, void *tzp)
{
unsigned int ticks;
ticks= GetTickCount();
tp->tv_usec= ticks*1000;
tp->tv_sec= ticks/1000;
return 0;
}
#endif
Patch set contributed by Alex Budovski (MCA) Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters .bzrignore: Fixed .bzrignore rules. Many were simply not ignoring what they were meant to. client/mysqlslap.c: Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters The original patch could cause memory leaks and odd problems depending on how connection was made. This code ensures that all mysql_options() are set for each mysql_real_connect(). (This patch by Monty) mysys/my_thr_init.c: Fixed multiply-initialized critical section on Windows, due to code incorrectly checking the wrong field in an attempt to prevent multiple-initialization. sql-common/client.c: Don't use shared memory if it's not set (for example after failed mysql_real_connect). Ensure that mysql_close() resets all resources so that it's safe to call it twice. (Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters) sql/CMakeLists.txt: Added page fault counters for SHOW PROFILE on Windows. sql/mysqld.cc: Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used) sql/sql_profile.cc: Added page fault counters for SHOW PROFILE on Windows. sql/sql_profile.h: Added page fault counters for SHOW PROFILE on Windows. sql/udf_example.def: Some cleanup functions were not exported from udf_example.dll, causing them to never be executed, and as a result multiple-initialization of kernel objects occurred and resources were not being freed correctly. storage/maria/ma_close.c: Condition variable share->key_del_cond was never being destroyed, while its containing heap block was being freed in maria_close(), leaking kernel resources.
2010-01-29 19:42:22 +01:00
void set_mysql_connect_options(MYSQL *mysql)
{
if (opt_compress)
mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS);
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
{
Patch set contributed by Alex Budovski (MCA) Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters .bzrignore: Fixed .bzrignore rules. Many were simply not ignoring what they were meant to. client/mysqlslap.c: Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters The original patch could cause memory leaks and odd problems depending on how connection was made. This code ensures that all mysql_options() are set for each mysql_real_connect(). (This patch by Monty) mysys/my_thr_init.c: Fixed multiply-initialized critical section on Windows, due to code incorrectly checking the wrong field in an attempt to prevent multiple-initialization. sql-common/client.c: Don't use shared memory if it's not set (for example after failed mysql_real_connect). Ensure that mysql_close() resets all resources so that it's safe to call it twice. (Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters) sql/CMakeLists.txt: Added page fault counters for SHOW PROFILE on Windows. sql/mysqld.cc: Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used) sql/sql_profile.cc: Added page fault counters for SHOW PROFILE on Windows. sql/sql_profile.h: Added page fault counters for SHOW PROFILE on Windows. sql/udf_example.def: Some cleanup functions were not exported from udf_example.dll, causing them to never be executed, and as a result multiple-initialization of kernel objects occurred and resources were not being freed correctly. storage/maria/ma_close.c: Condition variable share->key_del_cond was never being destroyed, while its containing heap block was being freed in maria_close(), leaking kernel resources.
2010-01-29 19:42:22 +01:00
mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
}
Patch set contributed by Alex Budovski (MCA) Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters .bzrignore: Fixed .bzrignore rules. Many were simply not ignoring what they were meant to. client/mysqlslap.c: Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters The original patch could cause memory leaks and odd problems depending on how connection was made. This code ensures that all mysql_options() are set for each mysql_real_connect(). (This patch by Monty) mysys/my_thr_init.c: Fixed multiply-initialized critical section on Windows, due to code incorrectly checking the wrong field in an attempt to prevent multiple-initialization. sql-common/client.c: Don't use shared memory if it's not set (for example after failed mysql_real_connect). Ensure that mysql_close() resets all resources so that it's safe to call it twice. (Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters) sql/CMakeLists.txt: Added page fault counters for SHOW PROFILE on Windows. sql/mysqld.cc: Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used) sql/sql_profile.cc: Added page fault counters for SHOW PROFILE on Windows. sql/sql_profile.h: Added page fault counters for SHOW PROFILE on Windows. sql/udf_example.def: Some cleanup functions were not exported from udf_example.dll, causing them to never be executed, and as a result multiple-initialization of kernel objects occurred and resources were not being freed correctly. storage/maria/ma_close.c: Condition variable share->key_del_cond was never being destroyed, while its containing heap block was being freed in maria_close(), leaking kernel resources.
2010-01-29 19:42:22 +01:00
#endif
if (opt_protocol)
mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
#ifdef HAVE_SMEM
if (shared_memory_base_name)
mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
}
int main(int argc, char **argv)
{
MYSQL mysql;
option_string *eptr;
MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv;
if (get_options(&argc,&argv))
{
free_defaults(defaults_argv);
my_end(0);
exit(1);
}
sf_leaking_memory=0; /* from now on we cleanup properly */
/* Seed the random number generator if we will be using it. */
if (auto_generate_sql)
srandom((uint)time(NULL));
if (argc > 2)
{
fprintf(stderr,"%s: Too many arguments\n",my_progname);
free_defaults(defaults_argv);
my_end(0);
exit(1);
}
mysql_init(&mysql);
Patch set contributed by Alex Budovski (MCA) Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters .bzrignore: Fixed .bzrignore rules. Many were simply not ignoring what they were meant to. client/mysqlslap.c: Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters The original patch could cause memory leaks and odd problems depending on how connection was made. This code ensures that all mysql_options() are set for each mysql_real_connect(). (This patch by Monty) mysys/my_thr_init.c: Fixed multiply-initialized critical section on Windows, due to code incorrectly checking the wrong field in an attempt to prevent multiple-initialization. sql-common/client.c: Don't use shared memory if it's not set (for example after failed mysql_real_connect). Ensure that mysql_close() resets all resources so that it's safe to call it twice. (Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters) sql/CMakeLists.txt: Added page fault counters for SHOW PROFILE on Windows. sql/mysqld.cc: Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used) sql/sql_profile.cc: Added page fault counters for SHOW PROFILE on Windows. sql/sql_profile.h: Added page fault counters for SHOW PROFILE on Windows. sql/udf_example.def: Some cleanup functions were not exported from udf_example.dll, causing them to never be executed, and as a result multiple-initialization of kernel objects occurred and resources were not being freed correctly. storage/maria/ma_close.c: Condition variable share->key_del_cond was never being destroyed, while its containing heap block was being freed in maria_close(), leaking kernel resources.
2010-01-29 19:42:22 +01:00
set_mysql_connect_options(&mysql);
Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade.
2011-01-16 04:59:05 +01:00
if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
2013-10-03 17:00:44 +02:00
mysql_options(&mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
mysql_options4(&mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
"program_name", "mysqlslap");
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
if (!opt_only_print)
{
if (!(mysql_real_connect(&mysql, host, user, opt_password,
NULL, opt_mysql_port,
opt_mysql_unix_port, connect_flags)))
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
fprintf(stderr,"%s: Error when connecting to server: %s\n",
my_progname,mysql_error(&mysql));
mysql_close(&mysql);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
free_defaults(defaults_argv);
my_end(0);
exit(1);
}
}
Backport of: ---------------------------------------------------------------------- ChangeSet@1.2571, 2008-04-08 12:30:06+02:00, vvaintroub@wva. +122 -0 Bug#32082 : definition of VOID in my_global.h conflicts with Windows SDK headers VOID macro is now removed. Its usage is replaced with void cast. In some cases, where cast does not make much sense (pthread_*, printf, hash_delete, my_seek), cast is ommited. client/mysqladmin.cc: Bug#32082 : remove VOID macro client/mysqldump.c: Bug#32082 : remove VOID macro client/mysqlimport.c: Bug#32082 : remove VOID macro client/mysqlslap.c: Bug#32082 : remove VOID macro client/mysqltest.cc: Bug#32082 : remove VOID macro client/sql_string.cc: Bug#32082 : remove VOID macro extra/comp_err.c: Bug#32082 : remove VOID macro extra/replace.c: Bug#32082 : remove VOID macro include/my_alarm.h: Bug#32082 : remove VOID macro include/my_global.h: Bug#32082 : remove VOID macro libmysql/libmysql.c: Bug#32082 : remove VOID macro mysys/errors.c: Bug#32082 : remove VOID macro mysys/hash.c: Bug#32082 : remove VOID macro mysys/mf_iocache2.c: Bug#32082 : remove VOID macro mysys/mf_loadpath.c: Bug#32082 : remove VOID macro mysys/mf_path.c: Bug#32082 : remove VOID macro mysys/my_append.c: Bug#32082 : remove VOID macro mysys/my_clock.c: Bug#32082 : remove VOID macro mysys/my_copy.c: Bug#32082 : remove VOID macro mysys/my_fstream.c: Bug#32082 : remove VOID macro mysys/my_getwd.c: Bug#32082 : remove VOID macro mysys/my_lib.c: Bug#32082 : remove VOID macro mysys/my_lockmem.c: Bug#32082 : remove VOID macro mysys/my_pthread.c: Bug#32082 : remove VOID macro mysys/my_redel.c: Bug#32082 : remove VOID macro mysys/stacktrace.c: Bug#32082 : remove VOID macro mysys/thr_alarm.c: Bug#32082 : remove VOID macro mysys/thr_lock.c: Bug#32082 : remove VOID macro sql/derror.cc: Bug#32082 : remove VOID macro sql/des_key_file.cc: Bug#32082 : remove VOID macro sql/discover.cc: Bug#32082 : remove VOID macro sql/field.cc: Bug#32082 : remove VOID macro sql/filesort.cc: Bug#32082 : remove VOID macro sql/ha_ndbcluster.cc: Bug#32082 : remove VOID macro sql/ha_partition.cc: Bug#32082 : remove VOID macro sql/handler.cc: Bug#32082 : remove VOID macro sql/hostname.cc: Bug#32082 : remove VOID macro sql/init.cc: Bug#32082 : remove VOID macro sql/item.cc: Bug#32082 : remove VOID macro sql/item_cmpfunc.cc: Bug#32082 : remove VOID macro sql/item_strfunc.cc: Bug#32082 : remove VOID macro sql/lock.cc: Bug#32082 : remove VOID macro sql/log.cc: Bug#32082 : remove VOID macro sql/log_event.cc: Bug#32082 : remove VOID macro sql/mysqld.cc: Bug#32082 : remove VOID macro sql/opt_range.h: Bug#32082 : remove VOID macro sql/protocol.cc: Bug#32082 : remove VOID macro sql/records.cc: Bug#32082 : remove VOID macro sql/sp_head.cc: Bug#32082 : remove VOID macro sql/sp_pcontext.cc: Bug#32082 : remove VOID macro sql/sql_acl.cc: Bug#32082 : remove VOID macro sql/sql_base.cc: Bug#32082 : remove VOID macro sql/sql_cache.cc: Bug#32082 : remove VOID macro sql/sql_connect.cc: Bug#32082 : remove VOID macro sql/sql_db.cc: Bug#32082 : remove VOID macro sql/sql_delete.cc: Bug#32082 : remove VOID macro sql/sql_handler.cc: Bug#32082 : remove VOID macro sql/sql_insert.cc: Bug#32082 : remove VOID macro sql/sql_map.cc: Bug#32082 : remove VOID macro sql/sql_parse.cc: Bug#32082 : remove VOID macro sql/sql_select.cc: Bug#32082 : remove VOID macro sql/sql_servers.cc: Bug#32082 : remove VOID macro sql/sql_show.cc: Bug#32082 : remove VOID macro sql/sql_string.cc: Bug#32082 : remove VOID macro sql/sql_table.cc: Bug#32082 : remove VOID macro sql/sql_test.cc: Bug#32082 : remove VOID macro sql/sql_trigger.cc: Bug#32082 : remove VOID macro sql/sql_update.cc: Bug#32082 : remove VOID macro sql/sql_view.cc: Bug#32082 : remove VOID macro sql/table.cc: Bug#32082 : remove VOID macro sql/tztime.cc: Bug#32082 : remove VOID macro sql/udf_example.c: Bug#32082 : remove VOID macro sql/uniques.cc: Bug#32082 : remove VOID macro sql/unireg.cc: Bug#32082 : remove VOID macro storage/archive/ha_archive.cc: Bug#32082 : remove VOID macro storage/blackhole/ha_blackhole.cc: Bug#32082 : remove VOID macro storage/csv/ha_tina.cc: Bug#32082 : remove VOID macro storage/csv/transparent_file.cc: Bug#32082 : remove VOID macro storage/example/ha_example.cc: Bug#32082 : remove VOID macro storage/federated/ha_federated.cc: Bug#32082 : remove VOID macro storage/heap/hp_clear.c: Bug#32082 : remove VOID macro storage/heap/hp_create.c: Bug#32082 : remove VOID macro storage/heap/hp_test1.c: Bug#32082 : remove VOID macro storage/heap/hp_test2.c: Bug#32082 : remove VOID macro storage/innobase/handler/ha_innodb.cc: Bug#32082 : remove VOID macro storage/myisam/ft_eval.c: Bug#32082 : remove VOID macro storage/myisam/ha_myisam.cc: Bug#32082 : remove VOID macro storage/myisam/mi_changed.c: Bug#32082 : remove VOID macro storage/myisam/mi_check.c: Bug#32082 : remove VOID macro storage/myisam/mi_close.c: Bug#32082 : remove VOID macro storage/myisam/mi_create.c: Bug#32082 : remove VOID macro storage/myisam/mi_dbug.c: Bug#32082 : remove VOID macro storage/myisam/mi_delete.c: Bug#32082 : remove VOID macro storage/myisam/mi_delete_all.c: Bug#32082 : remove VOID macro storage/myisam/mi_dynrec.c: Bug#32082 : remove VOID macro storage/myisam/mi_info.c: Bug#32082 : remove VOID macro storage/myisam/mi_locking.c: Bug#32082 : remove VOID macro storage/myisam/mi_log.c: Bug#32082 : remove VOID macro storage/myisam/mi_open.c: Bug#32082 : remove VOID macro storage/myisam/mi_packrec.c: Bug#32082 : remove VOID macro storage/myisam/mi_panic.c: Bug#32082 : remove VOID macro storage/myisam/mi_rsame.c: Bug#32082 : remove VOID macro storage/myisam/mi_statrec.c: Bug#32082 : remove VOID macro storage/myisam/mi_test1.c: Bug#32082 : remove VOID macro storage/myisam/mi_test2.c: Bug#32082 : remove VOID macro storage/myisam/mi_test3.c: Bug#32082 : remove VOID macro storage/myisam/mi_update.c: Bug#32082 : remove VOID macro storage/myisam/mi_write.c: Bug#32082 : remove VOID macro storage/myisam/myisamchk.c: Bug#32082 : remove VOID macro storage/myisam/myisamlog.c: Bug#32082 : remove VOID macro storage/myisam/myisampack.c: Bug#32082 : remove VOID macro storage/myisam/sort.c: Bug#32082 : remove VOID macro storage/myisammrg/myrg_close.c: Bug#32082 : remove VOID macro storage/myisammrg/myrg_create.c: Bug#32082 : remove VOID macro storage/myisammrg/myrg_open.c: Bug#32082 : remove VOID macro strings/str_test.c: Bug#32082 : remove VOID macro tests/thread_test.c: Bug#32082 : remove VOID macro
2009-11-24 14:54:59 +01:00
pthread_mutex_init(&counter_mutex, NULL);
pthread_cond_init(&count_threshhold, NULL);
pthread_mutex_init(&sleeper_mutex, NULL);
pthread_cond_init(&sleep_threshhold, NULL);
/* Main iterations loop */
eptr= engine_options;
do
{
/* For the final stage we run whatever queries we were asked to run */
uint *current;
if (verbose >= 2)
printf("Starting Concurrency Test\n");
if (*concurrency)
{
for (current= concurrency; current && *current; current++)
concurrency_loop(&mysql, *current, eptr);
}
else
{
uint infinite= 1;
do {
concurrency_loop(&mysql, infinite, eptr);
}
while (infinite++);
}
if (!opt_preserve)
drop_schema(&mysql, create_schema_string);
} while (eptr ? (eptr= eptr->next) : 0);
Backport of: ---------------------------------------------------------------------- ChangeSet@1.2571, 2008-04-08 12:30:06+02:00, vvaintroub@wva. +122 -0 Bug#32082 : definition of VOID in my_global.h conflicts with Windows SDK headers VOID macro is now removed. Its usage is replaced with void cast. In some cases, where cast does not make much sense (pthread_*, printf, hash_delete, my_seek), cast is ommited. client/mysqladmin.cc: Bug#32082 : remove VOID macro client/mysqldump.c: Bug#32082 : remove VOID macro client/mysqlimport.c: Bug#32082 : remove VOID macro client/mysqlslap.c: Bug#32082 : remove VOID macro client/mysqltest.cc: Bug#32082 : remove VOID macro client/sql_string.cc: Bug#32082 : remove VOID macro extra/comp_err.c: Bug#32082 : remove VOID macro extra/replace.c: Bug#32082 : remove VOID macro include/my_alarm.h: Bug#32082 : remove VOID macro include/my_global.h: Bug#32082 : remove VOID macro libmysql/libmysql.c: Bug#32082 : remove VOID macro mysys/errors.c: Bug#32082 : remove VOID macro mysys/hash.c: Bug#32082 : remove VOID macro mysys/mf_iocache2.c: Bug#32082 : remove VOID macro mysys/mf_loadpath.c: Bug#32082 : remove VOID macro mysys/mf_path.c: Bug#32082 : remove VOID macro mysys/my_append.c: Bug#32082 : remove VOID macro mysys/my_clock.c: Bug#32082 : remove VOID macro mysys/my_copy.c: Bug#32082 : remove VOID macro mysys/my_fstream.c: Bug#32082 : remove VOID macro mysys/my_getwd.c: Bug#32082 : remove VOID macro mysys/my_lib.c: Bug#32082 : remove VOID macro mysys/my_lockmem.c: Bug#32082 : remove VOID macro mysys/my_pthread.c: Bug#32082 : remove VOID macro mysys/my_redel.c: Bug#32082 : remove VOID macro mysys/stacktrace.c: Bug#32082 : remove VOID macro mysys/thr_alarm.c: Bug#32082 : remove VOID macro mysys/thr_lock.c: Bug#32082 : remove VOID macro sql/derror.cc: Bug#32082 : remove VOID macro sql/des_key_file.cc: Bug#32082 : remove VOID macro sql/discover.cc: Bug#32082 : remove VOID macro sql/field.cc: Bug#32082 : remove VOID macro sql/filesort.cc: Bug#32082 : remove VOID macro sql/ha_ndbcluster.cc: Bug#32082 : remove VOID macro sql/ha_partition.cc: Bug#32082 : remove VOID macro sql/handler.cc: Bug#32082 : remove VOID macro sql/hostname.cc: Bug#32082 : remove VOID macro sql/init.cc: Bug#32082 : remove VOID macro sql/item.cc: Bug#32082 : remove VOID macro sql/item_cmpfunc.cc: Bug#32082 : remove VOID macro sql/item_strfunc.cc: Bug#32082 : remove VOID macro sql/lock.cc: Bug#32082 : remove VOID macro sql/log.cc: Bug#32082 : remove VOID macro sql/log_event.cc: Bug#32082 : remove VOID macro sql/mysqld.cc: Bug#32082 : remove VOID macro sql/opt_range.h: Bug#32082 : remove VOID macro sql/protocol.cc: Bug#32082 : remove VOID macro sql/records.cc: Bug#32082 : remove VOID macro sql/sp_head.cc: Bug#32082 : remove VOID macro sql/sp_pcontext.cc: Bug#32082 : remove VOID macro sql/sql_acl.cc: Bug#32082 : remove VOID macro sql/sql_base.cc: Bug#32082 : remove VOID macro sql/sql_cache.cc: Bug#32082 : remove VOID macro sql/sql_connect.cc: Bug#32082 : remove VOID macro sql/sql_db.cc: Bug#32082 : remove VOID macro sql/sql_delete.cc: Bug#32082 : remove VOID macro sql/sql_handler.cc: Bug#32082 : remove VOID macro sql/sql_insert.cc: Bug#32082 : remove VOID macro sql/sql_map.cc: Bug#32082 : remove VOID macro sql/sql_parse.cc: Bug#32082 : remove VOID macro sql/sql_select.cc: Bug#32082 : remove VOID macro sql/sql_servers.cc: Bug#32082 : remove VOID macro sql/sql_show.cc: Bug#32082 : remove VOID macro sql/sql_string.cc: Bug#32082 : remove VOID macro sql/sql_table.cc: Bug#32082 : remove VOID macro sql/sql_test.cc: Bug#32082 : remove VOID macro sql/sql_trigger.cc: Bug#32082 : remove VOID macro sql/sql_update.cc: Bug#32082 : remove VOID macro sql/sql_view.cc: Bug#32082 : remove VOID macro sql/table.cc: Bug#32082 : remove VOID macro sql/tztime.cc: Bug#32082 : remove VOID macro sql/udf_example.c: Bug#32082 : remove VOID macro sql/uniques.cc: Bug#32082 : remove VOID macro sql/unireg.cc: Bug#32082 : remove VOID macro storage/archive/ha_archive.cc: Bug#32082 : remove VOID macro storage/blackhole/ha_blackhole.cc: Bug#32082 : remove VOID macro storage/csv/ha_tina.cc: Bug#32082 : remove VOID macro storage/csv/transparent_file.cc: Bug#32082 : remove VOID macro storage/example/ha_example.cc: Bug#32082 : remove VOID macro storage/federated/ha_federated.cc: Bug#32082 : remove VOID macro storage/heap/hp_clear.c: Bug#32082 : remove VOID macro storage/heap/hp_create.c: Bug#32082 : remove VOID macro storage/heap/hp_test1.c: Bug#32082 : remove VOID macro storage/heap/hp_test2.c: Bug#32082 : remove VOID macro storage/innobase/handler/ha_innodb.cc: Bug#32082 : remove VOID macro storage/myisam/ft_eval.c: Bug#32082 : remove VOID macro storage/myisam/ha_myisam.cc: Bug#32082 : remove VOID macro storage/myisam/mi_changed.c: Bug#32082 : remove VOID macro storage/myisam/mi_check.c: Bug#32082 : remove VOID macro storage/myisam/mi_close.c: Bug#32082 : remove VOID macro storage/myisam/mi_create.c: Bug#32082 : remove VOID macro storage/myisam/mi_dbug.c: Bug#32082 : remove VOID macro storage/myisam/mi_delete.c: Bug#32082 : remove VOID macro storage/myisam/mi_delete_all.c: Bug#32082 : remove VOID macro storage/myisam/mi_dynrec.c: Bug#32082 : remove VOID macro storage/myisam/mi_info.c: Bug#32082 : remove VOID macro storage/myisam/mi_locking.c: Bug#32082 : remove VOID macro storage/myisam/mi_log.c: Bug#32082 : remove VOID macro storage/myisam/mi_open.c: Bug#32082 : remove VOID macro storage/myisam/mi_packrec.c: Bug#32082 : remove VOID macro storage/myisam/mi_panic.c: Bug#32082 : remove VOID macro storage/myisam/mi_rsame.c: Bug#32082 : remove VOID macro storage/myisam/mi_statrec.c: Bug#32082 : remove VOID macro storage/myisam/mi_test1.c: Bug#32082 : remove VOID macro storage/myisam/mi_test2.c: Bug#32082 : remove VOID macro storage/myisam/mi_test3.c: Bug#32082 : remove VOID macro storage/myisam/mi_update.c: Bug#32082 : remove VOID macro storage/myisam/mi_write.c: Bug#32082 : remove VOID macro storage/myisam/myisamchk.c: Bug#32082 : remove VOID macro storage/myisam/myisamlog.c: Bug#32082 : remove VOID macro storage/myisam/myisampack.c: Bug#32082 : remove VOID macro storage/myisam/sort.c: Bug#32082 : remove VOID macro storage/myisammrg/myrg_close.c: Bug#32082 : remove VOID macro storage/myisammrg/myrg_create.c: Bug#32082 : remove VOID macro storage/myisammrg/myrg_open.c: Bug#32082 : remove VOID macro strings/str_test.c: Bug#32082 : remove VOID macro tests/thread_test.c: Bug#32082 : remove VOID macro
2009-11-24 14:54:59 +01:00
pthread_mutex_destroy(&counter_mutex);
pthread_cond_destroy(&count_threshhold);
pthread_mutex_destroy(&sleeper_mutex);
pthread_cond_destroy(&sleep_threshhold);
mysql_close(&mysql); /* Close & free connection */
/* now free all the strings we created */
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(opt_password);
my_free(concurrency);
statement_cleanup(create_statements);
statement_cleanup(query_statements);
statement_cleanup(pre_statements);
statement_cleanup(post_statements);
option_cleanup(engine_options);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
#ifdef HAVE_SMEM
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(shared_memory_base_name);
#endif
free_defaults(defaults_argv);
fix memory leaks and other problems found by safemalloc client/mysql_upgrade.c: missing DBUG_RETURN client/mysqladmin.cc: client plugin memory wasn't freed client/mysqlcheck.c: client plugin memory, defaults, a result set, a command-line option value were not freed. missing DBUG_RETURN. client/mysqldump.c: client plugin memory wasn't freed client/mysqlslap.c: client plugin memory wasn't freed client/mysqltest.cc: hopeless. cannot be fixed. mysql-test/valgrind.supp: Bug#56666 is now fixed. mysys/array.c: really, don't allocate if the caller didn't ask to. mysys/my_init.c: safemalloc checks must be done at the very end mysys/my_thr_init.c: not needed anymore sql-common/client.c: memory leak sql/log.cc: log_file was not closed, memory leak. sql/mysqld.cc: fix bug#56666 (causing many P_S related memory leaks). close_active_mi() not called for --bootstrap, memory leak. sql/sql_lex.cc: redo Lex->mi handling sql/sql_lex.h: redo Lex->mi handling sql/sql_plugin.cc: plugins having PLUGIN_VAR_MEMALLOC string variables have this variables allocated in every THD. The memory was freed in ~THD but only if plugin was still active. If plugin was unloaded the variable was not found and the memory was lost. By loading and unloading plugins an arbitrary amount of memory can be lost. sql/sql_repl.cc: redo Lex->mi handling sql/sql_yacc.yy: completely wrong handling of Lex->mi - run-time memory leak, by repeating the statement arbitrary amount of memory can be lost. Lex->mi.repl_ignore_server_ids_opt was allocated when parsing CHANGE MASTER, and freed after executing the statement. if parser failed on syntax (or another) error the statement was never executed. Lex->mi was simply bzero-ed for the next CHANGE MASTER statement. sql/table.cc: didn't compile storage/perfschema/pfs_lock.h: Bug#56666 is fixed
2011-07-10 20:09:17 +02:00
mysql_library_end();
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
2007-08-01 21:59:05 +02:00
my_end(my_end_arg);
return 0;
}
void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
{
unsigned int x;
stats *head_sptr;
stats *sptr;
conclusions conclusion;
unsigned long long client_limit;
int sysret;
head_sptr= (stats *)my_malloc(sizeof(stats) * iterations,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
bzero(&conclusion, sizeof(conclusions));
if (auto_actual_queries)
client_limit= auto_actual_queries;
else if (num_of_query)
client_limit= num_of_query / current;
else
client_limit= actual_queries;
for (x= 0, sptr= head_sptr; x < iterations; x++, sptr++)
{
/*
We might not want to load any data, such as when we are calling
a stored_procedure that doesn't use data, or we know we already have
data in the table.
*/
if (!opt_preserve)
drop_schema(mysql, create_schema_string);
/* First we create */
if (create_statements)
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
{
/*
If we have an --engine option, then we indicate
create_schema() to add the engine type to the DDL.
*/
if (eptr)
create_statements->type= CREATE_TABLE_TYPE;
create_schema(mysql, create_schema_string, create_statements, eptr);
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
}
/*
If we generated GUID we need to build a list of them from creation that
we can later use.
*/
if (verbose >= 2)
printf("Generating primary key list\n");
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
generate_primary_key_list(mysql, eptr);
if (commit_rate)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
if (pre_system && (sysret= system(pre_system)) != 0)
fprintf(stderr,
"Warning: Execution of pre_system option returned %d.\n",
sysret);
/*
Pre statements are always run after all other logic so they can
correct/adjust any item that they want.
*/
if (pre_statements)
run_statements(mysql, pre_statements);
run_scheduler(sptr, query_statements, current, client_limit);
if (post_statements)
run_statements(mysql, post_statements);
if (post_system && (sysret= system(post_system)) != 0)
fprintf(stderr,
"Warning: Execution of post_system option returned %d.\n",
sysret);
/* We are finished with this run */
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
drop_primary_key_list();
}
if (verbose >= 2)
printf("Generating stats\n");
generate_stats(&conclusion, eptr, head_sptr);
if (!opt_silent)
print_conclusions(&conclusion);
if (opt_csv_str)
print_conclusions_csv(&conclusion);
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(head_sptr);
}
static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"auto-generate-sql", 'a',
"Generate SQL where not supplied by file or command line.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql, &auto_generate_sql,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
"Add an AUTO_INCREMENT column to auto-generated tables.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql_autoincrement,
&auto_generate_sql_autoincrement,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
"Set this number to generate a set number of queries to run.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_actual_queries, &auto_actual_queries,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
"Add GUID based primary keys to auto-generated tables.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql_guid_primary,
&auto_generate_sql_guid_primary,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
"Specify test load type: mixed, update, write, key, or read; default is mixed.",
(char**) &auto_generate_sql_type, (char**) &auto_generate_sql_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-secondary-indexes",
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
"Number of secondary indexes to add to auto-generated tables.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql_secondary_indexes,
&auto_generate_sql_secondary_indexes, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-query-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
"Number of unique queries to generate for automatic tests.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql_unique_query_number,
&auto_generate_sql_unique_query_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-write-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
"Number of unique queries to generate for auto-generate-sql-write-number.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql_unique_write_number,
&auto_generate_sql_unique_write_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
"Number of row inserts to perform for each thread (default is 100).",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&auto_generate_sql_number, &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", (char **)&charsets_dir,
(char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"concurrency", 'c', "Number of clients to simulate for query to run.",
(char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&create_string, &create_string, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
(char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR,
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.",
NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel BitKeeper/etc/ignore: auto-union client/mysqlcheck.c: Auto merged client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged include/Makefile.am: Auto merged include/m_string.h: Auto merged include/my_base.h: Auto merged include/my_dbug.h: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged libmysql/CMakeLists.txt: Auto merged libmysql/Makefile.shared: Auto merged mysql-test/lib/mtr_report.pl: Auto merged mysys/mf_keycache.c: Auto merged sql/gen_lex_hash.cc: Auto merged sql/ha_partition.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item_func.cc: Auto merged sql/lex.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/unireg.cc: Auto merged storage/myisam/ft_boolean_search.c: Auto merged storage/myisam/ft_nlq_search.c: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/myisampack.c: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged client/mysqlslap.c: Manual merge with main 5.1 tree.
2008-02-08 12:13:33 +01:00
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
(char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&debug_check_flag, &debug_check_flag, 0,
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
2007-08-01 21:59:05 +02:00
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
{"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade.
2011-01-16 04:59:05 +01:00
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade.
2011-01-16 04:59:05 +01:00
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.",
This patch fixes LP#613408 Memory corruption with (M)aria storage engine and virtual columns in MariaDB 5.2 Fixed compiler warnings Disabled some tests that doesn't work on windows (uses shell tools or strange characters) client/mysqlshow.c: Fixed compiler warnings client/mysqlslap.c: Fixed compiler warnings mysql-test/mysql-test-run.pl: Use an error file instead of /dev/null (Fixes problem on Windows and the output may be usefull) mysql-test/suite/maria/r/maria.result: Test case for bug LP#613408 (not complete) mysql-test/suite/maria/t/maria.test: Test case for bug LP#613408 (not complete) mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_log_slow_slave_statements.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-long_query_time.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test: This test doesn't work one windows (needs shell tools) mysql-test/t/ctype_filesystem.test: This test doesn't work one windows (problem with character sets) mysql-test/t/events_time_zone.test: Use longer times to get predictable tests mysql-test/t/show_check-master.opt: set long query time to get more predictable tests storage/maria/ma_check.c: Restore info->s->lock_key_trees after repair. Disable logging to temp tables for all repair cases (safety fix) storage/maria/ma_state.c: Ensurethat info->state_start doesn't point to freed memory. (Could happen after running an internal repair to fast create indexes) storage/maria/trnman.c: Added longer comment
2010-08-07 16:42:30 +02:00
(char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"detach", OPT_SLAP_DETACH,
"Detach (close and reopen) connections after X number of requests.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&detach_rate, &detach_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"engine", 'e',
"Comma separated list of storage engines to use for creating the table."
" The test is run for each engine. You can also specify an option for an "
"engine after a `:', like memory:max_row=2300",
&default_engine, &default_engine, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
"SQL Command to execute when connecting to MySQL server. Will "
"automatically be re-executed when reconnecting.",
&opt_init_command, &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
{"iterations", 'i', "Number of times to run the tests.", &iterations,
&iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.",
&opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{"number-char-cols", 'x',
"Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
(char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{"number-int-cols", 'y',
"Number of INT columns to create in table if specifying --auto-generate-sql.",
(char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY,
"Limit each client to this number of queries (this is not exact).",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&num_of_query, &num_of_query, 0,
GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{"only-print", OPT_MYSQL_ONLY_PRINT,
2010-02-04 13:39:42 +01:00
"Do not connect to the databases, but instead print out what would have "
"been done.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&opt_only_print, &opt_only_print, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's "
"asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade.
2011-01-16 04:59:05 +01:00
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Postfix covering other mysql standard clients like mysql_upgrade, mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap. client/client_priv.h: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Added an entry for 'default-auth' option. client/mysql.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysql_upgrade.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqladmin.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlbinlog.cc: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlcheck.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqldump.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients Updated the id entry for default_auth option. client/mysqlimport.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlshow.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. client/mysqlslap.c: Bug#58139 : default-auth option not recognized in MySQL standard command line clients. Introduced two new variables to hold values from default-auth and plugin-dir options and further pushed them to client's st_mysql instance. mysql-test/r/plugin_auth.result: Added test case for Bug#58139 for mysql_upgrade. mysql-test/t/plugin_auth.test: Added test case for Bug#58139 for mysql_upgrade.
2011-01-16 04:59:05 +01:00
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
{"port", 'P', "Port number to use for connection.", &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"post-query", OPT_SLAP_POST_QUERY,
"Query to run or file containing query to execute after tests have completed.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&user_supplied_post_statements, &user_supplied_post_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"post-system", OPT_SLAP_POST_SYSTEM,
"system() string to execute after tests have completed.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&post_system, &post_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-query", OPT_SLAP_PRE_QUERY,
"Query to run or file containing query to execute before running tests.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&user_supplied_pre_statements, &user_supplied_pre_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-system", OPT_SLAP_PRE_SYSTEM,
"system() string to execute before running tests.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&pre_system, &pre_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL,
2010-02-04 13:39:42 +01:00
"The protocol to use for connection (tcp, socket, pipe, memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"query", 'q', "Query to run or file containing query to run.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&user_supplied_query, &user_supplied_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
"Base name of shared memory.", &shared_memory_base_name,
&shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Run program in silent mode - no output.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&opt_silent, &opt_silent, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
2010-02-04 13:39:42 +01:00
{"socket", 'S', "The socket file to use for connection.",
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
&opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#ifndef DONT_ALLOW_USER_CHANGE
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
{"user", 'u', "User for login if not current user.", &user,
&user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v',
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced. client/mysql.cc: Remove now-unnecessary casts. Break up large strings. client/mysql_upgrade.c: Remove now-unnecessary casts. client/mysqladmin.cc: Remove now-unnecessary casts. Break up large strings. client/mysqlbinlog.cc: Remove now-unnecessary casts. client/mysqlcheck.c: Remove now-unnecessary casts. client/mysqldump.c: Remove now-unnecessary casts. client/mysqlimport.c: Remove now-unnecessary casts. client/mysqlshow.c: Remove now-unnecessary casts. client/mysqlslap.c: Remove now-unnecessary casts. client/mysqltest.cc: Remove now-unnecessary casts. extra/comp_err.c: Remove now-unnecessary casts. extra/my_print_defaults.c: Remove now-unnecessary casts. Break up large strings. extra/mysql_waitpid.c: Remove now-unnecessary casts. extra/perror.c: Remove now-unnecessary casts. extra/resolve_stack_dump.c: Remove now-unnecessary casts. extra/resolveip.c: Remove now-unnecessary casts. include/my_getopt.h: Use a void pointer type as the opaque type to avoid problems with type incompatibility -- GCC issues warnings when the type name is not type compatible with a operand. As a side bonus, a explicit cast won't be necessary anymore. include/sslopt-longopts.h: Remove now-unnecessary casts. Break up large strings. mysys/my_getopt.c: Update opaque type and introduce a type definition for the argument to my_getopt_register_get_addr. server-tools/instance-manager/options.cc: Remove now-unnecessary casts. sql/mysqld.cc: Remove now-unnecessary casts. Break up large strings. Update mysql_getopt_value prototype (the old prototype was different from the definition anyway). sql/sql_plugin.cc: The type of a pointer to a function must be compatible with the pointed-to function type, otherwise the behavior is undefined. sql/table.cc: The variable buf pointer to pointer to pointer to constant char could improperly alias a incompatible type in call to fix_type_ pointers. Since this was actually dead code, it is simply removed. sql/unireg.cc: Remove call to get_form_pos. The code creates a new FRM file which is always truncated and writes the form position as 0. Hence, no need to retrieve it, we now for sure it is 0. storage/archive/archive_reader.c: Remove now-unnecessary casts. storage/myisam/ft_nlq_search.c: Read weight directly from the buffer. storage/myisam/fulltext.h: Add explanation about the type duality of a key buffer. Add accessor macro to retrieve a FT float value. storage/myisam/mi_test1.c: Remove now-unnecessary casts. storage/myisam/myisam_ftdump.c: Read weight directly from the buffer. storage/myisam/myisamchk.c: Remove now-unnecessary casts. storage/myisam/myisamlog.c: A pointer to char was used to alias a pointer to pointer to unsigned char, thus violating strict aliasing rules. storage/myisam/myisampack.c: Remove now-unnecessary casts. strings/decimal.c: Remove aliasing violation, printing the value is enough for debugging purposes. tests/mysql_client_test.c: Remove now-unnecessary casts.
2010-06-10 22:16:43 +02:00
"More verbose output; you can use this multiple times to get even more "
"verbose output.", &verbose, &verbose, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version(void)
{
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
2007-08-01 21:59:05 +02:00
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION,
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005"));
2010-02-04 13:39:42 +01:00
puts("Run a query multiple times against the server.\n");
printf("Usage: %s [OPTIONS]\n",my_progname);
print_defaults("my",load_default_groups);
Fix for MDEV-5547: Bad error message when moving very old .frm files to MariaDB 5.5. mysql_upgrade --help now also prints out --default options and variable values. mysql_upgrade now prints permission errors. mysql_upgrade doesn't print some non essential info if --silent is used. Added handler error message about incompatible versions Fixed that mysqlbug and mysql_install_db have the executable flag set. Removed executable flag for some non executable files. Changed in mysql_install_db askmonty.org to mariadb.com. Ensured that all client executables prints --default options the same way. Allow REPAIR ... USE_FRM for old .frm files if the are still compatible. Extended shown error for storage engine messages. client/mysql.cc: print_defaults() should be first (as in all other programs) client/mysql_upgrade.c: --help now also prints out --default options and variable values Print out error if wrong permissions Don't print info if --silent client/mysqladmin.cc: print_defaults() should be first (as in all other programs) client/mysqlbinlog.cc: Added print_defaults() to --help client/mysqlcheck.c: Added empty line in --help client/mysqlimport.c: Added empty line in --help client/mysqlshow.c: Made --help compatible client/mysqlslap.c: Made --help compatible client/mysqltest.cc: Added print_defaults() to --help include/handler_ername.h: Added handler error message include/my_base.h: Added handler error message mysql-test/r/mysql_upgrade.result: Updated results mysql-test/r/repair.result: Added test case for better error messages mysql-test/std_data/host_old.MYD: Added test case for better error messages mysql-test/std_data/host_old.MYI: Added test case for better error messages mysql-test/std_data/host_old.frm: Added test case for better error messages mysql-test/t/repair.test: Added test case for better error messages mysys/my_handler_errors.h: Added handler error message scripts/CMakeLists.txt: Fixed that mysqlbug and mysql_install_db have the executable flag set scripts/mysql_install_db.sh: askmonty.org -> mariadb.com sql/ha_partition.cc: Sometimes table_type() can be called for errors even if partition didn't manage to open any files sql/handler.cc: Write clear text for not handled, but defined error messages. sql/share/errmsg-utf8.txt: Extended shown error for storage engine messages sql/sql_admin.cc: Allow REPAIR ... USE_FRM for old .frm files if the are still compatible storage/myisam/ha_myisam.cc: Use new error message
2014-01-22 14:16:57 +01:00
puts("");
my_print_help(my_long_options);
Fix for MDEV-5547: Bad error message when moving very old .frm files to MariaDB 5.5. mysql_upgrade --help now also prints out --default options and variable values. mysql_upgrade now prints permission errors. mysql_upgrade doesn't print some non essential info if --silent is used. Added handler error message about incompatible versions Fixed that mysqlbug and mysql_install_db have the executable flag set. Removed executable flag for some non executable files. Changed in mysql_install_db askmonty.org to mariadb.com. Ensured that all client executables prints --default options the same way. Allow REPAIR ... USE_FRM for old .frm files if the are still compatible. Extended shown error for storage engine messages. client/mysql.cc: print_defaults() should be first (as in all other programs) client/mysql_upgrade.c: --help now also prints out --default options and variable values Print out error if wrong permissions Don't print info if --silent client/mysqladmin.cc: print_defaults() should be first (as in all other programs) client/mysqlbinlog.cc: Added print_defaults() to --help client/mysqlcheck.c: Added empty line in --help client/mysqlimport.c: Added empty line in --help client/mysqlshow.c: Made --help compatible client/mysqlslap.c: Made --help compatible client/mysqltest.cc: Added print_defaults() to --help include/handler_ername.h: Added handler error message include/my_base.h: Added handler error message mysql-test/r/mysql_upgrade.result: Updated results mysql-test/r/repair.result: Added test case for better error messages mysql-test/std_data/host_old.MYD: Added test case for better error messages mysql-test/std_data/host_old.MYI: Added test case for better error messages mysql-test/std_data/host_old.frm: Added test case for better error messages mysql-test/t/repair.test: Added test case for better error messages mysys/my_handler_errors.h: Added handler error message scripts/CMakeLists.txt: Fixed that mysqlbug and mysql_install_db have the executable flag set scripts/mysql_install_db.sh: askmonty.org -> mariadb.com sql/ha_partition.cc: Sometimes table_type() can be called for errors even if partition didn't manage to open any files sql/handler.cc: Write clear text for not handled, but defined error messages. sql/share/errmsg-utf8.txt: Extended shown error for storage engine messages sql/sql_admin.cc: Allow REPAIR ... USE_FRM for old .frm files if the are still compatible storage/myisam/ha_myisam.cc: Use new error message
2014-01-22 14:16:57 +01:00
my_print_variables(my_long_options);
}
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
DBUG_ENTER("get_one_option");
switch(optid) {
case 'v':
verbose++;
break;
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; /* Don't require password */
if (argument)
{
char *start= argument;
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(opt_password);
opt_password= my_strdup(argument,MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
if (*start)
start[1]= 0; /* Cut length of argument */
tty_password= 0;
}
else
tty_password= 1;
break;
case 'W':
#ifdef __WIN__
opt_protocol= MYSQL_PROTOCOL_PIPE;
#endif
break;
case OPT_MYSQL_PROTOCOL:
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
debug_check_flag= 1;
break;
case OPT_CHARSETS_DIR:
strmake_buf(mysql_charsets_dir, argument);
charsets_dir = mysql_charsets_dir;
break;
case OPT_SLAP_CSV:
if (!argument)
argument= (char *)"-"; /* use stdout */
opt_csv_str= argument;
break;
#include <sslopt-case.h>
case 'V':
print_version();
exit(0);
break;
case '?':
case 'I': /* Info */
usage();
exit(0);
}
DBUG_RETURN(0);
}
uint
get_random_string(char *buf)
{
char *buf_ptr= buf;
int x;
DBUG_ENTER("get_random_string");
for (x= RAND_STRING_SIZE; x > 0; x--)
*buf_ptr++= ALPHANUMERICS[random() % ALPHANUMERICS_SIZE];
DBUG_RETURN((uint)(buf_ptr - buf));
}
/*
build_table_string
This function builds a create table query if the user opts to not supply
a file or string containing a create table statement
*/
static statement *
build_table_string(void)
{
char buf[HUGE_STRING_LENGTH];
unsigned int col_count;
statement *ptr;
DYNAMIC_STRING table_string;
DBUG_ENTER("build_table_string");
DBUG_PRINT("info", ("num int cols %u num char cols %u",
num_int_cols, num_char_cols));
init_dynamic_string(&table_string, "", 1024, 1024);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
dynstr_append(&table_string, "CREATE TABLE `t1` (");
if (auto_generate_sql_autoincrement)
{
dynstr_append(&table_string, "id serial");
if (num_int_cols || num_char_cols)
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
dynstr_append(&table_string, ",");
}
if (auto_generate_sql_guid_primary)
{
dynstr_append(&table_string, "id varchar(36) primary key");
if (num_int_cols || num_char_cols || auto_generate_sql_guid_primary)
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
dynstr_append(&table_string, ",");
}
if (auto_generate_sql_secondary_indexes)
{
unsigned int count;
for (count= 0; count < auto_generate_sql_secondary_indexes; count++)
{
if (count) /* Except for the first pass we add a comma */
dynstr_append(&table_string, ",");
if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(36) unique key", count)
> HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in create table\n");
exit(1);
}
dynstr_append(&table_string, buf);
}
if (num_int_cols || num_char_cols)
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
dynstr_append(&table_string, ",");
}
if (num_int_cols)
for (col_count= 1; col_count <= num_int_cols; col_count++)
{
if (num_int_cols_index)
{
if (snprintf(buf, HUGE_STRING_LENGTH, "intcol%d INT(32), INDEX(intcol%d)",
col_count, col_count) > HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in create table\n");
exit(1);
}
}
else
{
if (snprintf(buf, HUGE_STRING_LENGTH, "intcol%d INT(32) ", col_count)
> HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in create table\n");
exit(1);
}
}
dynstr_append(&table_string, buf);
if (col_count < num_int_cols || num_char_cols > 0)
dynstr_append(&table_string, ",");
}
if (num_char_cols)
for (col_count= 1; col_count <= num_char_cols; col_count++)
{
if (num_char_cols_index)
{
if (snprintf(buf, HUGE_STRING_LENGTH,
"charcol%d VARCHAR(128), INDEX(charcol%d) ",
col_count, col_count) > HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating table\n");
exit(1);
}
}
else
{
if (snprintf(buf, HUGE_STRING_LENGTH, "charcol%d VARCHAR(128)",
col_count) > HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating table\n");
exit(1);
}
}
dynstr_append(&table_string, buf);
if (col_count < num_char_cols)
dynstr_append(&table_string, ",");
}
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
dynstr_append(&table_string, ")");
ptr= (statement *)my_malloc(sizeof(statement),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->string = (char *)my_malloc(table_string.length+1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->length= table_string.length+1;
ptr->type= CREATE_TABLE_TYPE;
strmov(ptr->string, table_string.str);
dynstr_free(&table_string);
DBUG_RETURN(ptr);
}
/*
build_update_string()
This function builds insert statements when the user opts to not supply
an insert file or string containing insert data
*/
static statement *
build_update_string(void)
{
char buf[HUGE_STRING_LENGTH];
unsigned int col_count;
statement *ptr;
DYNAMIC_STRING update_string;
DBUG_ENTER("build_update_string");
init_dynamic_string(&update_string, "", 1024, 1024);
dynstr_append(&update_string, "UPDATE t1 SET ");
if (num_int_cols)
for (col_count= 1; col_count <= num_int_cols; col_count++)
{
if (snprintf(buf, HUGE_STRING_LENGTH, "intcol%d = %ld", col_count,
random()) > HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating update\n");
exit(1);
}
dynstr_append(&update_string, buf);
if (col_count < num_int_cols || num_char_cols > 0)
dynstr_append_mem(&update_string, ",", 1);
}
if (num_char_cols)
for (col_count= 1; col_count <= num_char_cols; col_count++)
{
char rand_buffer[RAND_STRING_SIZE];
int buf_len= get_random_string(rand_buffer);
if (snprintf(buf, HUGE_STRING_LENGTH, "charcol%d = '%.*s'", col_count,
buf_len, rand_buffer)
> HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating update\n");
exit(1);
}
dynstr_append(&update_string, buf);
if (col_count < num_char_cols)
dynstr_append_mem(&update_string, ",", 1);
}
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
dynstr_append(&update_string, " WHERE id = ");
ptr= (statement *)my_malloc(sizeof(statement),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->string= (char *)my_malloc(update_string.length + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->length= update_string.length+1;
if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
ptr->type= UPDATE_TYPE_REQUIRES_PREFIX ;
else
ptr->type= UPDATE_TYPE;
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
strmov(ptr->string, update_string.str);
dynstr_free(&update_string);
DBUG_RETURN(ptr);
}
/*
build_insert_string()
This function builds insert statements when the user opts to not supply
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
an insert file or string containing insert data
*/
static statement *
build_insert_string(void)
{
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
char buf[HUGE_STRING_LENGTH];
unsigned int col_count;
statement *ptr;
DYNAMIC_STRING insert_string;
DBUG_ENTER("build_insert_string");
init_dynamic_string(&insert_string, "", 1024, 1024);
dynstr_append(&insert_string, "INSERT INTO t1 VALUES (");
if (auto_generate_sql_autoincrement)
{
dynstr_append(&insert_string, "NULL");
if (num_int_cols || num_char_cols)
dynstr_append(&insert_string, ",");
}
if (auto_generate_sql_guid_primary)
{
dynstr_append(&insert_string, "uuid()");
if (num_int_cols || num_char_cols)
dynstr_append(&insert_string, ",");
}
if (auto_generate_sql_secondary_indexes)
{
unsigned int count;
for (count= 0; count < auto_generate_sql_secondary_indexes; count++)
{
if (count) /* Except for the first pass we add a comma */
dynstr_append(&insert_string, ",");
dynstr_append(&insert_string, "uuid()");
}
if (num_int_cols || num_char_cols)
dynstr_append(&insert_string, ",");
}
if (num_int_cols)
for (col_count= 1; col_count <= num_int_cols; col_count++)
{
if (snprintf(buf, HUGE_STRING_LENGTH, "%ld", random()) > HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating insert\n");
exit(1);
}
dynstr_append(&insert_string, buf);
if (col_count < num_int_cols || num_char_cols > 0)
dynstr_append_mem(&insert_string, ",", 1);
}
if (num_char_cols)
for (col_count= 1; col_count <= num_char_cols; col_count++)
{
int buf_len= get_random_string(buf);
dynstr_append_mem(&insert_string, "'", 1);
dynstr_append_mem(&insert_string, buf, buf_len);
dynstr_append_mem(&insert_string, "'", 1);
if (col_count < num_char_cols)
dynstr_append_mem(&insert_string, ",", 1);
}
dynstr_append_mem(&insert_string, ")", 1);
ptr= (statement *)my_malloc(sizeof(statement),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->string= (char *)my_malloc(insert_string.length + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->length= insert_string.length+1;
ptr->type= INSERT_TYPE;
strmov(ptr->string, insert_string.str);
dynstr_free(&insert_string);
DBUG_RETURN(ptr);
}
/*
build_select_string()
This function builds a query if the user opts to not supply a query
statement or file containing a query statement
*/
static statement *
build_select_string(my_bool key)
{
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
char buf[HUGE_STRING_LENGTH];
unsigned int col_count;
statement *ptr;
static DYNAMIC_STRING query_string;
DBUG_ENTER("build_select_string");
init_dynamic_string(&query_string, "", 1024, 1024);
dynstr_append_mem(&query_string, "SELECT ", 7);
for (col_count= 1; col_count <= num_int_cols; col_count++)
{
if (snprintf(buf, HUGE_STRING_LENGTH, "intcol%d", col_count)
> HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating select\n");
exit(1);
}
dynstr_append(&query_string, buf);
if (col_count < num_int_cols || num_char_cols > 0)
dynstr_append_mem(&query_string, ",", 1);
}
for (col_count= 1; col_count <= num_char_cols; col_count++)
{
if (snprintf(buf, HUGE_STRING_LENGTH, "charcol%d", col_count)
> HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in creating select\n");
exit(1);
}
dynstr_append(&query_string, buf);
if (col_count < num_char_cols)
dynstr_append_mem(&query_string, ",", 1);
}
dynstr_append(&query_string, " FROM t1");
if ((key) &&
(auto_generate_sql_autoincrement || auto_generate_sql_guid_primary))
dynstr_append(&query_string, " WHERE id = ");
ptr= (statement *)my_malloc(sizeof(statement),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->string= (char *)my_malloc(query_string.length + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr->length= query_string.length+1;
if ((key) &&
(auto_generate_sql_autoincrement || auto_generate_sql_guid_primary))
ptr->type= SELECT_TYPE_REQUIRES_PREFIX;
else
ptr->type= SELECT_TYPE;
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
strmov(ptr->string, query_string.str);
dynstr_free(&query_string);
dbug changes: 1. dbug state is now local to a thread 2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL, DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF 3. macros are do{}while(0) wrapped 4. incremental modifications to the dbug state (e.g. "+d,info:-t") 5. dbug code cleanup, style fixes 6. _db_on_ and DEBUGGER_ON/OFF removed 7. rest of MySQL code fixed because of 3 (missing ;) and 6 8. dbug manual updated 9. server variable @@debug (global and local) to control dbug from SQL! a. -#T to print timestamps in the log BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d: Delete: dbug/readme.prof client/mysqlslap.c: typo fixed configure.in: test for sleep() too dbug/dbug.c: thread local dbug settings DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL style changes to be more in line with MySQL code cleanup (many mallocs removed) incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info")) DBUG_SET, _db_explain_ -#T dbug/monty.doc: obsolete and duplicate docs removed dbug/user.r: new features documented include/my_dbug.h: correct do{}while wrapping thread local dbug settings DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL DBUG_EVALUATE,DBUG_EVALUATE_IF libmysql/libmysql.c: remove _db_on_ and DEBUGGER_ON/OFF mysys/my_init.c: missed DBUG_RETURN mysys/my_thr_init.c: bugfix - transaction id's are unsigned mysys/testhash.c: remove _db_on_ and DEBUGGER_ON/OFF sql/ha_myisammrg.cc: missed ; sql/ha_ndbcluster.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; sql/ha_ndbcluster_binlog.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; sql/item_cmpfunc.cc: missed ; sql/lock.cc: missed DBUG_RETURN sql/log_event.cc: missed ; sql/mysqld.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; DBUG_SET_INITIAL sql/opt_range.cc: remove _db_on_ and DEBUGGER_ON/OFF sql/set_var.cc: class sys_var_thd_dbug and "debug" server variable sql/set_var.h: class sys_var_thd_dbug and "debug" server variable sql/slave.cc: missed ; sql/sql_cache.cc: missed ; sql/sql_plugin.cc: missed ; sql/sql_select.cc: remove _db_on_ and DEBUGGER_ON/OFF storage/heap/hp_test2.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/ft_eval.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/ft_test1.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_open.c: remove _db_on_ and DEBUGGER_ON/OFF missed ; storage/myisam/mi_test1.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_test2.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_test3.c: remove _db_on_ and DEBUGGER_ON/OFF storage/ndb/src/ndbapi/DictCache.cpp: missed ; storage/ndb/src/ndbapi/NdbTransaction.cpp: missed ; tests/mysql_client_test.c: remove _db_on_ and DEBUGGER_ON/OFF
2006-02-14 22:36:11 +01:00
DBUG_RETURN(ptr);
}
dbug changes: 1. dbug state is now local to a thread 2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL, DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF 3. macros are do{}while(0) wrapped 4. incremental modifications to the dbug state (e.g. "+d,info:-t") 5. dbug code cleanup, style fixes 6. _db_on_ and DEBUGGER_ON/OFF removed 7. rest of MySQL code fixed because of 3 (missing ;) and 6 8. dbug manual updated 9. server variable @@debug (global and local) to control dbug from SQL! a. -#T to print timestamps in the log BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d: Delete: dbug/readme.prof client/mysqlslap.c: typo fixed configure.in: test for sleep() too dbug/dbug.c: thread local dbug settings DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL style changes to be more in line with MySQL code cleanup (many mallocs removed) incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info")) DBUG_SET, _db_explain_ -#T dbug/monty.doc: obsolete and duplicate docs removed dbug/user.r: new features documented include/my_dbug.h: correct do{}while wrapping thread local dbug settings DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL DBUG_EVALUATE,DBUG_EVALUATE_IF libmysql/libmysql.c: remove _db_on_ and DEBUGGER_ON/OFF mysys/my_init.c: missed DBUG_RETURN mysys/my_thr_init.c: bugfix - transaction id's are unsigned mysys/testhash.c: remove _db_on_ and DEBUGGER_ON/OFF sql/ha_myisammrg.cc: missed ; sql/ha_ndbcluster.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; sql/ha_ndbcluster_binlog.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; sql/item_cmpfunc.cc: missed ; sql/lock.cc: missed DBUG_RETURN sql/log_event.cc: missed ; sql/mysqld.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; DBUG_SET_INITIAL sql/opt_range.cc: remove _db_on_ and DEBUGGER_ON/OFF sql/set_var.cc: class sys_var_thd_dbug and "debug" server variable sql/set_var.h: class sys_var_thd_dbug and "debug" server variable sql/slave.cc: missed ; sql/sql_cache.cc: missed ; sql/sql_plugin.cc: missed ; sql/sql_select.cc: remove _db_on_ and DEBUGGER_ON/OFF storage/heap/hp_test2.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/ft_eval.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/ft_test1.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_open.c: remove _db_on_ and DEBUGGER_ON/OFF missed ; storage/myisam/mi_test1.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_test2.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_test3.c: remove _db_on_ and DEBUGGER_ON/OFF storage/ndb/src/ndbapi/DictCache.cpp: missed ; storage/ndb/src/ndbapi/NdbTransaction.cpp: missed ; tests/mysql_client_test.c: remove _db_on_ and DEBUGGER_ON/OFF
2006-02-14 22:36:11 +01:00
static int
get_options(int *argc,char ***argv)
{
int ho_error;
char *tmp_string;
MY_STAT sbuf; /* Stat information for the data file */
DBUG_ENTER("get_options");
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
Fixes Bug#30127: --debug-info no longer prints memory usage in mysql Fixed compiler warnings, errors and link errors Fixed new bug on Solaris with gethrtime() Added --debug-check option to all mysql clients to print errors and memory leaks Added --debug-info to all clients. This now works as --debug-check but also prints memory and cpu usage BUILD/compile-solaris-sparc-debug: Remove old cpu options client/client_priv.h: Added OPT_DBUG_CHECK client/mysql.cc: --debug-info now prints memory usage Added --debug-check client/mysql_upgrade.c: --debug-info now prints memory usage Added --debug-check client/mysqladmin.cc: --debug-info now prints memory usage Added --debug-check client/mysqlbinlog.cc: --debug-info now prints memory usage Added --debug-check client/mysqlcheck.c: --debug-info now prints memory usage Added --debug-check client/mysqldump.c: --debug-info now prints memory usage Added --debug-check client/mysqlimport.c: --debug-info now prints memory usage Added --debug-check client/mysqlshow.c: --debug-info now prints memory usage Added --debug-check client/mysqlslap.c: --debug-info now prints memory usage Added --debug-check client/mysqltest.c: --debug-info now prints memory usage Added --debug-check include/my_sys.h: Added extra option to TERMINATE to not print statistics libmysql/libmysql.c: Fixed compiler warning mysql-test/mysql-test-run.pl: --debug-info -> --debug-check to not print memory usage mysys/my_getsystime.c: Moved fast time calculation to my_micro_time_and_time() Fixed bug in previous push related to HAVE_GETHRTIME mysys/my_init.c: Print not freed memory in my_end() if MY_CHECK_ERROR is given mysys/my_static.c: Cleanup mysys/safemalloc.c: Added extra option to TERMINATE to not print statistics sql/item_xmlfunc.cc: Fixed compiler warning sql/sql_test.cc: Fixed TERMINATE() call unittest/mysys/base64-t.c: Fixed link error unittest/mysys/bitmap-t.c: Fixed link error unittest/mysys/my_atomic-t.c: Fixed link error
2007-08-01 21:59:05 +02:00
if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag)
my_end_arg= MY_CHECK_ERROR;
if (!user)
user= (char *)"root";
/*
If something is created and --no-drop is not specified, we drop the
schema.
*/
if (!opt_no_drop && (create_string || auto_generate_sql))
opt_preserve= FALSE;
if (auto_generate_sql && (create_string || user_supplied_query))
{
fprintf(stderr,
"%s: Can't use --auto-generate-sql when create and query strings are specified!\n",
my_progname);
exit(1);
}
if (auto_generate_sql && auto_generate_sql_guid_primary &&
auto_generate_sql_autoincrement)
{
fprintf(stderr,
"%s: Either auto-generate-sql-guid-primary or auto-generate-sql-add-autoincrement can be used!\n",
my_progname);
exit(1);
}
/*
We are testing to make sure that if someone specified a key search
that we actually added a key!
*/
if (auto_generate_sql && auto_generate_sql_type[0] == 'k')
if ( auto_generate_sql_autoincrement == FALSE &&
auto_generate_sql_guid_primary == FALSE)
{
fprintf(stderr,
"%s: Can't perform key test without a primary key!\n",
my_progname);
exit(1);
}
if (auto_generate_sql && num_of_query && auto_actual_queries)
{
fprintf(stderr,
"%s: Either auto-generate-sql-execute-number or number-of-queries can be used!\n",
my_progname);
exit(1);
}
parse_comma(concurrency_str ? concurrency_str : "1", &concurrency);
if (opt_csv_str)
{
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
opt_silent= TRUE;
if (opt_csv_str[0] == '-')
{
This is the downport of Bug#24509 - 2048 file descriptor limit on windows needs increasing, also WL#3049 - improved Windows I/O The patch replaces the use of the POSIX I/O interfaces in mysys on Windows with the Win32 API calls (CreateFile, WriteFile, etc). The Windows HANDLE for the open file is stored in the my_file_info struct, along with a flag for append mode because the Windows API does not support opening files in append mode in all cases) The default max open files has been increased to 16384 and can be increased further by setting --max-open-files=<value> during the server start. Another major change in this patch that almost all Windows specific file IO code has been moved to a new file my_winfile.c, greatly reducing the amount of code in #ifdef blocks within mysys, thus improving readability. Minor enhancements: - my_(f)stat() is changed to use __stati64 structure with 64 file size and timestamps. It will return correct file size now (C runtime implementation used to report outdated information) - my_lock on Windows is prepared to handle additional timeout parameter - after review : changed __WIN__ to _WIN32 in the new and changed code. client/mysqlbinlog.cc: fileno -> my_fileno client/readline.cc: fileno -> my_fileno include/config-win.h: Increase OS_FILE_LIMIT for Windows. Remove O_SHARE - Windows does not support it. Its definition conflicts with O_SHORT_LIVED, that has different semantics. include/my_dir.h: Use stat64 for stat() family of functions on Windows, because of 64 bit file size. include/my_global.h: Increased default value for open file limit to 16K include/my_sys.h: - my_file_info got new structure members - file handle and open flags - 2 new Windows-only mysys functions : my_get_osfhandle and my_osmaperr, modelled after Windows C runtime functions _get_osfhandle and _dosmaperr libmysql/CMakeLists.txt: new files my_winfile.c and my_winerr.c mysql-test/suite/large_tests/r/lock_tables_big.result: test for more then 2048 open file descriptors on Windows mysql-test/suite/large_tests/t/lock_tables_big.test: test for more then 2048 open file descriptors on Windows mysys/CMakeLists.txt: new files my_winfile.c and my_winerr.c mysys/Makefile.am: new files my_winfile.c and my_winerr.c mysys/default_modify.c: fileno -> my_fileno mysys/my_chsize.c: implementation of chsize on Windows now moved to my_winfile.c mysys/my_create.c: - my_sopen->my_win_open - close open file before removing (won't generally work on Windows otherwise) mysys/my_file.c: On Windows, files returned by my_open will not start with 0, but 2048 (making it simple to detect incompatible mix of CRT and mysys io functions) mysys/my_fopen.c: fileno->my_win_fileno , fclose->my_win_fclose, fdopen->my_win_fdopen Check for legal filename is done by my_win_[f]open functions mysys/my_fstream.c: fileno->my_fileno mysys/my_lib.c: Windows stat() functions are moved to my_winfile.c mysys/my_lock.c: Move Windows code under #ifdef to a separate function win_lock(). Add a parameter for lock wait timeout mysys/my_mmap.c: _get_osfhandle->my_get_osfhandle mysys/my_open.c: my_sopen->my_win_open (simpler interface) mysys/my_pread.c: moved most windows specific code to my_win_file.c Use my_win_pread mysys/my_quick.c: Use my_win_read/my_win_write mysys/my_read.c: Moved most of windows specific code to my_win_file.c Use my_win_read() mysys/my_seek.c: On Windows, use my_win_lseek() in my_seek()/my_tell() Removed dead code (synchronization of lseeks) Improved DBUG tracing (file position is ulonglong, not ulong) mysys/my_static.c: Removed array initialization. my_file_info_default is global variable thus it is initialized with all zeros anyway mysys/my_sync.c: _commit->my_win_fsync mysys/my_winerr.c: New file my_winerr.c Exports my_osmaperr modelled after undocumented C runtime function _dosmaperr(). The problem with _dosmaperr() used previously is that 1) it is nowhere documented and thus code relying on it is not guaranteed to work in subsequent releases on the C runtime 2) it is present only in static C runtime (mysqld does not link if compiled with /MD) mysys/my_winfile.c: New file my_winfile.c Implements ANSI/Posix file IO routines, when possible using native Windows IO, without C runtime (C runtime dropped because of the 2048 file descriptor limit). mysys/my_write.c: write->my_win_write mysys/mysys_priv.h: Declaration of Windows Posix functions (private to mysys, shall not be visible outside) storage/innobase/handler/ha_innodb.cc: mysys native Windows IO : correct innodb tmp file handling mysql_tmpfile does not return valid CRT file descriptor, thus it is not possible to dup() it. Instead, the native file handle has to be duplicated and then converted to CRT descriptor. storage/myisam/mi_locking.c: _commit->my_sync
2009-09-11 22:26:35 +02:00
csv_file= my_fileno(stdout);
}
else
{
if ((csv_file= my_open(opt_csv_str, O_CREAT|O_WRONLY|O_APPEND, MYF(0)))
== -1)
{
fprintf(stderr,"%s: Could not open csv file: %sn\n",
my_progname, opt_csv_str);
exit(1);
}
}
}
if (opt_only_print)
opt_silent= TRUE;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
if (num_int_cols_opt)
{
option_string *str;
if(parse_option(num_int_cols_opt, &str, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option "
"'number-int-cols'\n");
option_cleanup(str);
return 1;
}
num_int_cols= atoi(str->string);
if (str->option)
num_int_cols_index= atoi(str->option);
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
option_cleanup(str);
}
if (num_char_cols_opt)
{
option_string *str;
if(parse_option(num_char_cols_opt, &str, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option "
"'number-char-cols'\n");
option_cleanup(str);
return 1;
}
num_char_cols= atoi(str->string);
if (str->option)
num_char_cols_index= atoi(str->option);
else
num_char_cols_index= 0;
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
option_cleanup(str);
}
if (auto_generate_sql)
{
unsigned long long x= 0;
statement *ptr_statement;
if (verbose >= 2)
printf("Building Create Statements for Auto\n");
create_statements= build_table_string();
/*
Pre-populate table
*/
for (ptr_statement= create_statements, x= 0;
x < auto_generate_sql_unique_write_number;
x++, ptr_statement= ptr_statement->next)
{
ptr_statement->next= build_insert_string();
}
if (verbose >= 2)
printf("Building Query Statements for Auto\n");
if (auto_generate_sql_type[0] == 'r')
{
if (verbose >= 2)
printf("Generating SELECT Statements for Auto\n");
query_statements= build_select_string(FALSE);
for (ptr_statement= query_statements, x= 0;
x < auto_generate_sql_unique_query_number;
x++, ptr_statement= ptr_statement->next)
{
ptr_statement->next= build_select_string(FALSE);
}
}
else if (auto_generate_sql_type[0] == 'k')
{
if (verbose >= 2)
printf("Generating SELECT for keys Statements for Auto\n");
query_statements= build_select_string(TRUE);
for (ptr_statement= query_statements, x= 0;
x < auto_generate_sql_unique_query_number;
x++, ptr_statement= ptr_statement->next)
{
ptr_statement->next= build_select_string(TRUE);
}
}
else if (auto_generate_sql_type[0] == 'w')
{
/*
We generate a number of strings in case the engine is
Archive (since strings which were identical one after another
would be too easily optimized).
*/
if (verbose >= 2)
printf("Generating INSERT Statements for Auto\n");
query_statements= build_insert_string();
for (ptr_statement= query_statements, x= 0;
x < auto_generate_sql_unique_query_number;
x++, ptr_statement= ptr_statement->next)
{
ptr_statement->next= build_insert_string();
}
}
else if (auto_generate_sql_type[0] == 'u')
{
query_statements= build_update_string();
for (ptr_statement= query_statements, x= 0;
x < auto_generate_sql_unique_query_number;
x++, ptr_statement= ptr_statement->next)
{
ptr_statement->next= build_update_string();
}
}
else /* Mixed mode is default */
{
int coin= 0;
query_statements= build_insert_string();
/*
This logic should be extended to do a more mixed load,
at the moment it results in "every other".
*/
for (ptr_statement= query_statements, x= 0;
x < auto_generate_sql_unique_query_number;
x++, ptr_statement= ptr_statement->next)
{
if (coin)
{
ptr_statement->next= build_insert_string();
coin= 0;
}
else
{
ptr_statement->next= build_select_string(TRUE);
coin= 1;
}
}
}
}
else
{
if (create_string && my_stat(create_string, &sbuf, MYF(0)))
{
File data_file;
if (!MY_S_ISREG(sbuf.st_mode))
{
fprintf(stderr,"%s: Create file was not a regular file\n",
my_progname);
exit(1);
}
if ((data_file= my_open(create_string, O_RDWR, MYF(0))) == -1)
{
fprintf(stderr,"%s: Could not open create file\n", my_progname);
exit(1);
}
2011-06-13 02:38:16 +02:00
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
2011-06-13 02:38:16 +02:00
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
parse_delimiter(tmp_string, &create_statements, delimiter[0]);
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(tmp_string);
}
else if (create_string)
{
parse_delimiter(create_string, &create_statements, delimiter[0]);
}
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
if (user_supplied_query && my_stat(user_supplied_query, &sbuf, MYF(0)))
{
File data_file;
if (!MY_S_ISREG(sbuf.st_mode))
{
fprintf(stderr,"%s: User query supplied file was not a regular file\n",
my_progname);
exit(1);
}
if ((data_file= my_open(user_supplied_query, O_RDWR, MYF(0))) == -1)
{
fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
exit(1);
}
2011-06-13 02:38:16 +02:00
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
2011-06-13 02:38:16 +02:00
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
if (user_supplied_query)
actual_queries= parse_delimiter(tmp_string, &query_statements,
delimiter[0]);
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(tmp_string);
}
else if (user_supplied_query)
{
actual_queries= parse_delimiter(user_supplied_query, &query_statements,
delimiter[0]);
}
}
if (user_supplied_pre_statements && my_stat(user_supplied_pre_statements, &sbuf, MYF(0)))
{
File data_file;
if (!MY_S_ISREG(sbuf.st_mode))
{
fprintf(stderr,"%s: User query supplied file was not a regular file\n",
my_progname);
exit(1);
}
if ((data_file= my_open(user_supplied_pre_statements, O_RDWR, MYF(0))) == -1)
{
fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
exit(1);
}
2011-06-13 02:38:16 +02:00
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
2011-06-13 02:38:16 +02:00
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
if (user_supplied_pre_statements)
(void)parse_delimiter(tmp_string, &pre_statements,
delimiter[0]);
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(tmp_string);
}
else if (user_supplied_pre_statements)
{
(void)parse_delimiter(user_supplied_pre_statements,
&pre_statements,
delimiter[0]);
}
if (user_supplied_post_statements && my_stat(user_supplied_post_statements, &sbuf, MYF(0)))
{
File data_file;
if (!MY_S_ISREG(sbuf.st_mode))
{
fprintf(stderr,"%s: User query supplied file was not a regular file\n",
my_progname);
exit(1);
}
if ((data_file= my_open(user_supplied_post_statements, O_RDWR, MYF(0))) == -1)
{
fprintf(stderr,"%s: Could not open query supplied file\n", my_progname);
exit(1);
}
2011-06-13 02:38:16 +02:00
tmp_string= (char *)my_malloc((size_t)sbuf.st_size + 1,
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
2011-06-13 02:38:16 +02:00
my_read(data_file, (uchar*) tmp_string, (size_t)sbuf.st_size, MYF(0));
tmp_string[sbuf.st_size]= '\0';
my_close(data_file,MYF(0));
if (user_supplied_post_statements)
(void)parse_delimiter(tmp_string, &post_statements,
delimiter[0]);
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(tmp_string);
}
else if (user_supplied_post_statements)
{
(void)parse_delimiter(user_supplied_post_statements, &post_statements,
delimiter[0]);
}
if (verbose >= 2)
printf("Parsing engines to use.\n");
if (default_engine)
{
if(parse_option(default_engine, &engine_options, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option 'engine'\n");
return 1;
}
}
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
if (tty_password)
opt_password= get_tty_password(NullS);
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
DBUG_RETURN(0);
}
static int run_query(MYSQL *mysql, const char *query, size_t len)
{
if (opt_only_print)
{
printf("%.*s;\n", (int)len, query);
return 0;
}
if (verbose >= 3)
printf("%.*s;\n", (int)len, query);
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
return mysql_real_query(mysql, query, (ulong)len);
}
static int
generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt)
{
MYSQL_RES *result;
MYSQL_ROW row;
unsigned long long counter;
DBUG_ENTER("generate_primary_key_list");
/*
Blackhole is a special case, this allows us to test the upper end
of the server during load runs.
*/
if (opt_only_print || (engine_stmt &&
strstr(engine_stmt->string, "blackhole")))
{
primary_keys_number_of= 1;
primary_keys= (char **)my_malloc((uint)(sizeof(char *) *
primary_keys_number_of),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
/* Yes, we strdup a const string to simplify the interface */
primary_keys[0]= my_strdup("796c4422-1d94-102a-9d6d-00e0812d", MYF(0));
}
else
{
if (run_query(mysql, "SELECT id from t1", strlen("SELECT id from t1")))
{
fprintf(stderr,"%s: Cannot select GUID primary keys. (%s)\n", my_progname,
mysql_error(mysql));
exit(1);
}
if (!(result= mysql_store_result(mysql)))
{
fprintf(stderr, "%s: Error when storing result: %d %s\n",
my_progname, mysql_errno(mysql), mysql_error(mysql));
exit(1);
}
primary_keys_number_of= mysql_num_rows(result);
/* So why check this? Blackhole :) */
if (primary_keys_number_of)
{
/*
We create the structure and loop and create the items.
*/
primary_keys= (char **)my_malloc((uint)(sizeof(char *) *
primary_keys_number_of),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
row= mysql_fetch_row(result);
for (counter= 0; counter < primary_keys_number_of;
counter++, row= mysql_fetch_row(result))
primary_keys[counter]= my_strdup(row[0], MYF(0));
}
mysql_free_result(result);
}
DBUG_RETURN(0);
}
static int
drop_primary_key_list(void)
{
unsigned long long counter;
if (primary_keys_number_of)
{
for (counter= 0; counter < primary_keys_number_of; counter++)
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(primary_keys[counter]);
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(primary_keys);
}
return 0;
}
static int
create_schema(MYSQL *mysql, const char *db, statement *stmt,
option_string *engine_stmt)
{
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
char query[HUGE_STRING_LENGTH];
statement *ptr;
statement *after_create;
int len;
ulonglong count;
DBUG_ENTER("create_schema");
len= snprintf(query, HUGE_STRING_LENGTH, "CREATE SCHEMA `%s`", db);
if (verbose >= 2)
printf("Loading Pre-data\n");
if (run_query(mysql, query, len))
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
fprintf(stderr,"%s: Cannot create schema %s : %s\n", my_progname, db,
mysql_error(mysql));
exit(1);
}
if (opt_only_print)
{
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
printf("use %s;\n", db);
}
else
{
if (verbose >= 3)
printf("%s;\n", query);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
if (mysql_select_db(mysql, db))
{
fprintf(stderr,"%s: Cannot select schema '%s': %s\n",my_progname, db,
mysql_error(mysql));
exit(1);
}
}
count= 0;
after_create= stmt;
limit_not_met:
for (ptr= after_create; ptr && ptr->length; ptr= ptr->next, count++)
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
if (auto_generate_sql && ( auto_generate_sql_number == count))
break;
if (engine_stmt && engine_stmt->option && ptr->type == CREATE_TABLE_TYPE)
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
char buffer[HUGE_STRING_LENGTH];
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
snprintf(buffer, HUGE_STRING_LENGTH, "%s Engine = %s %s",
ptr->string, engine_stmt->string, engine_stmt->option);
if (run_query(mysql, buffer, strlen(buffer)))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
exit(1);
}
}
else if (engine_stmt && engine_stmt->string && ptr->type == CREATE_TABLE_TYPE)
{
char buffer[HUGE_STRING_LENGTH];
snprintf(buffer, HUGE_STRING_LENGTH, "%s Engine = %s",
ptr->string, engine_stmt->string);
if (run_query(mysql, buffer, strlen(buffer)))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
exit(1);
}
}
else
{
if (run_query(mysql, ptr->string, ptr->length))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
exit(1);
}
}
}
if (auto_generate_sql && (auto_generate_sql_number > count ))
{
/* Special case for auto create, we don't want to create tables twice */
after_create= stmt->next;
goto limit_not_met;
}
DBUG_RETURN(0);
}
static int
drop_schema(MYSQL *mysql, const char *db)
{
char query[HUGE_STRING_LENGTH];
int len;
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
DBUG_ENTER("drop_schema");
len= snprintf(query, HUGE_STRING_LENGTH, "DROP SCHEMA IF EXISTS `%s`", db);
if (run_query(mysql, query, len))
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
fprintf(stderr,"%s: Cannot drop database '%s' ERROR : %s\n",
my_progname, db, mysql_error(mysql));
exit(1);
}
DBUG_RETURN(0);
}
static int
run_statements(MYSQL *mysql, statement *stmt)
{
statement *ptr;
MYSQL_RES *result;
DBUG_ENTER("run_statements");
for (ptr= stmt; ptr && ptr->length; ptr= ptr->next)
{
if (run_query(mysql, ptr->string, ptr->length))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
exit(1);
}
if (mysql_field_count(mysql))
{
result= mysql_store_result(mysql);
mysql_free_result(result);
}
}
DBUG_RETURN(0);
}
static int
run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
{
uint x;
struct timeval start_time, end_time;
thread_context con;
pthread_t mainthread; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
DBUG_ENTER("run_scheduler");
con.stmt= stmts;
con.limit= limit;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr,
PTHREAD_CREATE_DETACHED);
pthread_mutex_lock(&counter_mutex);
thread_counter= 0;
pthread_mutex_lock(&sleeper_mutex);
master_wakeup= 1;
pthread_mutex_unlock(&sleeper_mutex);
for (x= 0; x < concur; x++)
{
/* now you create the thread */
if (pthread_create(&mainthread, &attr, run_task,
(void *)&con) != 0)
{
fprintf(stderr,"%s: Could not create thread\n",
my_progname);
exit(0);
}
thread_counter++;
}
pthread_mutex_unlock(&counter_mutex);
pthread_attr_destroy(&attr);
pthread_mutex_lock(&sleeper_mutex);
master_wakeup= 0;
pthread_cond_broadcast(&sleep_threshhold);
pthread_mutex_unlock(&sleeper_mutex);
gettimeofday(&start_time, NULL);
/*
We loop until we know that all children have cleaned up.
*/
pthread_mutex_lock(&counter_mutex);
while (thread_counter)
{
struct timespec abstime;
set_timespec(abstime, 3);
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
}
pthread_mutex_unlock(&counter_mutex);
gettimeofday(&end_time, NULL);
sptr->timing= timedif(end_time, start_time);
sptr->users= concur;
sptr->rows= limit;
DBUG_RETURN(0);
}
pthread_handler_t run_task(void *p)
{
ulonglong counter= 0, queries;
ulonglong detach_counter;
unsigned int commit_counter;
MYSQL *mysql;
MYSQL_RES *result;
MYSQL_ROW row;
statement *ptr;
thread_context *con= (thread_context *)p;
DBUG_ENTER("run_task");
2006-04-11 23:24:06 +02:00
DBUG_PRINT("info", ("task script \"%s\"", con->stmt ? con->stmt->string : ""));
pthread_mutex_lock(&sleeper_mutex);
while (master_wakeup)
{
pthread_cond_wait(&sleep_threshhold, &sleeper_mutex);
}
pthread_mutex_unlock(&sleeper_mutex);
if (mysql_thread_init())
{
fprintf(stderr,"%s: mysql_thread_init() failed\n", my_progname);
exit(0);
}
if (!(mysql= mysql_init(NULL)))
{
fprintf(stderr,"%s: mysql_init() failed\n", my_progname);
mysql_thread_end();
exit(0);
}
set_mysql_connect_options(mysql);
DBUG_PRINT("info", ("trying to connect to host %s as user %s", host, user));
if (!opt_only_print)
{
if (slap_connect(mysql))
goto end;
}
DBUG_PRINT("info", ("connected."));
if (verbose >= 3)
printf("connected!\n");
queries= 0;
commit_counter= 0;
if (commit_rate)
run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
limit_not_met:
for (ptr= con->stmt, detach_counter= 0;
ptr && ptr->length;
ptr= ptr->next, detach_counter++)
{
if (!opt_only_print && detach_rate && !(detach_counter % detach_rate))
{
mysql_close(mysql);
if (!(mysql= mysql_init(NULL)))
{
fprintf(stderr,"%s: mysql_init() failed ERROR : %s\n",
my_progname, mysql_error(mysql));
exit(0);
}
if (slap_connect(mysql))
goto end;
}
/*
We have to execute differently based on query type. This should become a function.
*/
if ((ptr->type == UPDATE_TYPE_REQUIRES_PREFIX) ||
(ptr->type == SELECT_TYPE_REQUIRES_PREFIX))
{
int length;
unsigned int key_val;
char *key;
char buffer[HUGE_STRING_LENGTH];
/*
This should only happen if some sort of new engine was
implemented that didn't properly handle UPDATEs.
Just in case someone runs this under an experimental engine we don't
want a crash so the if() is placed here.
*/
DBUG_ASSERT(primary_keys_number_of);
if (primary_keys_number_of)
{
key_val= (unsigned int)(random() % primary_keys_number_of);
key= primary_keys[key_val];
DBUG_ASSERT(key);
length= snprintf(buffer, HUGE_STRING_LENGTH, "%.*s '%s'",
(int)ptr->length, ptr->string, key);
if (run_query(mysql, buffer, length))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)length, buffer, mysql_error(mysql));
exit(0);
}
}
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
}
else
{
if (run_query(mysql, ptr->string, ptr->length))
{
fprintf(stderr,"%s: Cannot run query %.*s ERROR : %s\n",
my_progname, (uint)ptr->length, ptr->string, mysql_error(mysql));
exit(0);
}
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
}
do
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
if (mysql_field_count(mysql))
{
if (!(result= mysql_store_result(mysql)))
fprintf(stderr, "%s: Error when storing result: %d %s\n",
my_progname, mysql_errno(mysql), mysql_error(mysql));
else
{
while ((row= mysql_fetch_row(result)))
counter++;
mysql_free_result(result);
}
}
} while(mysql_next_result(mysql) == 0);
queries++;
if (commit_rate && (++commit_counter == commit_rate))
{
commit_counter= 0;
run_query(mysql, "COMMIT", strlen("COMMIT"));
}
if (con->limit && queries == con->limit)
goto end;
}
if (con->limit && queries < con->limit)
goto limit_not_met;
end:
if (commit_rate)
run_query(mysql, "COMMIT", strlen("COMMIT"));
mysql_close(mysql);
Fix bug#46980 Option "--without-server" still not working in 5.1 The general approach is to make sure that source files which require thread support are only compiled if the build really needs thread support, which means when the server is built or a thread-safe client library. This required several changes: - Make sure the subdirectories "storage/" and "plugin/" are only processed if the server is built, not ifclient-only. - Make the compilation of some modules which inherently require threading depend on thread supportin the build. - Separate the handling of threading in "configure.in" from that of server issues, threading is also needed in a non-server build of a thread-safe client library. Also, "libdbug" must get built even in a client-only build, so "dbug/" must be in the list of client directories. In addition, calls to thread functions in source files which can be built without thread support must use the wrapper functions which handle the non-threaded build. So the modules "client/mysqlimport.c" and "client/mysqlslap.c" must call "my_thread_end()" only via "mysql_thread_end()". Makefile.am: The directories "storage/" and "plugin/" contain files which are needed for the server only, so their contents is to be built only if a server is built. They must not be named unconditionally, because building their contents will fail unless threads are enabled. These directories are now listed in the "configure" variable "sql_server_dirs" which becomes part of "sql_union_dirs" if the server is to be built. client/mysqlimport.c: Use the wrapper function "mysql_thread_end()" which correctly handles the case of a non-threaded build. client/mysqlslap.c: Use the wrapper function "mysql_thread_end()" which correctly handles the case of a non-threaded build. configure.in: Various changes to support builds "--without-server": 1) For the unit tests, we need "libdbug". 2) Separate the treatment of the server from that of the thread-safe client library. 3) Introduce an "automake conditional" "NEED_THREAD" which can be checked in some "Makefile.am". 4) Include "storage/" and "plugin/" in the list of "sql_server_dirs" so that they are handled in the top "Makefile.am" only if the server is to be built (see the change in that file). mysys/Makefile.am: The code of "mf_keycache.c" in 5.1 is no longer safe to be built without thread support. (In 5.0, this was possible.) Rather than fix these issues, which is tedious and risky, avoid the need to ever build it without thread support: It is needed in the server only, which needs thread support. The only case where we build a "libmysys" without thread support is for a non-threaded client, where "mf_keycache" is not neded. So its inclusion in the list of source files can depend on the new conditional "NEED_THREAD". unittest/mysys/Makefile.am: Test program "my_atomic-t" is to verify the correct handling of threads only, it cannot be built without thread support and is not needed in such cases either. Let its build depend on the new conditional "NEED_THREAD".
2009-09-17 18:34:24 +02:00
mysql_thread_end();
pthread_mutex_lock(&counter_mutex);
thread_counter--;
pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex);
DBUG_RETURN(0);
}
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
int
parse_option(const char *origin, option_string **stmt, char delm)
{
char *retstr;
char *ptr= (char *)origin;
option_string **sptr= stmt;
option_string *tmp;
size_t length= strlen(origin);
uint count= 0; /* We know that there is always one */
for (tmp= *sptr= (option_string *)my_malloc(sizeof(option_string),
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
(retstr= strchr(ptr, delm));
tmp->next= (option_string *)my_malloc(sizeof(option_string),
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
MYF(MY_ZEROFILL|MY_FAE|MY_WME)),
tmp= tmp->next)
{
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
/*
Initialize buffer, because otherwise an
--engine=<storage_engine>:<option>,<eng1>,<eng2>
will crash.
*/
char buffer[HUGE_STRING_LENGTH]= "";
char *buffer_ptr;
/*
Return an error if the length of the any of the comma seprated value
exceeds HUGE_STRING_LENGTH.
*/
if ((size_t)(retstr - ptr) > HUGE_STRING_LENGTH)
return -1;
count++;
strncpy(buffer, ptr, (size_t)(retstr - ptr));
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
/*
Handle --engine=memory:max_row=200 cases, or more general speaking
--engine=<storage_engine>:<options>, which will be translated to
Engine = storage_engine option.
*/
if ((buffer_ptr= strchr(buffer, ':')))
{
char *option_ptr;
tmp->length= (size_t)(buffer_ptr - buffer);
tmp->string= my_strndup(ptr, (uint)tmp->length, MYF(MY_FAE));
option_ptr= ptr + 1 + tmp->length;
/* Move past the : and the first string */
tmp->option_length= (size_t)(retstr - option_ptr);
tmp->option= my_strndup(option_ptr, (uint)tmp->option_length,
MYF(MY_FAE));
}
else
{
tmp->string= my_strndup(ptr, (size_t)(retstr - ptr), MYF(MY_FAE));
tmp->length= (size_t)(retstr - ptr);
}
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
/* Skip delimiter delm */
ptr+= retstr - ptr + 1;
if (isspace(*ptr))
ptr++;
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
count++;
}
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
if (ptr != origin + length)
{
char *origin_ptr;
/*
Return an error if the length of the any of the comma seprated value
exceeds HUGE_STRING_LENGTH.
*/
if (strlen(ptr) > HUGE_STRING_LENGTH)
return -1;
if ((origin_ptr= strchr(ptr, ':')))
{
char *option_ptr;
tmp->length= (size_t)(origin_ptr - ptr);
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
option_ptr= (char *)ptr + 1 + tmp->length;
/* Move past the : and the first string */
tmp->option_length= strlen(option_ptr);
tmp->option= my_strndup(option_ptr, tmp->option_length,
MYF(MY_FAE));
}
else
{
tmp->length= strlen(ptr);
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
}
count++;
}
return count;
}
uint
parse_delimiter(const char *script, statement **stmt, char delm)
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
{
char *retstr;
char *ptr= (char *)script;
statement **sptr= stmt;
statement *tmp;
size_t length= strlen(script);
uint count= 0; /* We know that there is always one */
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
for (tmp= *sptr= (statement *)my_malloc(sizeof(statement),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
(retstr= strchr(ptr, delm));
tmp->next= (statement *)my_malloc(sizeof(statement),
MYF(MY_ZEROFILL|MY_FAE|MY_WME)),
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
tmp= tmp->next)
{
count++;
tmp->string= my_strndup(ptr, (uint)(retstr - ptr), MYF(MY_FAE));
tmp->length= (size_t)(retstr - ptr);
ptr+= retstr - ptr + 1;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
if (isspace(*ptr))
ptr++;
}
if (ptr != script+length)
{
tmp->string= my_strndup(ptr, (uint)((script + length) - ptr),
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
MYF(MY_FAE));
tmp->length= (size_t)((script + length) - ptr);
count++;
}
return count;
}
uint
parse_comma(const char *string, uint **range)
{
uint count= 1,x; /* We know that there is always one */
char *retstr;
char *ptr= (char *)string;
uint *nptr;
for (;*ptr; ptr++)
if (*ptr == ',') count++;
/* One extra spot for the NULL */
nptr= *range= (uint *)my_malloc(sizeof(uint) * (count + 1),
MYF(MY_ZEROFILL|MY_FAE|MY_WME));
ptr= (char *)string;
x= 0;
while ((retstr= strchr(ptr,',')))
{
nptr[x++]= atoi(ptr);
ptr+= retstr - ptr + 1;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
}
nptr[x++]= atoi(ptr);
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
return count;
See message in mysqlslap.c, but basically 1) Parsing now works 2) Options are safer, aka it doesn't kill the machine and it cleans up after itself 3) Option of --only-print added so that you can see what it does. 4) Tiny cleanup of the auto generate sql. A lot more needs to be done with this, for it to be very valuable. I suspect it doesn't work all that well. 5) Delimeter is now a single character. No good escaping going on. 6) You can now change which schema it is runninng against. Now I think I can go make use of it! Though I need to add support for a "only run this many inserts, divide by the number of clients connecting, to really test scaling" client/client_priv.h: Added new options for mysqlslap client/mysqlslap.c: Lots of cleanup. Highlights: 1) Parsing now works much better, though I suspect escaping issues still exist. All strings are parsed into a typedef called statement. This is a linked structure with each statement held in it. I added options for length so that when the time comes to fix this for binary data the guts of the main executing loop will not need to be changed 2) Cleaned up options so that it will not destroy data by default and will clean up itself by default. So no leaving around of gobs of data. 3) Added option of --only-print to see the SQL it would have executed 4) Parsing handles whitespace trick (which will come back to bite someone I expect) 5) Delimeter is now a single character 6) All memory allocated should now be freed. 7) Set defaults so that only a single run will occur if none are given. 8) You can now change the schema that it runs against. mysql-test/r/information_schema.result: Fix for Antony's merge mysql-test/r/mysqlslap.result: New result set More testing mysql-test/t/mysqlslap.test: More testing
2005-12-25 00:41:40 +01:00
}
void
print_conclusions(conclusions *con)
{
printf("Benchmark\n");
if (con->engine)
printf("\tRunning for engine %s\n", con->engine);
printf("\tAverage number of seconds to run all queries: %ld.%03ld seconds\n",
con->avg_timing / 1000, con->avg_timing % 1000);
printf("\tMinimum number of seconds to run all queries: %ld.%03ld seconds\n",
con->min_timing / 1000, con->min_timing % 1000);
printf("\tMaximum number of seconds to run all queries: %ld.%03ld seconds\n",
con->max_timing / 1000, con->max_timing % 1000);
printf("\tNumber of clients running queries: %d\n", con->users);
printf("\tAverage number of queries per client: %llu\n", con->avg_rows);
printf("\n");
}
void
print_conclusions_csv(conclusions *con)
{
char buffer[HUGE_STRING_LENGTH];
const char *ptr= auto_generate_sql_type ? auto_generate_sql_type : "query";
Fix for     mysqlslap: setting --engine does not get replicated     http://bugs.mysql.com/bug.php?id=46967 and     mysqlslap: specifying --engine and --create does not     work with --engine=<storage_engine>:<option>     https://bugs.launchpad.net/maria/+bug/429773 Problems were that an --engine=<storage_engine> was translated to a "set storage_engine = <storage_engine>", wich is _not_ replicated. A --engine=<storage_engine>:<option> was not always properly parsed and in some cases crashed. Fixed by eliminating "set storage_engine = ..." and adding proper DDL generation. Initialized an unitialized buffer to prevent crashes and fixed to use proper pointer for in case of --engine=<storage_engine>:<option> being the last element in list of --engines. Also cleaned up code for better readability. Q: Should MySQL's replication actually replicate a    "set storage_engine = ..." command or not? A: No it should not. It is documented here: http://dev.mysql.com/doc/refman/5.1/en/replication-features-variables.html  ...   "The storage_engine system variable is not replicated, which is a good thing for replication between different storage engines." ... Before the patch, mysqlslap was behaving this way: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | Before patch                                         | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |   Not OK    | | 1.2 | eng1,eng2               |  OK    |   Not OK    | | 1.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 1.4 | memory:option           |  OK    |   Not OK    | | 1.5 | memory:option,eng1      |  OK    |   Not OK    | | 1.6 | eng1,memory:option      | Not OK |   Not OK    | | 1.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 1.8 | eng1,memory:option,eng2 |  OK    |   Not OK    | | 1.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |   Not OK    | | 2.2 | eng1,eng2               |  OK    |   Not OK    | | 2.3 | eng1,eng2,eng3          |  OK    |   Not OK    | | 2.4 | memory:option           | Not OK |   Not OK    | | 2.5 | memory:option,eng1      | Not OK |   Not OK    | | 2.6 | eng1,memory:option      | Not OK |   Not OK    | | 2.7 | memory:option,eng1,eng2 | Crash  |   Not OK    | | 2.8 | eng1,memory:option,eng2 | Not OK |   Not OK    | | 2.9 | eng1,eng2,memory:option | Not OK |   Not OK    | +-----+-------------------------+--------+-------------+ After my final patch, mysqlslap now runs like this: +-------------------------------+--------+-------------+ |                               | single | replication | +-------------------------------+--------+-------------+ | After third patch                                    | +-------------------------------+--------+-------------+ | --engine[1]                                          | +-----+-------------------------+--------+-------------+ | 1.1 | eng1                    |  OK    |  OK         | | 1.2 | eng1,eng2               |  OK    |  OK         | | 1.3 | eng1,eng2,eng3          |  OK    |  OK         | | 1.4 | memory:option           |  OK    |  OK         | | 1.5 | memory:option,eng1      |  OK    |  OK         | | 1.6 | eng1,memory:option      |  OK    |  OK         | | 1.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 1.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 1.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+ +-------------------------------+--------+-------------+ | --create --engine[2]                                 | +-----+-------------------------+--------+-------------+ | 2.1 | eng1                    |  OK    |  OK         | | 2.2 | eng1,eng2               |  OK    |  OK         | | 2.3 | eng1,eng2,eng3          |  OK    |  OK         | | 2.4 | memory:option           |  OK    |  OK         | | 2.5 | memory:option,eng1      |  OK    |  OK         | | 2.6 | eng1,memory:option      |  OK    |  OK         | | 2.7 | memory:option,eng1,eng2 |  OK    |  OK         | | 2.8 | eng1,memory:option,eng2 |  OK    |  OK         | | 2.9 | eng1,eng2,memory:option |  OK    |  OK         | +-----+-------------------------+--------+-------------+
2009-09-18 05:30:54 +02:00
snprintf(buffer, HUGE_STRING_LENGTH,
"%s,%s,%ld.%03ld,%ld.%03ld,%ld.%03ld,%d,%llu\n",
con->engine ? con->engine : "", /* Storage engine we ran against */
ptr, /* Load type */
con->avg_timing / 1000, con->avg_timing % 1000, /* Time to load */
con->min_timing / 1000, con->min_timing % 1000, /* Min time */
con->max_timing / 1000, con->max_timing % 1000, /* Max time */
con->users, /* Children used */
con->avg_rows /* Queries run */
);
Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris Faster thr_alarm() Added 'Opened_files' status variable to track calls to my_open() Don't give warnings when running mysql_install_db Added option --source-install to mysql_install_db I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map() BUILD/compile-solaris-sparc-forte: Updated script to current Solaris installations Now we compile by default for 64 bits client/mysql.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) client/mysql_upgrade.c: Fixed compiler warning (on Forte) client/mysqladmin.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) client/mysqlcheck.c: Fixed compiler warning (on Forte) client/mysqldump.c: Fixed compiler warning (on Forte) client/mysqlslap.c: Fixed compiler warning (on Forte) client/mysqltest.c: Fixed compiler warning (on Forte) client/sql_string.cc: Avoid compiler warnings when using C function pointers in C++ configure.in: Added detection of mtmalloc and ieeefp.h extra/replace.c: Fixed compiler warning (on Forte) include/m_ctype.h: Added some typedef's to make it easy to use C function pointers in C++ include/my_sys.h: Added my_file_total_opened (counter for calls to my_open()) include/myisam.h: Fixed compiler warning (on Forte) libmysql/libmysql.c: Fixed compiler warning (on Forte) by adding casts and change types libmysql/manager.c: Fixed compiler warning (on Forte) by adding casts and change types mysql-test/r/ctype_cp932_binlog_stm.result: Updated positions (Needed because we didn't before correctly restore collation_database after running stored procedure mysys/my_fopen.c: Count number of opened files mysys/my_open.c: Count number of opened files mysys/my_static.c: Count number of opened files mysys/thr_alarm.c: Optimization to do less alarm() and pthread_sigmask() calls. Idea is to remember time for next pending alarm and not reschedule a new alarm if it's after the current one. Before we only did this if there was other pending alarms. We don't have to use pthread_sigmask() in case of 'USE_ONE_SIGNAL_HAND' as the alarm() signal will be blocked for the calling thread anyway and no other thread will have the alarm() signal enabled to call process_alarm() regex/regcomp.c: Fixed compiler warning (on Forte) by adding casts and change types scripts/mysql_install_db.sh: Added option --source-install to allow one to create a mysql database from the source tree without installing MySQL Don't give (unnecessary) warnings server-tools/instance-manager/angel.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) server-tools/instance-manager/thread_registry.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/event_db_repository.cc: index_read() -> index_read_map() sql/event_queue.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/field.cc: Fixed compiler warnings about hidden fields sql/ha_partition.cc: Fixed compiler warnings about hidden fields index_read() -> index_read_map() sql/ha_partition.h: index_read() -> index_read_map() sql/handler.cc: Added PAGE option to row types (to prepare for future) index_read() -> index_read_map() sql/handler.h: Added ROW_TYPE_PAGE (for future) Added flag to signal if table was to be created transactionally I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map() sql/item.cc: Fixed indentation Renamed local variable to avoid hiding class variable sql/item_cmpfunc.cc: Renamed local variable to avoid hiding class variable sql/item_cmpfunc.h: Removed not used variable sql/item_func.cc: Renamed local variable to avoid hiding class variable sql/item_strfunc.cc: Moved functions from Item_strfunc.cc sql/item_strfunc.h: Move functions to item_strfunc.cc Use C function pointer type to avoid compiler warnings (with Forte) sql/item_subselect.cc: index_read() -> index_read_map() sql/item_xmlfunc.cc: Renamed local variable to avoid hiding class variable Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/key.cc: Fixed indentation sql/log.cc: Renamed local variable to avoid hiding class variable sql/log_event.cc: Removed call to my_time() when creating class instance of Log_event() as this may have static instances. (One can't call my_time() before my_init()) index_read() -> index_read_map() Renamed local variable to avoid hiding class variable sql/log_event_old.cc: Renamed local variable to avoid hiding class variable sql/mysql_priv.h: Made all create_backup_ctx() declarations identical. This lifted up a bug where wrong create_backup_ctx() was called in some cases. Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/mysqld.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) Fixed indentation Don't call end_thr_alarm() when calling unireg_abort() as unireg_abort() already calls end_thr_alarm() Added variable 'Opened_files' (number of calls to my_open() or my_fopen()) Don't print 'loose' warnings when using --bootstrap (to avoid warnings when running mysql_install_db) Fixed compiler warnings sql/opt_range.cc: index_read() -> index_read_map() sql/opt_sum.cc: index_read() -> index_read_map() sql/partition_info.cc: Renamed local variable to avoid hiding class variable sql/rpl_filter.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/set_var.cc: Renamed local variable to avoid hiding class variable Added 'process_key_cache_t' type to avoid compiler warning (on Forte) sql/set_var.h: Added 'process_key_cache_t' type to avoid compiler warning (on Forte) sql/sp.cc: More debugging index_read() -> index_read_map() sql/sp_cache.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/sp_head.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) Moved 'saved_creation_ctx' higher up to be able to free objects allocated by create_backup_ctx() sql/sql_acl.cc: index_read() -> index_read_map() sql/sql_class.cc: Renamed local variable to avoid hiding class variable Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/sql_class.h: Renamed local variable to avoid hiding class variable sql/sql_db.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/sql_delete.cc: Renamed local variable to avoid hiding class variable sql/sql_handler.cc: index_read() -> index_read_map() sql/sql_help.cc: index_read() -> index_read_map() sql/sql_insert.cc: index_read() -> index_read_map() Renamed local variable to avoid hiding class variable sql/sql_lex.cc: Renamed local variable to avoid hiding class variable sql/sql_plugin.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) index_read() -> index_read_map() Don't give warnings about not used plugins if we are using --warnings=0 sql/sql_select.cc: index_read() -> index_read_map() sql-common/client.c: Fixed compiler warning (on Forte) sql-common/my_time.c: Removed never accessed code Fixed compiler warning (on Forte) sql/sql_servers.cc: index_read() -> index_read_map() sql/sql_show.cc: Added TRANSACTIONAL to SHOW CREATE Fixed ROW_TYPE_PAGE sql/sql_string.cc: Avoid compiler warnings when using C function pointers in C++ sql/sql_table.cc: Set create_info->transactional if we used TRANSACTIONAL=1 sql/sql_udf.cc: index_read() -> index_read_map() sql/sql_yacc.yy: Added TRANSACTIONAL=0|1 to CREATE (for future) Added row type PAGE (was only partionally handled before) sql/strfunc.cc: Avoid compiler warnings when using C function pointers in C++ sql/table.cc: More DBUG statements Declare all create_backup_ctx() functions identically Remember if table was created with TRANSACTIONAL flag or not (future safe) Renamed local variable to avoid hiding class variable sql/table.h: Remember if table was created with TRANSACTIONAL=1 sql/tztime.cc: index_read() -> index_read_map() sql-common/pack.c: Fixed compiler warning (on Forte) storage/archive/archive_reader.c: Fixed compiler warning (on Forte) storage/archive/azio.c: Fixed compiler warning (on Forte) storage/blackhole/ha_blackhole.cc: index_read() -> index_read_map() storage/blackhole/ha_blackhole.h: index_read() -> index_read_map() storage/csv/ha_tina.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) storage/example/ha_example.cc: index_read() -> index_read_map() storage/example/ha_example.h: index_read() -> index_read_map() storage/heap/ha_heap.cc: index_read() -> index_read_map() storage/heap/ha_heap.h: index_read() -> index_read_map() storage/heap/hp_test1.c: Fixed compiler warning (on Forte) storage/heap/hp_test2.c: Fixed compiler warning (on Forte) storage/myisam/ft_boolean_search.c: Fixed compiler warning (on Forte) storage/myisam/ft_nlq_search.c: Fixed compiler warning (on Forte) storage/myisam/ft_parser.c: Fixed compiler warning (on Forte) storage/myisam/ft_stopwords.c: Fixed compiler warning (on Forte) storage/myisam/ha_myisam.cc: index_read() -> index_read_map() storage/myisam/ha_myisam.h: index_read() -> index_read_map() storage/myisam/mi_check.c: Fixed compiler warning (on Forte) storage/myisam/mi_delete.c: Fixed compiler warning (on Forte) storage/myisam/mi_dynrec.c: Fixed compiler warning (on Forte) storage/myisam/mi_extra.c: Fixed compiler warning (on Forte) storage/myisam/mi_key.c: Fixed compiler warning (on Forte) storage/myisam/mi_keycache.c: Fixed compiler warning (on Forte) storage/myisam/mi_locking.c: Fixed compiler warning (on Forte) storage/myisam/mi_log.c: Fixed compiler warning (on Forte) storage/myisam/mi_open.c: Fixed compiler warning (on Forte) storage/myisam/mi_packrec.c: Fixed compiler warning (on Forte) storage/myisam/mi_page.c: Fixed compiler warning (on Forte) storage/myisam/mi_rkey.c: Added comment storage/myisam/mi_search.c: Fixed compiler warning (on Forte) storage/myisam/mi_statrec.c: Fixed compiler warning (on Forte) storage/myisam/mi_test1.c: Fixed compiler warning (on Forte) storage/myisam/mi_test2.c: Fixed compiler warning (on Forte) storage/myisam/mi_test3.c: Fixed compiler warning (on Forte) storage/myisam/mi_update.c: Fixed compiler warning (on Forte) storage/myisam/mi_write.c: Fixed compiler warning (on Forte) storage/myisam/myisamdef.h: Fixed that file_read/file_write returns type size_t Changed some functions to use uchar * as argument/return value instead of char* This fixed some compiler warnings on Forte storage/myisam/myisamlog.c: Fixed compiler warning (on Forte) storage/myisam/myisampack.c: Fixed compiler warning (on Forte) storage/myisam/rt_test.c: Fixed compiler warning (on Forte) storage/myisam/sort.c: Fixed compiler warning (on Forte) by adding casts or changing variables to uchar* storage/myisam/sp_test.c: Fixed compiler warning (on Forte) by adding casts or changing variables to uchar* storage/myisammrg/ha_myisammrg.cc: index_read() -> index_read_map() storage/myisammrg/ha_myisammrg.h: index_read() -> index_read_map() storage/myisammrg/myrg_create.c: Fixed compiler warning (on Forte) by adding casts or changing variable types storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp: Tdummy -> align (as in other part of cluster code) storage/ndb/src/kernel/vm/DynArr256.cpp: Removed not used variable storage/ndb/src/ndbapi/Ndb.cpp: Removed not used variable strings/strtod.c: Include ieeefp.h to avoid compiler warning tests/bug25714.c: Fixed compiler warning tests/mysql_client_test.c: Remove not used variable Fixed indentation Removed never reached code Fixed compiler warning (on Forte) by adding casts or changing variable types vio/viosocket.c: Fixed compiler warning (on Forte) by adding casts or changing variable types
2007-08-13 15:11:25 +02:00
my_write(csv_file, (uchar*) buffer, (uint)strlen(buffer), MYF(0));
}
void
generate_stats(conclusions *con, option_string *eng, stats *sptr)
{
stats *ptr;
unsigned int x;
con->min_timing= sptr->timing;
con->max_timing= sptr->timing;
con->min_rows= sptr->rows;
con->max_rows= sptr->rows;
/* At the moment we assume uniform */
con->users= sptr->users;
con->avg_rows= sptr->rows;
/* With no next, we know it is the last element that was malloced */
for (ptr= sptr, x= 0; x < iterations; ptr++, x++)
{
con->avg_timing+= ptr->timing;
if (ptr->timing > con->max_timing)
con->max_timing= ptr->timing;
if (ptr->timing < con->min_timing)
con->min_timing= ptr->timing;
}
con->avg_timing= con->avg_timing/iterations;
if (eng && eng->string)
con->engine= eng->string;
else
con->engine= NULL;
}
void
option_cleanup(option_string *stmt)
{
option_string *ptr, *nptr;
if (!stmt)
return;
for (ptr= stmt; ptr; ptr= nptr)
{
nptr= ptr->next;
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(ptr->string);
my_free(ptr->option);
my_free(ptr);
}
}
void
statement_cleanup(statement *stmt)
{
statement *ptr, *nptr;
if (!stmt)
return;
for (ptr= stmt; ptr; ptr= nptr)
{
nptr= ptr->next;
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled Essentially, the problem is that safemalloc is excruciatingly slow as it checks all allocated blocks for overrun at each memory management primitive, yielding a almost exponential slowdown for the memory management functions (malloc, realloc, free). The overrun check basically consists of verifying some bytes of a block for certain magic keys, which catches some simple forms of overrun. Another minor problem is violation of aliasing rules and that its own internal list of blocks is prone to corruption. Another issue with safemalloc is rather the maintenance cost as the tool has a significant impact on the server code. Given the magnitude of memory debuggers available nowadays, especially those that are provided with the platform malloc implementation, maintenance of a in-house and largely obsolete memory debugger becomes a burden that is not worth the effort due to its slowness and lack of support for detecting more common forms of heap corruption. Since there are third-party tools that can provide the same functionality at a lower or comparable performance cost, the solution is to simply remove safemalloc. Third-party tools can provide the same functionality at a lower or comparable performance cost. The removal of safemalloc also allows a simplification of the malloc wrappers, removing quite a bit of kludge: redefinition of my_malloc, my_free and the removal of the unused second argument of my_free. Since free() always check whether the supplied pointer is null, redudant checks are also removed. Also, this patch adds unit testing for my_malloc and moves my_realloc implementation into the same file as the other memory allocation primitives. client/mysqldump.c: Pass my_free directly as its signature is compatible with the callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
my_free(ptr->string);
my_free(ptr);
}
}
int
slap_connect(MYSQL *mysql)
{
/* Connect to server */
static ulong connection_retry_sleep= 100000; /* Microseconds */
int x, connect_error= 1;
for (x= 0; x < 10; x++)
{
Patch set contributed by Alex Budovski (MCA) Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters .bzrignore: Fixed .bzrignore rules. Many were simply not ignoring what they were meant to. client/mysqlslap.c: Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters The original patch could cause memory leaks and odd problems depending on how connection was made. This code ensures that all mysql_options() are set for each mysql_real_connect(). (This patch by Monty) mysys/my_thr_init.c: Fixed multiply-initialized critical section on Windows, due to code incorrectly checking the wrong field in an attempt to prevent multiple-initialization. sql-common/client.c: Don't use shared memory if it's not set (for example after failed mysql_real_connect). Ensure that mysql_close() resets all resources so that it's safe to call it twice. (Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters) sql/CMakeLists.txt: Added page fault counters for SHOW PROFILE on Windows. sql/mysqld.cc: Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used) sql/sql_profile.cc: Added page fault counters for SHOW PROFILE on Windows. sql/sql_profile.h: Added page fault counters for SHOW PROFILE on Windows. sql/udf_example.def: Some cleanup functions were not exported from udf_example.dll, causing them to never be executed, and as a result multiple-initialization of kernel objects occurred and resources were not being freed correctly. storage/maria/ma_close.c: Condition variable share->key_del_cond was never being destroyed, while its containing heap block was being freed in maria_close(), leaking kernel resources.
2010-01-29 19:42:22 +01:00
set_mysql_connect_options(mysql);
if (opt_init_command)
mysql_options(mysql, MYSQL_INIT_COMMAND, opt_init_command);
if (mysql_real_connect(mysql, host, user, opt_password,
create_schema_string,
opt_mysql_port,
opt_mysql_unix_port,
connect_flags))
{
/* Connect suceeded */
connect_error= 0;
break;
}
my_sleep(connection_retry_sleep);
}
if (connect_error)
{
fprintf(stderr,"%s: Error when connecting to server: %d %s\n",
my_progname, mysql_errno(mysql), mysql_error(mysql));
return 1;
}
return 0;
}