diff options
author | unknown <jan@hundin.mysql.fi> | 2004-07-21 08:52:12 +0300 |
---|---|---|
committer | unknown <jan@hundin.mysql.fi> | 2004-07-21 08:52:12 +0300 |
commit | 9891d053559712110e4f4d9cccc39c409e42788a (patch) | |
tree | 1f631bc932932418044d890568d4784a5abd04f6 | |
parent | bf95f9195fe431841fe1e29e6b82c9f47ec52ad3 (diff) | |
parent | 238b226f2626573021103872b85d54a79c5743ea (diff) | |
download | mariadb-git-9891d053559712110e4f4d9cccc39c409e42788a.tar.gz |
Merge jlindstrom@build.mysql.com:/home/bk/mysql-4.1
into hundin.mysql.fi:/home/jan/mysql-4.1
innobase/include/srv0srv.h:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
sql/ha_innodb.cc:
Auto merged
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | innobase/include/srv0srv.h | 1 | ||||
-rw-r--r-- | innobase/row/row0sel.c | 83 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 4 | ||||
-rw-r--r-- | sql/ha_innodb.cc | 2 | ||||
-rw-r--r-- | sql/ha_innodb.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 5 | ||||
-rw-r--r-- | sql/set_var.cc | 1 |
8 files changed, 91 insertions, 8 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 398a9295579..a9cb6429a35 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -61,6 +61,7 @@ hf@genie.(none) igor@hundin.mysql.fi igor@rurik.mysql.com ingo@mysql.com +jan@hundin.mysql.fi jani@a80-186-24-72.elisa-laajakaista.fi jani@dsl-jkl1657.dial.inet.fi jani@dsl-kpogw4gb5.dial.inet.fi diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index c7ba39aaaf1..caee374d2ef 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -42,6 +42,7 @@ extern char* srv_arch_dir; #endif /* UNIV_LOG_ARCHIVE */ extern ibool srv_file_per_table; +extern ibool srv_locks_unsafe_for_binlog; extern ulint srv_n_data_files; extern char** srv_data_file_names; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 8a0da2851a7..bf7f6f1fc3a 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -631,10 +631,24 @@ row_sel_get_clust_rec( if (!node->read_view) { /* Try to place a lock on the index record */ - + + /* If innodb_locks_unsafe_for_binlog option is used, + we lock only the record, i.e. next-key locking is + not used. + */ + if ( srv_locks_unsafe_for_binlog ) + { + err = lock_clust_rec_read_check_and_lock(0, clust_rec, + index,node->row_lock_mode, LOCK_REC_NOT_GAP, thr); + } + else + { err = lock_clust_rec_read_check_and_lock(0, clust_rec, index, node->row_lock_mode, LOCK_ORDINARY, thr); - if (err != DB_SUCCESS) { + + } + + if (err != DB_SUCCESS) { return(err); } @@ -1184,9 +1198,23 @@ rec_loop: search result set, resulting in the phantom problem. */ if (!consistent_read) { + + /* If innodb_locks_unsafe_for_binlog option is used, + we lock only the record, i.e. next-key locking is + not used. + */ + + if ( srv_locks_unsafe_for_binlog ) + { + err = sel_set_rec_lock(page_rec_get_next(rec), index, + node->row_lock_mode, LOCK_REC_NOT_GAP, thr); + } + else + { err = sel_set_rec_lock(page_rec_get_next(rec), index, node->row_lock_mode, LOCK_ORDINARY, thr); - if (err != DB_SUCCESS) { + } + if (err != DB_SUCCESS) { /* Note that in this case we will store in pcur the PREDECESSOR of the record we are waiting the lock for */ @@ -1211,8 +1239,22 @@ rec_loop: if (!consistent_read) { /* Try to place a lock on the index record */ - err = sel_set_rec_lock(rec, index, node->row_lock_mode, + /* If innodb_locks_unsafe_for_binlog option is used, + we lock only the record, i.e. next-key locking is + not used. + */ + + if ( srv_locks_unsafe_for_binlog ) + { + err = sel_set_rec_lock(rec, index, node->row_lock_mode, + LOCK_REC_NOT_GAP, thr); + } + else + { + err = sel_set_rec_lock(rec, index, node->row_lock_mode, LOCK_ORDINARY, thr); + } + if (err != DB_SUCCESS) { goto lock_wait_or_error; @@ -3144,10 +3186,24 @@ rec_loop: /* Try to place a lock on the index record */ - err = sel_set_rec_lock(rec, index, + /* If innodb_locks_unsafe_for_binlog option is used, + we lock only the record, i.e. next-key locking is + not used. + */ + if ( srv_locks_unsafe_for_binlog ) + { + err = sel_set_rec_lock(rec, index, + prebuilt->select_lock_type, + LOCK_REC_NOT_GAP, thr); + } + else + { + err = sel_set_rec_lock(rec, index, prebuilt->select_lock_type, LOCK_ORDINARY, thr); - if (err != DB_SUCCESS) { + } + + if (err != DB_SUCCESS) { goto lock_wait_or_error; } @@ -3300,9 +3356,22 @@ rec_loop: prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr); } else { - err = sel_set_rec_lock(rec, index, + /* If innodb_locks_unsafe_for_binlog option is used, + we lock only the record, i.e. next-key locking is + not used. + */ + if ( srv_locks_unsafe_for_binlog ) + { + err = sel_set_rec_lock(rec, index, + prebuilt->select_lock_type, + LOCK_REC_NOT_GAP, thr); + } + else + { + err = sel_set_rec_lock(rec, index, prebuilt->select_lock_type, LOCK_ORDINARY, thr); + } } if (err != DB_SUCCESS) { diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 4bc5b0dc795..813adbc0e43 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -77,6 +77,10 @@ ibool srv_file_per_table = FALSE; /* store to its own file each table created by an user; data dictionary tables are in the system tablespace 0 */ +ibool srv_locks_unsafe_for_binlog = FALSE; /* Place locks to records only + i.e. do not use next-key locking + except on duplicate key checking and + foreign key checking */ ulint srv_n_data_files = 0; char** srv_data_file_names = NULL; ulint* srv_data_file_sizes = NULL; /* size in database pages */ diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 21a2e338812..c06448647d5 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -117,6 +117,7 @@ my_bool innobase_log_archive = FALSE;/* unused */ my_bool innobase_use_native_aio = FALSE; my_bool innobase_fast_shutdown = TRUE; my_bool innobase_file_per_table = FALSE; +my_bool innobase_locks_unsafe_for_binlog = FALSE; static char *internal_innobase_data_file_path = NULL; @@ -908,6 +909,7 @@ innobase_init(void) srv_fast_shutdown = (ibool) innobase_fast_shutdown; srv_file_per_table = (ibool) innobase_file_per_table; + srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog; srv_max_n_open_files = (ulint) innobase_open_files; diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index e09697f7ce6..6815bdd632d 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -189,7 +189,7 @@ extern char *innobase_unix_file_flush_method; /* The following variables have to be my_bool for SHOW VARIABLES to work */ extern my_bool innobase_log_archive, innobase_use_native_aio, innobase_fast_shutdown, - innobase_file_per_table; + innobase_file_per_table, innobase_locks_unsafe_for_binlog; extern "C" { extern ulong srv_max_buf_pool_modified_pct; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4fd13d33bab..869048cee93 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3880,6 +3880,7 @@ enum options_mysqld OPT_INNODB_FLUSH_METHOD, OPT_INNODB_FAST_SHUTDOWN, OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB, + OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG, OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_SKIP_SAFEMALLOC, OPT_TEMP_POOL, OPT_TX_ISOLATION, @@ -4156,6 +4157,10 @@ Disable with --skip-bdb (will save memory).", "Stores each InnoDB table to an .ibd file in the database dir.", (gptr*) &innobase_file_per_table, (gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"innodb_locks_unsafe_for_binlog", OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, + "Force Innodb not to use next-key locking. Instead use only row-level locking", + (gptr*) &innobase_locks_unsafe_for_binlog, + (gptr*) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* End HAVE_INNOBASE_DB */ {"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection", (gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC, diff --git a/sql/set_var.cc b/sql/set_var.cc index e1cfb77d297..fb9ff285859 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -673,6 +673,7 @@ struct show_var_st init_vars[]= { {"innodb_fast_shutdown", (char*) &innobase_fast_shutdown, SHOW_MY_BOOL}, {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG }, {"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL}, + {"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog, SHOW_MY_BOOL}, {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_INT}, {"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR}, {"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG }, |