Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Created October 17, 2011 08:44
Show Gist options
  • Select an option

  • Save kazeburo/1292215 to your computer and use it in GitHub Desktop.

Select an option

Save kazeburo/1292215 to your computer and use it in GitHub Desktop.
diff -ur mysql-4.0.30.o/sql/ha_innodb.cc mysql-4.0.30/sql/ha_innodb.cc
--- mysql-4.0.30.o/sql/ha_innodb.cc 2007-02-13 04:38:48.000000000 +0900
+++ mysql-4.0.30/sql/ha_innodb.cc 2011-10-17 17:40:07.000000000 +0900
@@ -4985,6 +4985,21 @@
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
+ if (lock_type == TL_READ && thd->in_lock_tables) {
+ /* We come here if MySQL is processing LOCK TABLES
+ ... READ LOCAL. MyISAM under that table lock type
+ reads the table as it was at the time the lock was
+ granted (new inserts are allowed, but not seen by the
+ reader). To get a similar effect on an InnoDB table,
+ we must use LOCK TABLES ... READ. We convert the lock
+ type here, so that for InnoDB, READ LOCAL is
+ equivalent to READ. This will change the InnoDB
+ behavior in mysqldump, so that dumps of InnoDB tables
+ are consistent with dumps of MyISAM tables. */
+
+ lock_type = TL_READ_NO_INSERT;
+ }
+
/* If we are not doing a LOCK TABLE, then allow multiple
writers */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment