From fcdc76c28952608524d6e5a388bc7b04ad8de09f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Jul 2007 22:27:58 +0200 Subject: in mysql_unlock_tables(), do thr_unlock() AFTER external_unlock(). it means, {update,restore}_status() should be called in external_lock, not in thr_unlock. Only affects storage engines that support TL_WRITE_CONCURRENT. --- storage/csv/ha_tina.cc | 12 ++++++++++-- storage/csv/ha_tina.h | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'storage/csv') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index afe8e5f1b27..6dacc8f2663 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -441,7 +441,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg) */ current_position(0), next_position(0), local_saved_data_file_length(0), file_buff(0), chain_alloced(0), chain_size(DEFAULT_CHAIN_LENGTH), - records_is_known(0) + records_is_known(0), curr_lock_type(F_UNLCK) { /* Set our original buffers from pre-allocated memory */ buffer.set((char*)byte_buffer, IO_SIZE, system_charset_info); @@ -1394,6 +1394,14 @@ int ha_tina::delete_all_rows() DBUG_RETURN(rc); } +int ha_tina::external_lock(THD *thd __attribute__((unused)), int lock_type) +{ + if (lock_type==F_UNLCK && curr_lock_type == F_WRLCK) + update_status(); + curr_lock_type= lock_type; + return 0; +} + /* Called by the database to lock the table. Keep in mind that this is an internal lock. @@ -1408,7 +1416,7 @@ THR_LOCK_DATA **ha_tina::store_lock(THD *thd, return to; } -/* +/* Create a table. You do not want to leave the table open after a call to this (the database will call ::open() if it needs to). */ diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 0c667237c0f..e52e9cd28e5 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -81,6 +81,8 @@ class ha_tina: public handler bool records_is_known; private: + int curr_lock_type; + bool get_write_pos(off_t *end_pos, tina_set *closest_hole); int open_update_temp_file_if_needed(); int init_tina_writer(); @@ -153,6 +155,8 @@ public: bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); + int external_lock(THD *thd, int lock_type); + THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); -- cgit v1.2.1 From 126c1228f5385411fbff586cbc1a48a6c61abfe9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Apr 2008 05:26:36 +0300 Subject: Added versioning of row data Will in future changeset (soon) av versioning of status variables (number of rows) and index Changed some LEX_STRING to LEX_CUSTRING to avoid casts and warnings Removed some not needed variables (as noticed by Guilhem) include/maria.h: Added prototypes for maria_chk_init_for_check(), maria_versioning() and maria_ignore_trids() include/my_base.h: Add new error HA_ERR_ROW_NOT_VISIBLE include/myisamchk.h: Added variables for checking visibility of rows during maria_chk include/thr_lock.h: Changed argument type from int to my_bool for get_status Added variable allow_multiple_concurrent_insert, to signal if table supports multiple concurrent inserts mysql-test/r/maria-page-checksum.result: Added missing drop table mysql-test/t/maria-page-checksum.test: Added missing drop table mysys/my_handler.c: Added new error messages mysys/thr_lock.c: Added support for multiple concurrent inserts, if table handler supports it sql/sql_yacc.yy: Added LOCK TABLE table_name WRITE CONCURRENT This was added (temporarly?) to be able to check versioning with Maria storage/csv/ha_tina.cc: Updated parameter for get_status storage/maria/ha_maria.cc: Added calls to maria_chk_init_status() Fixed call to ma_control_file_open() storage/maria/ma_blockrec.c: Changed some LEX_STRING to LEX_CUSTRING to avoid casts and warnings Changed back some 'header' parameters to const char* Removed some casts Added support for versioning: - If info->row_flag & ROW_FLAG_TRANSID is set, store transaction id together with the row - When reading rows, check if rows are visible. Give error if not - When scanning table, ignore not visible rows - Added function parameters to some functions, to be able to call _ma_compact_block_page() with different parameters depending of if the page is a HEAD or TAIL page - _ma_compact_block_page() deletes transaction id's that are visible by all running transactions - Added functions for thr_lock() to enable multiple concurrent inserts - Added helper function 'mysql_versioning()' to enable/disable versioning - Added helper function maria_ignore_trids(), used by maria_chk and maria_pack to see all rows. storage/maria/ma_blockrec.h: Updated parameters for some functions. Added new functions to read/store state with thr_lock storage/maria/ma_check.c: Enable handling of transaction id's in rows Give a readable error if a table contains a transation id that makes rows not visible storage/maria/ma_control_file.c: Added option to not give warning if control file doesn't exists. storage/maria/ma_control_file.h: Updated parameter lists for ma_control_file_open() storage/maria/ma_delete.c: Removed not used variable (suggestion by Guilhem) storage/maria/ma_locking.c: Changed type of argument from int -> my_bool storage/maria/ma_open.c: Removed not used variables 'key_write_undo_lsn' and 'key_delete_undo_lsn' Added new thr_lock interface functions for BLOCK_RECORD to enable multiple concurrent insert storage/maria/ma_test1.c: Added option --versioning (-C) to check versioning storage/maria/ma_test2.c: Added option -C to check versioning storage/maria/ma_test_recovery: Forward argumetns to ma_test_recovery.pl storage/maria/ma_write.c: Removed not used variable key_write_undo_lsn storage/maria/maria_chk.c: Always read control file (if exist) at start Initialize checking of tables by calling maria_chk_init_for_check() In verbose mode and in case of error, print max found transaction id storage/maria/maria_def.h: Added Trid to MARIA_ROW to be able to check transaction id for found row Moved 'base_length' from MARIA_ROW to MARIA_HA to be able to handle different base length (with and without TRANSID) without if's Added default row_flag to MARIA_HA for the same reason Changed LEX_STRING -> LEX_CUSTRING to avoid casts in ma_blockrec.c Removed not needed variables key_write_undo_lsn and key_delete_undo_lsn Added prototypes for new functions and fixed those that had changed storage/maria/maria_pack.c: Ensure we can read all rows from the file, independent of the used transaction id storage/maria/maria_read_log.c: Updated arguments to ma_control_file_open() storage/maria/trnman.c: If we have only one transaction, fixed that min_read_from contains current transaction Fixed that trnman_can_read_from() returns that row is readable if it was written by current transaction storage/maria/unittest/ma_control_file-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_all-t: Added test of versioning Removed printing of one extra space storage/maria/unittest/ma_test_loghandler-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_multithread-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_noflush-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_nologs-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_loghandler_purge-t.c: Updated arguments to ma_control_file_open() storage/maria/unittest/ma_test_recovery.expected: Updated file with result from new tests storage/maria/unittest/ma_test_recovery.pl: Added options --abort-on-error and --verbose In case of --verbose, print all excuted shell commands Added test of versioning storage/myisam/mi_locking.c: Updated type of parameter storage/myisam/myisamdef.h: Updated type of parameter mysql-test/r/maria-mvcc.result: New BitKeeper file ``mysql-test/r/maria-mvcc.result'' mysql-test/t/maria-mvcc.test: New BitKeeper file ``mysql-test/t/maria-mvcc.test'' --- storage/csv/ha_tina.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'storage/csv') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 56d77c2b8b1..a4bd35776d5 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -715,7 +715,7 @@ const char **ha_tina::bas_ext() const for CSV engine. For more details see mysys/thr_lock.c */ -void tina_get_status(void* param, int concurrent_insert) +void tina_get_status(void* param, my_bool concurrent_insert) { ha_tina *tina= (ha_tina*) param; tina->get_status(); -- cgit v1.2.1 From 20739646d793d658d1ec6ded46e1d9b90f5d5fb4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Apr 2010 17:34:51 +0300 Subject: Maria WL#61 Interface for maria extensions. Alternative plugin interface with additional info (maturity and string version). CMakeLists.txt: Maria plugin interface used. config/ac-macros/plugins.m4: Maria plugin interface used. configure.in: Maria plugin interface used. include/mysql/plugin.h: Maria plugin interface added. include/mysql/plugin_auth.h.pp: Maria plugin interface added. plugin/auth/auth_socket.c: Maria plugin interface added. plugin/auth/dialog.c: Maria plugin interface added. plugin/daemon_example/daemon_example.cc: Maria plugin interface added. plugin/fulltext/plugin_example.c: Maria plugin interface added. sql/ha_ndbcluster.cc: Maria plugin interface added. sql/ha_partition.cc: Maria plugin interface added. sql/log.cc: Maria plugin interface added. sql/sql_acl.cc: Maria plugin interface added. sql/sql_builtin.cc.in: Maria plugin interface used. sql/sql_plugin.cc: Maria plugin interface added. sql/sql_plugin.h: Maria plugin interface used. sql/sql_show.cc: Maria plugin interface added. storage/archive/ha_archive.cc: Maria plugin interface added. storage/blackhole/ha_blackhole.cc: Maria plugin interface added. storage/csv/ha_tina.cc: Maria plugin interface added. storage/example/ha_example.cc: Maria plugin interface added. storage/federated/ha_federated.cc: Maria plugin interface added. storage/federatedx/ha_federatedx.cc: Maria plugin interface added. storage/heap/ha_heap.cc: Maria plugin interface added. storage/ibmdb2i/ha_ibmdb2i.cc: Maria plugin interface added. storage/innobase/handler/ha_innodb.cc: Maria plugin interface added. storage/innodb_plugin/handler/i_s.cc: Maria plugin interface added. storage/maria/ha_maria.cc: Maria plugin interface added. storage/myisam/ha_myisam.cc: Maria plugin interface added. storage/myisammrg/ha_myisammrg.cc: Maria plugin interface added. storage/pbxt/src/ha_pbxt.cc: Maria plugin interface added. storage/xtradb/handler/ha_innodb.cc: Maria plugin interface added. storage/xtradb/handler/i_s.cc: Maria plugin interface added. storage/xtradb/handler/i_s.h: Maria plugin interface added. --- storage/csv/ha_tina.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'storage/csv') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 3fda2239b34..162793b0222 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1636,4 +1636,20 @@ mysql_declare_plugin(csv) NULL /* config options */ } mysql_declare_plugin_end; - +maria_declare_plugin(csv) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &csv_storage_engine, + "CSV", + "Brian Aker, MySQL AB", + "CSV storage engine", + PLUGIN_LICENSE_GPL, + tina_init_func, /* Plugin Init */ + tina_done_func, /* Plugin Deinit */ + 0x0100 /* 1.0 */, + NULL, /* status variables */ + NULL, /* system variables */ + "1.0", /* string version */ + MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ +} +maria_declare_plugin_end; -- cgit v1.2.1 From 5a2f40d48a6fda6b83f788a0f849299bd44b621e Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Jun 2010 03:48:11 +0300 Subject: Fixes for Opensolaris (to get buildbot green) - Fixed memory leaks in mysqldump - Fixed printf of NULL which caused crashes on OpenSolaris when using --debug - Fixed realloc() problem that caused out of memory when running mysqldump.test on OpenSolaris client/mysqldump.c: Fixed memory leaks Fixed printf of NULL which caused crashes on OpenSolaris when using --debug client/mysqltest.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug include/my_global.h: Added simple macro val_or_null() to simplify detecting of NULL strings for printf sql/handler.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug sql/sql_db.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug Removed testing of 'new_db_name' as this is guranteed never NULL sql/sql_show.cc: Fixed printf of NULL which caused crashes on OpenSolaris when using --debug storage/csv/ha_tina.cc: Fixed realloc() problem that caused out of memory when running mysqldump.test on OpenSolaris (OpenSolaris default malloc() can't handle a lot of reallocs() of strings that are growing one byte at a time) This did speed up logging to cvs with a magnitude for large strings. --- storage/csv/ha_tina.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'storage/csv') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 8a30467f16c..e013440ecca 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -489,6 +489,9 @@ int ha_tina::encode_quote(uchar *buf) ptr= attribute.ptr(); end_ptr= attribute.length() + ptr; + if (buffer.realloc(attribute.length()*2+2)) + return 0; // Failure + buffer.append('"'); while (ptr < end_ptr) -- cgit v1.2.1 From f7d6a2ed654949f662da0a8c33f8e85b6d9e7f41 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Jun 2010 10:33:00 +0300 Subject: Fixed trival bug introduced in last patch (buffer was not extended) --- storage/csv/ha_tina.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'storage/csv') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index e013440ecca..4a9754922e5 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -489,7 +489,11 @@ int ha_tina::encode_quote(uchar *buf) ptr= attribute.ptr(); end_ptr= attribute.length() + ptr; - if (buffer.realloc(attribute.length()*2+2)) + /* + Ensure that buffer is big enough. This will also speed things up + as we don't have to do any new allocation in the loop below + */ + if (buffer.realloc(buffer.length() + attribute.length()*2+2)) return 0; // Failure buffer.append('"'); -- cgit v1.2.1 From 44fec70b7968778808673d9668c5fe08da03a7ca Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 9 Sep 2010 15:35:47 +0200 Subject: build dynamic plugins with the -shared libtool option to avoid double compilation --- storage/csv/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'storage/csv') diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 3a00ae85e20..75ad9062984 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -32,7 +32,7 @@ noinst_HEADERS = ha_tina.h transparent_file.h EXTRA_LTLIBRARIES = ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN +ha_csv_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_PLUGIN ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_LIBRARIES = libcsv.a -- cgit v1.2.1