summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2006-02-16 08:30:53 +0100
committerunknown <mats@mysql.com>2006-02-16 08:30:53 +0100
commit41f7d138539c01afbcb6efb2f772fae0e9c3cd05 (patch)
tree24121bf489f59c8a8cbd3d4c0e587c27e3a9e0ed /sql/sql_class.h
parenta89c10fd9b79a5d4eb42ae7d7ac00130919f456f (diff)
downloadmariadb-git-41f7d138539c01afbcb6efb2f772fae0e9c3cd05.tar.gz
WL#3023 (Use locks in a statement-like manner):
Table maps are now written on aquiring locks to tables and released at the end of each logical statement. mysql-test/extra/binlog_tests/ctype_cp932.test: Disabling cleanup code mysql-test/r/binlog_row_blackhole.result: Result change mysql-test/r/binlog_row_mix_innodb_myisam.result: Result change mysql-test/r/binlog_stm_ctype_cp932.result: Result change mysql-test/r/rpl_row_charset.result: Result change mysql-test/r/rpl_row_create_table.result: Result change mysql-test/t/rpl_row_create_table.test: Binlog position change sql/handler.cc: Writing table map after external_lock() sql/handler.h: Adding class for table operation hooks. sql/log.cc: Adding binlog_write_table_map() to THD. Removing write_table_map() from MYSQL_LOG. sql/log.h: Minor interface changes to move table map writing. sql/log_event.cc: Removing pre-allocation of memory for buffers. Allowing ULONG_MAX as table id denoting an event to ignore (only used to transfer flags). Adding code to collect tables while seeing table maps and lock collected tables when seeing a binrow event. Debriding code as a result of the above changes. sql/log_event.h: Minor interface changes. sql/mysql_priv.h: Adding hooks argument to create_table_from_items(). sql/parse_file.cc: Minor fix to avoid crash in debug printout. sql/rpl_rli.h: Adding list of tables to lock to RLI structure. sql/slave.cc: Using list of tables to lock from RLI structure. sql/sql_acl.cc: Removing redundant pending events flush. sql/sql_base.cc: Moving pending event flush. Using flag to guard to clear statement transaction only if this is the original open tables state. sql/sql_class.cc: Adding flag for open tables state. Removing redundant pending events flushes. Write a dummy event to indicate that the tables to lock should be emptied on the slave. sql/sql_class.h: Adding open tables state flags. Adding binlog_write_table_map() function to THD. Changes to select_create() to support new locking scheme. sql/sql_insert.cc: Adding rollback of statement transaction on error. It can now contain events after locking tables. sql/sql_load.cc: Removing redundant pending event flush. sql/sql_table.cc: Adding hooks argument to create_table_from_items(). Calling prelock hook before starting to lock tables. sql/sql_update.cc: Removing a compiler warning. sql/table.h: Minor changes.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index cb8c2818a19..742d12f4376 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -735,11 +735,20 @@ public:
ulong version;
uint current_tablenr;
+ enum enum_flags {
+ BACKUPS_AVAIL = (1U << 0) /* There are backups available */
+ };
+
+ /*
+ Flags with information about the open tables state.
+ */
+ uint state_flags;
+
/*
This constructor serves for creation of Open_tables_state instances
which are used as backup storage.
*/
- Open_tables_state() {};
+ Open_tables_state() : state_flags(0U) { }
Open_tables_state(ulong version_arg);
@@ -753,6 +762,7 @@ public:
open_tables= temporary_tables= handler_tables= derived_tables= 0;
lock= locked_tables= 0;
prelocked_mode= NON_PRELOCKED;
+ state_flags= 0U;
}
};
@@ -900,8 +910,9 @@ public:
#ifndef MYSQL_CLIENT
/*
- Public interface to write rows to the binlog
+ Public interface to write RBR events to the binlog
*/
+ int binlog_write_table_map(TABLE *table, bool is_transactional);
int binlog_write_row(TABLE* table, bool is_transactional,
MY_BITMAP const* cols, my_size_t colcnt,
const byte *buf);
@@ -945,6 +956,11 @@ public:
int binlog_flush_pending_rows_event(bool stmt_end);
void binlog_delete_pending_rows_event();
+private:
+ uint binlog_table_maps; // Number of table maps currently in the binlog
+
+public:
+
#endif
#endif /* HAVE_ROW_BASED_REPLICATION */
#ifndef MYSQL_CLIENT
@@ -1543,7 +1559,6 @@ class select_create: public select_insert {
HA_CREATE_INFO *create_info;
MYSQL_LOCK *lock;
Field **field;
- bool create_table_written;
public:
select_create (TABLE_LIST *table,
HA_CREATE_INFO *create_info_par,
@@ -1552,11 +1567,11 @@ public:
List<Item> &select_fields,enum_duplicates duplic, bool ignore)
:select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore), create_table(table),
extra_fields(&fields_par),keys(&keys_par), create_info(create_info_par),
- lock(0), create_table_written(FALSE)
+ lock(0)
{}
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
- void binlog_show_create_table();
+ void binlog_show_create_table(TABLE **tables, uint count);
void store_values(List<Item> &values);
void send_error(uint errcode,const char *err);
bool send_eof();