mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 23:34:34 +01:00
f252f9248a
The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c BitKeeper/etc/ignore: added libmysqld/ha_ndbcluster_cond.cc --- added debian/defs.mk debian/control client/completion_hash.cc: Remove not needed casts client/my_readline.h: Remove some old types client/mysql.cc: Simplify types client/mysql_upgrade.c: Remove some old types Update call to dirname_part client/mysqladmin.cc: Remove some old types client/mysqlbinlog.cc: Remove some old types Change some buffers to be uchar to avoid casts client/mysqlcheck.c: Remove some old types client/mysqldump.c: Remove some old types Remove some not needed casts Change some string lengths to size_t client/mysqlimport.c: Remove some old types client/mysqlshow.c: Remove some old types client/mysqlslap.c: Remove some old types Remove some not needed casts client/mysqltest.c: Removed some old types Removed some not needed casts Updated hash-get-key function arguments Updated parameters to dirname_part() client/readline.cc: Removed some old types Removed some not needed casts Changed some string lengths to use size_t client/sql_string.cc: Removed some old types dbug/dbug.c: Removed some old types Changed some string lengths to use size_t Changed some prototypes to avoid casts extra/comp_err.c: Removed some old types extra/innochecksum.c: Removed some old types extra/my_print_defaults.c: Removed some old types extra/mysql_waitpid.c: Removed some old types extra/perror.c: Removed some old types extra/replace.c: Removed some old types Updated parameters to dirname_part() extra/resolve_stack_dump.c: Removed some old types extra/resolveip.c: Removed some old types include/config-win.h: Removed some old types include/decimal.h: Changed binary strings to be uchar* instead of char* include/ft_global.h: Removed some old types include/hash.h: Removed some old types include/heap.h: Removed some old types Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable include/keycache.h: Removed some old types include/m_ctype.h: Removed some old types Changed some string lengths to use size_t Changed character length functions to return uint unsigned char -> uchar include/m_string.h: Removed some old types Changed some string lengths to use size_t include/my_alloc.h: Changed some string lengths to use size_t include/my_base.h: Removed some old types include/my_dbug.h: Removed some old types Changed some string lengths to use size_t Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage include/my_getopt.h: Removed some old types include/my_global.h: Removed old types: my_size_t -> size_t byte -> uchar gptr -> uchar * include/my_list.h: Removed some old types include/my_nosys.h: Removed some old types include/my_pthread.h: Removed some old types include/my_sys.h: Removed some old types Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read() Changed some string lengths to use size_t my_malloc() / my_free() now uses void * Updated parameters to dirname_part() & my_uncompress() include/my_tree.h: Removed some old types include/my_trie.h: Removed some old types include/my_user.h: Changed some string lengths to use size_t include/my_vle.h: Removed some old types include/my_xml.h: Removed some old types Changed some string lengths to use size_t include/myisam.h: Removed some old types include/myisammrg.h: Removed some old types include/mysql.h: Removed some old types Changed byte streams to use uchar* instead of char* include/mysql_com.h: Removed some old types Changed some string lengths to use size_t Changed some buffers to be uchar* to avoid casts include/queues.h: Removed some old types include/sql_common.h: Removed some old types include/sslopt-longopts.h: Removed some old types include/violite.h: Removed some old types Changed some string lengths to use size_t libmysql/client_settings.h: Removed some old types libmysql/libmysql.c: Removed some old types libmysql/manager.c: Removed some old types libmysqld/emb_qcache.cc: Removed some old types libmysqld/emb_qcache.h: Removed some old types libmysqld/lib_sql.cc: Removed some old types Removed some not needed casts Changed some buffers to be uchar* to avoid casts true -> TRUE, false -> FALSE mysys/array.c: Removed some old types mysys/charset.c: Changed some string lengths to use size_t mysys/checksum.c: Include zlib to get definition for crc32 Removed some old types mysys/default.c: Removed some old types Changed some string lengths to use size_t mysys/default_modify.c: Changed some string lengths to use size_t Removed some not needed casts mysys/hash.c: Removed some old types Changed some string lengths to use size_t Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function. hash_element now takes 'ulong' as the index type (cleanup) mysys/list.c: Removed some old types mysys/mf_cache.c: Changed some string lengths to use size_t mysys/mf_dirname.c: Removed some old types Changed some string lengths to use size_t Added argument to dirname_part() to avoid calculation of length for 'to' mysys/mf_fn_ext.c: Removed some old types Updated parameters to dirname_part() mysys/mf_format.c: Removed some old types Changed some string lengths to use size_t mysys/mf_getdate.c: Removed some old types mysys/mf_iocache.c: Removed some old types Changed some string lengths to use size_t Changed calculation of 'max_length' to be done the same way in all functions mysys/mf_iocache2.c: Removed some old types Changed some string lengths to use size_t Clean up comments Removed not needed indentation mysys/mf_keycache.c: Removed some old types mysys/mf_keycaches.c: Removed some old types mysys/mf_loadpath.c: Removed some old types mysys/mf_pack.c: Removed some old types Changed some string lengths to use size_t Removed some not needed casts Removed very old VMS code Updated parameters to dirname_part() Use result of dirnam_part() to remove call to strcat() mysys/mf_path.c: Removed some old types mysys/mf_radix.c: Removed some old types mysys/mf_same.c: Removed some old types mysys/mf_sort.c: Removed some old types mysys/mf_soundex.c: Removed some old types mysys/mf_strip.c: Removed some old types mysys/mf_tempdir.c: Removed some old types mysys/mf_unixpath.c: Removed some old types mysys/mf_wfile.c: Removed some old types mysys/mulalloc.c: Removed some old types mysys/my_alloc.c: Removed some old types Changed some string lengths to use size_t Use void* as type for allocated memory area Removed some not needed casts Changed argument 'Size' to 'length' according coding guidelines mysys/my_chsize.c: Changed some buffers to be uchar* to avoid casts mysys/my_compress.c: More comments Removed some old types Changed string lengths to use size_t Changed arguments to my_uncompress() to make them easier to understand Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) Changed type of 'pack_data' argument to packfrm() to avoid casts. mysys/my_conio.c: Changed some string lengths to use size_t mysys/my_create.c: Removed some old types mysys/my_div.c: Removed some old types mysys/my_error.c: Removed some old types mysys/my_fopen.c: Removed some old types mysys/my_fstream.c: Removed some old types Changed some string lengths to use size_t writen -> written mysys/my_getopt.c: Removed some old types mysys/my_getwd.c: Removed some old types More comments mysys/my_init.c: Removed some old types mysys/my_largepage.c: Removed some old types Changed some string lengths to use size_t mysys/my_lib.c: Removed some old types mysys/my_lockmem.c: Removed some old types mysys/my_malloc.c: Removed some old types Changed malloc(), free() and related functions to use void * Changed all functions to use size_t mysys/my_memmem.c: Indentation cleanup mysys/my_once.c: Removed some old types Changed malloc(), free() and related functions to use void * mysys/my_open.c: Removed some old types mysys/my_pread.c: Removed some old types Changed all functions to use size_t Added comment for how my_pread() / my_pwrite() are supposed to work. Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. (If we ever would really need this, it should be enabled only with a flag argument) mysys/my_quick.c: Removed some old types Changed all functions to use size_t mysys/my_read.c: Removed some old types Changed all functions to use size_t mysys/my_realloc.c: Removed some old types Use void* as type for allocated memory area Changed all functions to use size_t mysys/my_static.c: Removed some old types mysys/my_static.h: Removed some old types mysys/my_vle.c: Removed some old types mysys/my_wincond.c: Removed some old types mysys/my_windac.c: Removed some old types mysys/my_write.c: Removed some old types Changed all functions to use size_t mysys/ptr_cmp.c: Removed some old types Changed all functions to use size_t mysys/queues.c: Removed some old types mysys/safemalloc.c: Removed some old types Changed malloc(), free() and related functions to use void * Changed all functions to use size_t mysys/string.c: Removed some old types Changed all functions to use size_t mysys/testhash.c: Removed some old types mysys/thr_alarm.c: Removed some old types mysys/thr_lock.c: Removed some old types mysys/tree.c: Removed some old types mysys/trie.c: Removed some old types mysys/typelib.c: Removed some old types plugin/daemon_example/daemon_example.cc: Removed some old types regex/reginit.c: Removed some old types server-tools/instance-manager/buffer.cc: Changed some string lengths to use size_t Changed buffer to be of type uchar* server-tools/instance-manager/buffer.h: Changed some string lengths to use size_t Changed buffer to be of type uchar* server-tools/instance-manager/commands.cc: Removed some old types Changed some string lengths to use size_t Changed buffer to be of type uchar* server-tools/instance-manager/instance_map.cc: Removed some old types Changed some string lengths to use size_t Changed buffer to be of type uchar* server-tools/instance-manager/instance_options.cc: Changed buffer to be of type uchar* Replaced alloc_root + strcpy() with strdup_root() server-tools/instance-manager/mysql_connection.cc: Changed buffer to be of type uchar* server-tools/instance-manager/options.cc: Removed some old types server-tools/instance-manager/parse.cc: Changed some string lengths to use size_t server-tools/instance-manager/parse.h: Removed some old types Changed some string lengths to use size_t server-tools/instance-manager/protocol.cc: Changed some buffers to be uchar* to avoid casts Changed some string lengths to use size_t server-tools/instance-manager/protocol.h: Changed some string lengths to use size_t server-tools/instance-manager/user_map.cc: Removed some old types Changed some string lengths to use size_t sql/derror.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Changed some string lengths to use size_t sql/discover.cc: Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts Changed some string lengths to use size_t Changed some buffers to be uchar* to avoid casts sql/event_data_objects.cc: Removed some old types Added missing casts for alloc() and sprintf() sql/event_db_repository.cc: Changed some buffers to be uchar* to avoid casts Added missing casts for sprintf() sql/event_queue.cc: Removed some old types sql/field.cc: Removed some old types Changed memory buffers to be uchar* Changed some string lengths to use size_t Removed a lot of casts Safety fix in Field_blob::val_decimal() to not access zero pointer sql/field.h: Removed some old types Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes). Changed some string lengths to use size_t Removed some not needed casts Changed val_xxx(xxx, new_ptr) to take const pointers sql/field_conv.cc: Removed some old types Added casts required because memory area pointers are now uchar* sql/filesort.cc: Initalize variable that was used unitialized in error conditions sql/gen_lex_hash.cc: Removed some old types Changed memory buffers to be uchar* Changed some string lengths to use size_t Removed a lot of casts Safety fix in Field_blob::val_decimal() to not access zero pointer sql/gstream.h: Added required cast sql/ha_ndbcluster.cc: Removed some old types Updated hash-get-key function arguments Changed some buffers to be uchar* to avoid casts Added required casts Removed some not needed casts sql/ha_ndbcluster.h: Removed some old types sql/ha_ndbcluster_binlog.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake() Changed some string lengths to use size_t Added missing casts for alloc() and sprintf() sql/ha_ndbcluster_binlog.h: Removed some old types sql/ha_ndbcluster_cond.cc: Removed some old types Removed some not needed casts sql/ha_ndbcluster_cond.h: Removed some old types sql/ha_partition.cc: Removed some old types Changed prototype for change_partition() to avoid casts sql/ha_partition.h: Removed some old types sql/handler.cc: Removed some old types Changed some string lengths to use size_t sql/handler.h: Removed some old types Changed some string lengths to use size_t Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts sql/hash_filo.h: Removed some old types Changed all functions to use size_t sql/hostname.cc: Removed some old types sql/item.cc: Removed some old types Changed some string lengths to use size_t Use strmake() instead of memdup() to create a null terminated string. Updated calls to new Field() sql/item.h: Removed some old types Changed malloc(), free() and related functions to use void * Changed some buffers to be uchar* to avoid casts sql/item_cmpfunc.cc: Removed some old types Changed some buffers to be uchar* to avoid casts sql/item_cmpfunc.h: Removed some old types sql/item_create.cc: Removed some old types sql/item_func.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts Added test for failing alloc() in init_result_field() Remove old confusing comment Fixed compiler warning sql/item_func.h: Removed some old types sql/item_row.cc: Removed some old types sql/item_row.h: Removed some old types sql/item_strfunc.cc: Include zlib (needed becasue we call crc32) Removed some old types sql/item_strfunc.h: Removed some old types Changed some types to match new function prototypes sql/item_subselect.cc: Removed some old types sql/item_subselect.h: Removed some old types sql/item_sum.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/item_sum.h: Removed some old types sql/item_timefunc.cc: Removed some old types Changed some string lengths to use size_t sql/item_timefunc.h: Removed some old types sql/item_xmlfunc.cc: Changed some string lengths to use size_t sql/item_xmlfunc.h: Removed some old types sql/key.cc: Removed some old types Removed some not needed casts sql/lock.cc: Removed some old types Added some cast to my_multi_malloc() arguments for safety sql/log.cc: Removed some old types Changed some string lengths to use size_t Changed some buffers to be uchar* to avoid casts Changed usage of pwrite() to not assume it holds the cursor position for the file Made usage of my_read() safer sql/log_event.cc: Removed some old types Added checking of return value of malloc() in pack_info() Changed some buffers to be uchar* to avoid casts Removed some 'const' to avoid casts Added missing casts for alloc() and sprintf() Added required casts Removed some not needed casts Added some cast to my_multi_malloc() arguments for safety sql/log_event.h: Removed some old types Changed some buffers to be uchar* to avoid casts sql/log_event_old.cc: Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/log_event_old.h: Changed some buffers to be uchar* to avoid casts sql/mf_iocache.cc: Removed some old types sql/my_decimal.cc: Changed memory area to use uchar* sql/my_decimal.h: Changed memory area to use uchar* sql/mysql_priv.h: Removed some old types Changed malloc(), free() and related functions to use void * Changed some string lengths to use size_t Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow Changed some buffers to be uchar* to avoid casts sql/mysqld.cc: Removed some old types sql/net_serv.cc: Removed some old types Changed some string lengths to use size_t Changed some buffers to be uchar* to avoid casts Ensure that vio_read()/vio_write() return values are stored in a size_t variable Removed some not needed casts sql/opt_range.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/opt_range.h: Removed some old types Changed some buffers to be uchar* to avoid casts sql/opt_sum.cc: Removed some old types Removed some not needed casts sql/parse_file.cc: Removed some old types Changed some string lengths to use size_t Changed alloc_root + memcpy + set end 0 -> strmake_root() sql/parse_file.h: Removed some old types sql/partition_info.cc: Removed some old types Added missing casts for alloc() Changed some buffers to be uchar* to avoid casts sql/partition_info.h: Changed some buffers to be uchar* to avoid casts sql/protocol.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/protocol.h: Removed some old types Changed some buffers to be uchar* to avoid casts Changed some string lengths to use size_t sql/records.cc: Removed some old types sql/repl_failsafe.cc: Removed some old types Changed some string lengths to use size_t Added required casts sql/rpl_filter.cc: Removed some old types Updated hash-get-key function arguments Changed some string lengths to use size_t sql/rpl_filter.h: Changed some string lengths to use size_t sql/rpl_injector.h: Removed some old types sql/rpl_record.cc: Removed some old types Removed some not needed casts Changed some buffers to be uchar* to avoid casts sql/rpl_record.h: Removed some old types Changed some buffers to be uchar* to avoid casts sql/rpl_record_old.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/rpl_record_old.h: Removed some old types Changed some buffers to be uchar* to avoid cast sql/rpl_rli.cc: Removed some old types sql/rpl_tblmap.cc: Removed some old types sql/rpl_tblmap.h: Removed some old types sql/rpl_utility.cc: Removed some old types sql/rpl_utility.h: Removed some old types Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length sql/set_var.cc: Removed some old types Updated parameters to dirname_part() sql/set_var.h: Removed some old types sql/slave.cc: Removed some old types Changed some string lengths to use size_t sql/slave.h: Removed some old types sql/sp.cc: Removed some old types Added missing casts for printf() sql/sp.h: Removed some old types Updated hash-get-key function arguments sql/sp_cache.cc: Removed some old types Added missing casts for printf() Updated hash-get-key function arguments sql/sp_head.cc: Removed some old types Added missing casts for alloc() and printf() Added required casts Updated hash-get-key function arguments sql/sp_head.h: Removed some old types sql/sp_pcontext.cc: Removed some old types sql/sp_pcontext.h: Removed some old types sql/sql_acl.cc: Removed some old types Changed some string lengths to use size_t Changed some buffers to be uchar* to avoid casts Removed some not needed casts Added required casts sql/sql_analyse.cc: Changed some buffers to be uchar* to avoid casts sql/sql_analyse.h: Changed some buffers to be uchar* to avoid casts sql/sql_array.h: Removed some old types sql/sql_base.cc: Removed some old types Updated hash-get-key function arguments sql/sql_binlog.cc: Removed some old types Added missing casts for printf() sql/sql_cache.cc: Removed some old types Updated hash-get-key function arguments Removed some not needed casts Changed some string lengths to use size_t sql/sql_cache.h: Removed some old types Removed reference to not existing function cache_key() Updated hash-get-key function arguments sql/sql_class.cc: Removed some old types Updated hash-get-key function arguments Added missing casts for alloc() Updated hash-get-key function arguments Moved THD::max_row_length() to table.cc (as it's not depending on THD) Removed some not needed casts sql/sql_class.h: Removed some old types Changed malloc(), free() and related functions to use void * Removed some not needed casts Changed some string lengths to use size_t Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD sql/sql_connect.cc: Removed some old types Added required casts sql/sql_db.cc: Removed some old types Removed some not needed casts Added some cast to my_multi_malloc() arguments for safety Added missing casts for alloc() sql/sql_delete.cc: Removed some old types sql/sql_handler.cc: Removed some old types Updated hash-get-key function arguments Added some cast to my_multi_malloc() arguments for safety sql/sql_help.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/sql_insert.cc: Removed some old types Added missing casts for alloc() and printf() sql/sql_lex.cc: Removed some old types sql/sql_lex.h: Removed some old types Removed some not needed casts sql/sql_list.h: Removed some old types Removed some not needed casts sql/sql_load.cc: Removed some old types Removed compiler warning sql/sql_manager.cc: Removed some old types sql/sql_map.cc: Removed some old types sql/sql_map.h: Removed some old types sql/sql_olap.cc: Removed some old types sql/sql_parse.cc: Removed some old types Trivial move of code lines to make things more readable Changed some string lengths to use size_t Added missing casts for alloc() sql/sql_partition.cc: Removed some old types Removed compiler warnings about not used functions Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/sql_partition.h: Removed some old types Changed some buffers to be uchar* to avoid casts sql/sql_plugin.cc: Removed some old types Added missing casts for alloc() Updated hash-get-key function arguments sql/sql_prepare.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Added missing casts for alloc() and printf() sql-common/client.c: Removed some old types Changed some memory areas to use uchar* sql-common/my_user.c: Changed some string lengths to use size_t sql-common/pack.c: Changed some buffers to be uchar* to avoid casts sql/sql_repl.cc: Added required casts Changed some buffers to be uchar* to avoid casts Changed some string lengths to use size_t sql/sql_select.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some old types sql/sql_select.h: Removed some old types Changed some buffers to be uchar* to avoid casts sql/sql_servers.cc: Removed some old types Updated hash-get-key function arguments sql/sql_show.cc: Removed some old types Added missing casts for alloc() Removed some not needed casts sql/sql_string.cc: Removed some old types Added required casts sql/sql_table.cc: Removed some old types Removed compiler warning about not used variable Changed some buffers to be uchar* to avoid casts Removed some not needed casts sql/sql_test.cc: Removed some old types sql/sql_trigger.cc: Removed some old types Added missing casts for alloc() sql/sql_udf.cc: Removed some old types Updated hash-get-key function arguments sql/sql_union.cc: Removed some old types sql/sql_update.cc: Removed some old types Removed some not needed casts sql/sql_view.cc: Removed some old types sql/sql_yacc.yy: Removed some old types Changed some string lengths to use size_t Added missing casts for alloc() sql/stacktrace.c: Removed some old types sql/stacktrace.h: Removed some old types sql/structs.h: Removed some old types sql/table.cc: Removed some old types Updated hash-get-key function arguments Changed some buffers to be uchar* to avoid casts Removed setting of LEX_STRING() arguments in declaration Added required casts More function comments Moved max_row_length() here from sql_class.cc/sql_class.h sql/table.h: Removed some old types Changed some string lengths to use size_t sql/thr_malloc.cc: Use void* as type for allocated memory area Changed all functions to use size_t sql/tzfile.h: Changed some buffers to be uchar* to avoid casts sql/tztime.cc: Changed some buffers to be uchar* to avoid casts Updated hash-get-key function arguments Added missing casts for alloc() Removed some not needed casts sql/uniques.cc: Removed some old types Removed some not needed casts sql/unireg.cc: Removed some old types Changed some buffers to be uchar* to avoid casts Removed some not needed casts Added missing casts for alloc() storage/archive/archive_reader.c: Removed some old types storage/archive/azio.c: Removed some old types Removed some not needed casts storage/archive/ha_archive.cc: Removed some old types Changed type for 'frmblob' in archive_discover() to match handler Updated hash-get-key function arguments Removed some not needed casts storage/archive/ha_archive.h: Removed some old types storage/blackhole/ha_blackhole.cc: Removed some old types storage/blackhole/ha_blackhole.h: Removed some old types storage/csv/ha_tina.cc: Removed some old types Updated hash-get-key function arguments Changed some buffers to be uchar* to avoid casts storage/csv/ha_tina.h: Removed some old types Removed some not needed casts storage/csv/transparent_file.cc: Removed some old types Changed type of 'bytes_read' to be able to detect read errors Fixed indentation storage/csv/transparent_file.h: Removed some old types storage/example/ha_example.cc: Removed some old types Updated hash-get-key function arguments storage/example/ha_example.h: Removed some old types storage/federated/ha_federated.cc: Removed some old types Updated hash-get-key function arguments Removed some not needed casts storage/federated/ha_federated.h: Removed some old types storage/heap/_check.c: Changed some buffers to be uchar* to avoid casts storage/heap/_rectest.c: Removed some old types storage/heap/ha_heap.cc: Removed some old types storage/heap/ha_heap.h: Removed some old types storage/heap/heapdef.h: Removed some old types storage/heap/hp_block.c: Removed some old types Changed some string lengths to use size_t storage/heap/hp_clear.c: Removed some old types storage/heap/hp_close.c: Removed some old types storage/heap/hp_create.c: Removed some old types storage/heap/hp_delete.c: Removed some old types storage/heap/hp_hash.c: Removed some old types storage/heap/hp_info.c: Removed some old types storage/heap/hp_open.c: Removed some old types storage/heap/hp_rfirst.c: Removed some old types storage/heap/hp_rkey.c: Removed some old types storage/heap/hp_rlast.c: Removed some old types storage/heap/hp_rnext.c: Removed some old types storage/heap/hp_rprev.c: Removed some old types storage/heap/hp_rrnd.c: Removed some old types storage/heap/hp_rsame.c: Removed some old types storage/heap/hp_scan.c: Removed some old types storage/heap/hp_test1.c: Removed some old types storage/heap/hp_test2.c: Removed some old types storage/heap/hp_update.c: Removed some old types storage/heap/hp_write.c: Removed some old types Changed some string lengths to use size_t storage/innobase/handler/ha_innodb.cc: Removed some old types Updated hash-get-key function arguments Added missing casts for alloc() and printf() Removed some not needed casts storage/innobase/handler/ha_innodb.h: Removed some old types storage/myisam/ft_boolean_search.c: Removed some old types storage/myisam/ft_nlq_search.c: Removed some old types storage/myisam/ft_parser.c: Removed some old types Changed some buffers to be uchar* to avoid casts storage/myisam/ft_static.c: Removed some old types storage/myisam/ft_stopwords.c: Removed some old types storage/myisam/ft_update.c: Removed some old types Changed some buffers to be uchar* to avoid casts storage/myisam/ftdefs.h: Removed some old types Changed some buffers to be uchar* to avoid casts storage/myisam/fulltext.h: Removed some old types storage/myisam/ha_myisam.cc: Removed some old types storage/myisam/ha_myisam.h: Removed some old types storage/myisam/mi_cache.c: Removed some old types Changed some buffers to be uchar* to avoid casts storage/myisam/mi_check.c: Removed some old types storage/myisam/mi_checksum.c: Removed some old types storage/myisam/mi_close.c: Removed some old types storage/myisam/mi_create.c: Removed some old types storage/myisam/mi_delete.c: Removed some old types storage/myisam/mi_delete_all.c: Removed some old types storage/myisam/mi_dynrec.c: Removed some old types storage/myisam/mi_extra.c: Removed some old types storage/myisam/mi_key.c: Removed some old types storage/myisam/mi_locking.c: Removed some old types storage/myisam/mi_log.c: Removed some old types storage/myisam/mi_open.c: Removed some old types Removed some not needed casts Check argument of my_write()/my_pwrite() in functions returning int Added casting of string lengths to size_t storage/myisam/mi_packrec.c: Removed some old types Changed some buffers to be uchar* to avoid casts storage/myisam/mi_page.c: Removed some old types storage/myisam/mi_preload.c: Removed some old types storage/myisam/mi_range.c: Removed some old types storage/myisam/mi_rfirst.c: Removed some old types storage/myisam/mi_rkey.c: Removed some old types storage/myisam/mi_rlast.c: Removed some old types storage/myisam/mi_rnext.c: Removed some old types storage/myisam/mi_rnext_same.c: Removed some old types storage/myisam/mi_rprev.c: Removed some old types storage/myisam/mi_rrnd.c: Removed some old types storage/myisam/mi_rsame.c: Removed some old types storage/myisam/mi_rsamepos.c: Removed some old types storage/myisam/mi_scan.c: Removed some old types storage/myisam/mi_search.c: Removed some old types storage/myisam/mi_static.c: Removed some old types storage/myisam/mi_statrec.c: Removed some old types storage/myisam/mi_test1.c: Removed some old types storage/myisam/mi_test2.c: Removed some old types storage/myisam/mi_test3.c: Removed some old types storage/myisam/mi_unique.c: Removed some old types storage/myisam/mi_update.c: Removed some old types storage/myisam/mi_write.c: Removed some old types storage/myisam/myisam_ftdump.c: Removed some old types storage/myisam/myisamchk.c: Removed some old types storage/myisam/myisamdef.h: Removed some old types storage/myisam/myisamlog.c: Removed some old types Indentation fix storage/myisam/myisampack.c: Removed some old types storage/myisam/rt_index.c: Removed some old types storage/myisam/rt_split.c: Removed some old types storage/myisam/sort.c: Removed some old types storage/myisam/sp_defs.h: Removed some old types storage/myisam/sp_key.c: Removed some old types storage/myisammrg/ha_myisammrg.cc: Removed some old types storage/myisammrg/ha_myisammrg.h: Removed some old types storage/myisammrg/myrg_close.c: Removed some old types storage/myisammrg/myrg_def.h: Removed some old types storage/myisammrg/myrg_delete.c: Removed some old types storage/myisammrg/myrg_open.c: Removed some old types Updated parameters to dirname_part() storage/myisammrg/myrg_queue.c: Removed some old types storage/myisammrg/myrg_rfirst.c: Removed some old types storage/myisammrg/myrg_rkey.c: Removed some old types storage/myisammrg/myrg_rlast.c: Removed some old types storage/myisammrg/myrg_rnext.c: Removed some old types storage/myisammrg/myrg_rnext_same.c: Removed some old types storage/myisammrg/myrg_rprev.c: Removed some old types storage/myisammrg/myrg_rrnd.c: Removed some old types storage/myisammrg/myrg_rsame.c: Removed some old types storage/myisammrg/myrg_update.c: Removed some old types storage/myisammrg/myrg_write.c: Removed some old types storage/ndb/include/util/ndb_opts.h: Removed some old types storage/ndb/src/cw/cpcd/main.cpp: Removed some old types storage/ndb/src/kernel/vm/Configuration.cpp: Removed some old types storage/ndb/src/mgmclient/main.cpp: Removed some old types storage/ndb/src/mgmsrv/InitConfigFileParser.cpp: Removed some old types Removed old disabled code storage/ndb/src/mgmsrv/main.cpp: Removed some old types storage/ndb/src/ndbapi/NdbBlob.cpp: Removed some old types storage/ndb/src/ndbapi/NdbOperationDefine.cpp: Removed not used variable storage/ndb/src/ndbapi/NdbOperationInt.cpp: Added required casts storage/ndb/src/ndbapi/NdbScanOperation.cpp: Added required casts storage/ndb/tools/delete_all.cpp: Removed some old types storage/ndb/tools/desc.cpp: Removed some old types storage/ndb/tools/drop_index.cpp: Removed some old types storage/ndb/tools/drop_tab.cpp: Removed some old types storage/ndb/tools/listTables.cpp: Removed some old types storage/ndb/tools/ndb_config.cpp: Removed some old types storage/ndb/tools/restore/consumer_restore.cpp: Changed some buffers to be uchar* to avoid casts with new defintion of packfrm() storage/ndb/tools/restore/restore_main.cpp: Removed some old types storage/ndb/tools/select_all.cpp: Removed some old types storage/ndb/tools/select_count.cpp: Removed some old types storage/ndb/tools/waiter.cpp: Removed some old types strings/bchange.c: Changed function to use uchar * and size_t strings/bcmp.c: Changed function to use uchar * and size_t strings/bmove512.c: Changed function to use uchar * and size_t strings/bmove_upp.c: Changed function to use uchar * and size_t strings/ctype-big5.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-bin.c: Changed functions to use size_t strings/ctype-cp932.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-czech.c: Fixed indentation Changed functions to use size_t strings/ctype-euc_kr.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-eucjpms.c: Changed functions to use size_t Changed character length functions to return uint unsigned char -> uchar strings/ctype-gb2312.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-gbk.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-latin1.c: Changed functions to use size_t Changed character length functions to return uint unsigned char -> uchar strings/ctype-mb.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-simple.c: Changed functions to use size_t Simpler loops for caseup/casedown unsigned int -> uint unsigned char -> uchar strings/ctype-sjis.c: Changed functions to use size_t Changed character length functions to return uint strings/ctype-tis620.c: Changed functions to use size_t Changed character length functions to return uint unsigned char -> uchar strings/ctype-uca.c: Changed functions to use size_t unsigned char -> uchar strings/ctype-ucs2.c: Moved inclusion of stdarg.h to other includes usigned char -> uchar Changed functions to use size_t Changed character length functions to return uint strings/ctype-ujis.c: Changed functions to use size_t Changed character length functions to return uint unsigned char -> uchar strings/ctype-utf8.c: Changed functions to use size_t unsigned char -> uchar Indentation fixes strings/ctype-win1250ch.c: Indentation fixes Changed functions to use size_t strings/ctype.c: Changed functions to use size_t strings/decimal.c: Changed type for memory argument to uchar * strings/do_ctype.c: Indentation fixes strings/my_strtoll10.c: unsigned char -> uchar strings/my_vsnprintf.c: Changed functions to use size_t strings/r_strinstr.c: Removed some old types Changed functions to use size_t strings/str_test.c: Removed some old types strings/strappend.c: Changed functions to use size_t strings/strcont.c: Removed some old types strings/strfill.c: Removed some old types strings/strinstr.c: Changed functions to use size_t strings/strlen.c: Changed functions to use size_t strings/strmake.c: Changed functions to use size_t strings/strnlen.c: Changed functions to use size_t strings/strnmov.c: Changed functions to use size_t strings/strto.c: unsigned char -> uchar strings/strtod.c: Changed functions to use size_t strings/strxnmov.c: Changed functions to use size_t strings/xml.c: Changed functions to use size_t Indentation fixes tests/mysql_client_test.c: Removed some old types tests/thread_test.c: Removed some old types vio/test-ssl.c: Removed some old types vio/test-sslclient.c: Removed some old types vio/test-sslserver.c: Removed some old types vio/vio.c: Removed some old types vio/vio_priv.h: Removed some old types Changed vio_read()/vio_write() to work with size_t vio/viosocket.c: Changed vio_read()/vio_write() to work with size_t Indentation fixes vio/viossl.c: Changed vio_read()/vio_write() to work with size_t Indentation fixes vio/viosslfactories.c: Removed some old types vio/viotest-ssl.c: Removed some old types win/README: More explanations
572 lines
19 KiB
C++
572 lines
19 KiB
C++
/* Copyright (C) 2000-2003 MySQL AB
|
|
|
|
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
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/*
|
|
This file defines the NDB Cluster handler: the interface between MySQL and
|
|
NDB Cluster
|
|
*/
|
|
|
|
/* The class defining a handle to an NDB Cluster table */
|
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
/* Blob tables and events are internal to NDB and must never be accessed */
|
|
#define IS_NDB_BLOB_PREFIX(A) is_prefix(A, "NDB$BLOB")
|
|
|
|
#include <NdbApi.hpp>
|
|
#include <ndbapi_limits.h>
|
|
|
|
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
|
|
|
|
class Ndb; // Forward declaration
|
|
class NdbOperation; // Forward declaration
|
|
class NdbTransaction; // Forward declaration
|
|
class NdbRecAttr; // Forward declaration
|
|
class NdbScanOperation;
|
|
class NdbIndexScanOperation;
|
|
class NdbBlob;
|
|
class NdbIndexStat;
|
|
class NdbEventOperation;
|
|
class ha_ndbcluster_cond;
|
|
|
|
// connectstring to cluster if given by mysqld
|
|
extern const char *ndbcluster_connectstring;
|
|
extern ulong ndb_cache_check_time;
|
|
#ifdef HAVE_NDB_BINLOG
|
|
extern ulong ndb_report_thresh_binlog_epoch_slip;
|
|
extern ulong ndb_report_thresh_binlog_mem_usage;
|
|
#endif
|
|
|
|
typedef enum ndb_index_type {
|
|
UNDEFINED_INDEX = 0,
|
|
PRIMARY_KEY_INDEX = 1,
|
|
PRIMARY_KEY_ORDERED_INDEX = 2,
|
|
UNIQUE_INDEX = 3,
|
|
UNIQUE_ORDERED_INDEX = 4,
|
|
ORDERED_INDEX = 5
|
|
} NDB_INDEX_TYPE;
|
|
|
|
typedef enum ndb_index_status {
|
|
UNDEFINED = 0,
|
|
ACTIVE = 1,
|
|
TO_BE_DROPPED = 2
|
|
} NDB_INDEX_STATUS;
|
|
|
|
typedef struct ndb_index_data {
|
|
NDB_INDEX_TYPE type;
|
|
NDB_INDEX_STATUS status;
|
|
const NdbDictionary::Index *index;
|
|
const NdbDictionary::Index *unique_index;
|
|
unsigned char *unique_index_attrid_map;
|
|
bool null_in_unique_index;
|
|
// In this version stats are not shared between threads
|
|
NdbIndexStat* index_stat;
|
|
uint index_stat_cache_entries;
|
|
// Simple counter mechanism to decide when to connect to db
|
|
uint index_stat_update_freq;
|
|
uint index_stat_query_count;
|
|
} NDB_INDEX_DATA;
|
|
|
|
typedef union { const NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue;
|
|
|
|
int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
|
|
uchar*& buffer, uint& buffer_size,
|
|
my_ptrdiff_t ptrdiff);
|
|
|
|
typedef enum {
|
|
NSS_INITIAL= 0,
|
|
NSS_DROPPED,
|
|
NSS_ALTERED
|
|
} NDB_SHARE_STATE;
|
|
|
|
typedef struct st_ndbcluster_share {
|
|
NDB_SHARE_STATE state;
|
|
MEM_ROOT mem_root;
|
|
THR_LOCK lock;
|
|
pthread_mutex_t mutex;
|
|
char *key;
|
|
uint key_length;
|
|
THD *util_lock;
|
|
uint use_count;
|
|
uint commit_count_lock;
|
|
ulonglong commit_count;
|
|
char *db;
|
|
char *table_name;
|
|
Ndb::TupleIdRange tuple_id_range;
|
|
#ifdef HAVE_NDB_BINLOG
|
|
uint32 connect_count;
|
|
uint32 flags;
|
|
NdbEventOperation *op;
|
|
NdbEventOperation *op_old; // for rename table
|
|
char *old_names; // for rename table
|
|
TABLE_SHARE *table_share;
|
|
TABLE *table;
|
|
uchar *record[2]; // pointer to allocated records for receiving data
|
|
NdbValue *ndb_value[2];
|
|
MY_BITMAP *subscriber_bitmap;
|
|
#endif
|
|
} NDB_SHARE;
|
|
|
|
inline
|
|
NDB_SHARE_STATE
|
|
get_ndb_share_state(NDB_SHARE *share)
|
|
{
|
|
NDB_SHARE_STATE state;
|
|
pthread_mutex_lock(&share->mutex);
|
|
state= share->state;
|
|
pthread_mutex_unlock(&share->mutex);
|
|
return state;
|
|
}
|
|
|
|
inline
|
|
void
|
|
set_ndb_share_state(NDB_SHARE *share, NDB_SHARE_STATE state)
|
|
{
|
|
pthread_mutex_lock(&share->mutex);
|
|
share->state= state;
|
|
pthread_mutex_unlock(&share->mutex);
|
|
}
|
|
|
|
struct Ndb_tuple_id_range_guard {
|
|
Ndb_tuple_id_range_guard(NDB_SHARE* _share) :
|
|
share(_share),
|
|
range(share->tuple_id_range) {
|
|
pthread_mutex_lock(&share->mutex);
|
|
}
|
|
~Ndb_tuple_id_range_guard() {
|
|
pthread_mutex_unlock(&share->mutex);
|
|
}
|
|
NDB_SHARE* share;
|
|
Ndb::TupleIdRange& range;
|
|
};
|
|
|
|
#ifdef HAVE_NDB_BINLOG
|
|
/* NDB_SHARE.flags */
|
|
#define NSF_HIDDEN_PK 1 /* table has hidden primary key */
|
|
#define NSF_BLOB_FLAG 2 /* table has blob attributes */
|
|
#define NSF_NO_BINLOG 4 /* table should not be binlogged */
|
|
#endif
|
|
|
|
typedef enum ndb_query_state_bits {
|
|
NDB_QUERY_NORMAL = 0,
|
|
NDB_QUERY_MULTI_READ_RANGE = 1
|
|
} NDB_QUERY_STATE_BITS;
|
|
|
|
/*
|
|
Place holder for ha_ndbcluster thread specific data
|
|
*/
|
|
|
|
enum THD_NDB_OPTIONS
|
|
{
|
|
TNO_NO_LOG_SCHEMA_OP= 1 << 0
|
|
};
|
|
|
|
enum THD_NDB_TRANS_OPTIONS
|
|
{
|
|
TNTO_INJECTED_APPLY_STATUS= 1 << 0
|
|
};
|
|
|
|
struct Ndb_local_table_statistics {
|
|
int no_uncommitted_rows_count;
|
|
ulong last_count;
|
|
ha_rows records;
|
|
};
|
|
|
|
typedef struct st_thd_ndb_share {
|
|
const void *key;
|
|
struct Ndb_local_table_statistics stat;
|
|
} THD_NDB_SHARE;
|
|
|
|
class Thd_ndb
|
|
{
|
|
public:
|
|
Thd_ndb();
|
|
~Thd_ndb();
|
|
|
|
void init_open_tables();
|
|
THD_NDB_SHARE *get_open_table(THD *thd, const void *key);
|
|
|
|
Ndb *ndb;
|
|
ulong count;
|
|
uint lock_count;
|
|
NdbTransaction *all;
|
|
NdbTransaction *stmt;
|
|
bool m_error;
|
|
bool m_slow_path;
|
|
uint32 options;
|
|
uint32 trans_options;
|
|
List<NDB_SHARE> changed_tables;
|
|
uint query_state;
|
|
HASH open_tables;
|
|
};
|
|
|
|
class ha_ndbcluster: public handler
|
|
{
|
|
public:
|
|
ha_ndbcluster(handlerton *hton, TABLE_SHARE *table);
|
|
~ha_ndbcluster();
|
|
|
|
int ha_initialise();
|
|
int open(const char *name, int mode, uint test_if_locked);
|
|
int close(void);
|
|
|
|
int write_row(uchar *buf);
|
|
int update_row(const uchar *old_data, uchar *new_data);
|
|
int delete_row(const uchar *buf);
|
|
int index_init(uint index, bool sorted);
|
|
int index_end();
|
|
int index_read(uchar *buf, const uchar *key, uint key_len,
|
|
enum ha_rkey_function find_flag);
|
|
int index_next(uchar *buf);
|
|
int index_prev(uchar *buf);
|
|
int index_first(uchar *buf);
|
|
int index_last(uchar *buf);
|
|
int index_read_last(uchar * buf, const uchar * key, uint key_len);
|
|
int rnd_init(bool scan);
|
|
int rnd_end();
|
|
int rnd_next(uchar *buf);
|
|
int rnd_pos(uchar *buf, uchar *pos);
|
|
void position(const uchar *record);
|
|
int read_range_first(const key_range *start_key,
|
|
const key_range *end_key,
|
|
bool eq_range, bool sorted);
|
|
int read_range_first_to_buf(const key_range *start_key,
|
|
const key_range *end_key,
|
|
bool eq_range, bool sorted,
|
|
uchar* buf);
|
|
int read_range_next();
|
|
int alter_tablespace(st_alter_tablespace *info);
|
|
|
|
/**
|
|
* Multi range stuff
|
|
*/
|
|
int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
|
|
KEY_MULTI_RANGE*ranges, uint range_count,
|
|
bool sorted, HANDLER_BUFFER *buffer);
|
|
int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
|
|
bool null_value_index_search(KEY_MULTI_RANGE *ranges,
|
|
KEY_MULTI_RANGE *end_range,
|
|
HANDLER_BUFFER *buffer);
|
|
|
|
bool get_error_message(int error, String *buf);
|
|
ha_rows records();
|
|
ha_rows estimate_rows_upper_bound()
|
|
{ return HA_POS_ERROR; }
|
|
int info(uint);
|
|
void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id);
|
|
int extra(enum ha_extra_function operation);
|
|
int extra_opt(enum ha_extra_function operation, ulong cache_size);
|
|
int reset();
|
|
int external_lock(THD *thd, int lock_type);
|
|
void unlock_row();
|
|
int start_stmt(THD *thd, thr_lock_type lock_type);
|
|
void print_error(int error, myf errflag);
|
|
const char * table_type() const;
|
|
const char ** bas_ext() const;
|
|
ulonglong table_flags(void) const;
|
|
void prepare_for_alter();
|
|
int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
|
|
int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
|
|
int final_drop_index(TABLE *table_arg);
|
|
void set_part_info(partition_info *part_info);
|
|
ulong index_flags(uint idx, uint part, bool all_parts) const;
|
|
uint max_supported_record_length() const;
|
|
uint max_supported_keys() const;
|
|
uint max_supported_key_parts() const;
|
|
uint max_supported_key_length() const;
|
|
uint max_supported_key_part_length() const;
|
|
|
|
int rename_table(const char *from, const char *to);
|
|
int delete_table(const char *name);
|
|
int create(const char *name, TABLE *form, HA_CREATE_INFO *info);
|
|
int create_handler_files(const char *file, const char *old_name,
|
|
int action_flag, HA_CREATE_INFO *info);
|
|
int get_default_no_partitions(HA_CREATE_INFO *info);
|
|
bool get_no_parts(const char *name, uint *no_parts);
|
|
void set_auto_partitions(partition_info *part_info);
|
|
virtual bool is_fatal_error(int error, uint flags)
|
|
{
|
|
if (!handler::is_fatal_error(error, flags) ||
|
|
error == HA_ERR_NO_PARTITION_FOUND)
|
|
return FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
THR_LOCK_DATA **store_lock(THD *thd,
|
|
THR_LOCK_DATA **to,
|
|
enum thr_lock_type lock_type);
|
|
|
|
bool low_byte_first() const;
|
|
|
|
const char* index_type(uint key_number);
|
|
|
|
double scan_time();
|
|
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
|
|
void start_bulk_insert(ha_rows rows);
|
|
int end_bulk_insert();
|
|
|
|
static Thd_ndb* seize_thd_ndb();
|
|
static void release_thd_ndb(Thd_ndb* thd_ndb);
|
|
|
|
static void set_dbname(const char *pathname, char *dbname);
|
|
static void set_tabname(const char *pathname, char *tabname);
|
|
|
|
/*
|
|
Condition pushdown
|
|
*/
|
|
|
|
/*
|
|
Push condition down to the table handler.
|
|
SYNOPSIS
|
|
cond_push()
|
|
cond Condition to be pushed. The condition tree must not be
|
|
modified by the by the caller.
|
|
RETURN
|
|
The 'remainder' condition that caller must use to filter out records.
|
|
NULL means the handler will not return rows that do not match the
|
|
passed condition.
|
|
NOTES
|
|
The pushed conditions form a stack (from which one can remove the
|
|
last pushed condition using cond_pop).
|
|
The table handler filters out rows using (pushed_cond1 AND pushed_cond2
|
|
AND ... AND pushed_condN)
|
|
or less restrictive condition, depending on handler's capabilities.
|
|
|
|
handler->reset() call empties the condition stack.
|
|
Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
|
|
condition stack.
|
|
The current implementation supports arbitrary AND/OR nested conditions
|
|
with comparisons between columns and constants (including constant
|
|
expressions and function calls) and the following comparison operators:
|
|
=, !=, >, >=, <, <=, like, "not like", "is null", and "is not null".
|
|
Negated conditions are supported by NOT which generate NAND/NOR groups.
|
|
*/
|
|
const COND *cond_push(const COND *cond);
|
|
/*
|
|
Pop the top condition from the condition stack of the handler instance.
|
|
SYNOPSIS
|
|
cond_pop()
|
|
Pops the top if condition stack, if stack is not empty
|
|
*/
|
|
void cond_pop();
|
|
|
|
uint8 table_cache_type();
|
|
|
|
/*
|
|
* Internal to ha_ndbcluster, used by C functions
|
|
*/
|
|
int ndb_err(NdbTransaction*);
|
|
|
|
my_bool register_query_cache_table(THD *thd, char *table_key,
|
|
uint key_length,
|
|
qc_engine_callback *engine_callback,
|
|
ulonglong *engine_data);
|
|
|
|
bool check_if_incompatible_data(HA_CREATE_INFO *info,
|
|
uint table_changes);
|
|
|
|
private:
|
|
friend int ndbcluster_drop_database_impl(const char *path);
|
|
friend int ndb_handle_schema_change(THD *thd,
|
|
Ndb *ndb, NdbEventOperation *pOp,
|
|
NDB_SHARE *share);
|
|
|
|
static int delete_table(ha_ndbcluster *h, Ndb *ndb,
|
|
const char *path,
|
|
const char *db,
|
|
const char *table_name);
|
|
int create_ndb_index(const char *name, KEY *key_info, bool unique);
|
|
int create_ordered_index(const char *name, KEY *key_info);
|
|
int create_unique_index(const char *name, KEY *key_info);
|
|
int create_index(const char *name, KEY *key_info,
|
|
NDB_INDEX_TYPE idx_type, uint idx_no);
|
|
// Index list management
|
|
int create_indexes(Ndb *ndb, TABLE *tab);
|
|
int open_indexes(Ndb *ndb, TABLE *tab, bool ignore_error);
|
|
void renumber_indexes(Ndb *ndb, TABLE *tab);
|
|
int drop_indexes(Ndb *ndb, TABLE *tab);
|
|
int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict,
|
|
KEY *key_info, const char *index_name, uint index_no);
|
|
int get_metadata(const char* path);
|
|
void release_metadata(THD *thd, Ndb *ndb);
|
|
NDB_INDEX_TYPE get_index_type(uint idx_no) const;
|
|
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
|
|
NDB_INDEX_TYPE get_index_type_from_key(uint index_no, KEY *key_info,
|
|
bool primary) const;
|
|
bool has_null_in_unique_index(uint idx_no) const;
|
|
bool check_index_fields_not_null(KEY *key_info);
|
|
|
|
uint set_up_partition_info(partition_info *part_info,
|
|
TABLE *table,
|
|
void *tab);
|
|
char* get_tablespace_name(THD *thd, char *name, uint name_len);
|
|
int set_range_data(void *tab, partition_info* part_info);
|
|
int set_list_data(void *tab, partition_info* part_info);
|
|
int complemented_read(const uchar *old_data, uchar *new_data,
|
|
uint32 old_part_id);
|
|
int pk_read(const uchar *key, uint key_len, uchar *buf, uint32 part_id);
|
|
int ordered_index_scan(const key_range *start_key,
|
|
const key_range *end_key,
|
|
bool sorted, bool descending, uchar* buf,
|
|
part_id_range *part_spec);
|
|
int unique_index_read(const uchar *key, uint key_len,
|
|
uchar *buf);
|
|
int unique_index_scan(const KEY* key_info,
|
|
const uchar *key,
|
|
uint key_len,
|
|
uchar *buf);
|
|
int full_table_scan(uchar * buf);
|
|
|
|
bool check_all_operations_for_error(NdbTransaction *trans,
|
|
const NdbOperation *first,
|
|
const NdbOperation *last,
|
|
uint errcode);
|
|
int peek_indexed_rows(const uchar *record, bool check_pk);
|
|
int fetch_next(NdbScanOperation* op);
|
|
int next_result(uchar *buf);
|
|
int define_read_attrs(uchar* buf, NdbOperation* op);
|
|
int filtered_scan(const uchar *key, uint key_len,
|
|
uchar *buf,
|
|
enum ha_rkey_function find_flag);
|
|
int close_scan();
|
|
void unpack_record(uchar *buf);
|
|
int get_ndb_lock_type(enum thr_lock_type type);
|
|
|
|
void set_dbname(const char *pathname);
|
|
void set_tabname(const char *pathname);
|
|
|
|
bool set_hidden_key(NdbOperation*,
|
|
uint fieldnr, const uchar* field_ptr);
|
|
int set_ndb_key(NdbOperation*, Field *field,
|
|
uint fieldnr, const uchar* field_ptr);
|
|
int set_ndb_value(NdbOperation*, Field *field, uint fieldnr,
|
|
int row_offset= 0, bool *set_blob_value= 0);
|
|
int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, uchar*);
|
|
int get_ndb_partition_id(NdbOperation *);
|
|
friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg);
|
|
int set_primary_key(NdbOperation *op, const uchar *key);
|
|
int set_primary_key_from_record(NdbOperation *op, const uchar *record);
|
|
int set_index_key_from_record(NdbOperation *op, const uchar *record,
|
|
uint keyno);
|
|
int set_bounds(NdbIndexScanOperation*, uint inx, bool rir,
|
|
const key_range *keys[2], uint= 0);
|
|
int key_cmp(uint keynr, const uchar * old_row, const uchar * new_row);
|
|
int set_index_key(NdbOperation *, const KEY *key_info, const uchar *key_ptr);
|
|
void print_results();
|
|
|
|
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
|
|
ulonglong nb_desired_values,
|
|
ulonglong *first_value,
|
|
ulonglong *nb_reserved_values);
|
|
bool uses_blob_value();
|
|
|
|
char *update_table_comment(const char * comment);
|
|
|
|
int write_ndb_file(const char *name);
|
|
|
|
int check_ndb_connection(THD* thd= current_thd);
|
|
|
|
void set_rec_per_key();
|
|
int records_update();
|
|
void no_uncommitted_rows_execute_failure();
|
|
void no_uncommitted_rows_update(int);
|
|
void no_uncommitted_rows_reset(THD *);
|
|
|
|
void release_completed_operations(NdbTransaction*, bool);
|
|
|
|
friend int execute_commit(ha_ndbcluster*, NdbTransaction*);
|
|
friend int execute_no_commit_ignore_no_key(ha_ndbcluster*, NdbTransaction*);
|
|
friend int execute_no_commit(ha_ndbcluster*, NdbTransaction*, bool);
|
|
friend int execute_no_commit_ie(ha_ndbcluster*, NdbTransaction*, bool);
|
|
|
|
NdbTransaction *m_active_trans;
|
|
NdbScanOperation *m_active_cursor;
|
|
const NdbDictionary::Table *m_table;
|
|
struct Ndb_local_table_statistics *m_table_info;
|
|
char m_dbname[FN_HEADLEN];
|
|
//char m_schemaname[FN_HEADLEN];
|
|
char m_tabname[FN_HEADLEN];
|
|
ulonglong m_table_flags;
|
|
THR_LOCK_DATA m_lock;
|
|
bool m_lock_tuple;
|
|
NDB_SHARE *m_share;
|
|
NDB_INDEX_DATA m_index[MAX_KEY];
|
|
THD_NDB_SHARE *m_thd_ndb_share;
|
|
// NdbRecAttr has no reference to blob
|
|
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
|
|
uchar m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
|
|
partition_info *m_part_info;
|
|
uint32 m_part_id;
|
|
uchar *m_rec0;
|
|
Field **m_part_field_array;
|
|
bool m_use_partition_function;
|
|
bool m_sorted;
|
|
bool m_use_write;
|
|
bool m_ignore_dup_key;
|
|
bool m_has_unique_index;
|
|
bool m_primary_key_update;
|
|
bool m_write_op;
|
|
bool m_ignore_no_key;
|
|
ha_rows m_rows_to_insert; // TODO: merge it with handler::estimation_rows_to_insert?
|
|
ha_rows m_rows_inserted;
|
|
ha_rows m_bulk_insert_rows;
|
|
ha_rows m_rows_changed;
|
|
bool m_bulk_insert_not_flushed;
|
|
bool m_delete_cannot_batch;
|
|
bool m_update_cannot_batch;
|
|
ha_rows m_ops_pending;
|
|
bool m_skip_auto_increment;
|
|
bool m_blobs_pending;
|
|
bool m_slow_path;
|
|
my_ptrdiff_t m_blobs_offset;
|
|
// memory for blobs in one tuple
|
|
uchar *m_blobs_buffer;
|
|
uint32 m_blobs_buffer_size;
|
|
uint m_dupkey;
|
|
// set from thread variables at external lock
|
|
bool m_ha_not_exact_count;
|
|
bool m_force_send;
|
|
ha_rows m_autoincrement_prefetch;
|
|
bool m_transaction_on;
|
|
|
|
ha_ndbcluster_cond *m_cond;
|
|
bool m_disable_multi_read;
|
|
uchar *m_multi_range_result_ptr;
|
|
KEY_MULTI_RANGE *m_multi_ranges;
|
|
KEY_MULTI_RANGE *m_multi_range_defined;
|
|
const NdbOperation *m_current_multi_operation;
|
|
NdbIndexScanOperation *m_multi_cursor;
|
|
uchar *m_multi_range_cursor_result_ptr;
|
|
int setup_recattr(const NdbRecAttr*);
|
|
Ndb *get_ndb();
|
|
};
|
|
|
|
extern SHOW_VAR ndb_status_variables[];
|
|
|
|
int ndbcluster_discover(THD* thd, const char* dbname, const char* name,
|
|
const void** frmblob, uint* frmlen);
|
|
int ndbcluster_find_files(THD *thd,const char *db,const char *path,
|
|
const char *wild, bool dir, List<char> *files);
|
|
int ndbcluster_table_exists_in_engine(THD* thd,
|
|
const char *db, const char *name);
|
|
void ndbcluster_print_error(int error, const NdbOperation *error_op);
|
|
|
|
static const char ndbcluster_hton_name[]= "ndbcluster";
|
|
static const int ndbcluster_hton_name_length=sizeof(ndbcluster_hton_name)-1;
|
|
extern int ndbcluster_terminating;
|
|
extern int ndb_util_thread_running;
|
|
extern pthread_cond_t COND_ndb_util_ready;
|