summaryrefslogtreecommitdiff
path: root/sql/structs.h
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-11-03 20:45:52 +0300
committerKonstantin Osipov <kostja@sun.com>2009-11-03 20:45:52 +0300
commit409160e4668faab964892fa9a8082be4482e8dac (patch)
treeec0ceb4d9e1f2553a541ffe6bbca3a5fef4381d0 /sql/structs.h
parent273f9b633c9487107f51cfc668e4aa0067e41e8d (diff)
parentd2babeaf3a68d15ac81c72b89be4a6196426dfbd (diff)
downloadmariadb-git-409160e4668faab964892fa9a8082be4482e8dac.tar.gz
A fix and a test case for
Bug#41756 "Strange error messages about locks from InnoDB". In JT_EQ_REF (join_read_key()) access method, don't try to unlock rows in the handler, unless certain that a) they were locked b) they are not used. Unlocking of rows is done by the logic of the nested join loop, and is unaware of the possible caching that the access method may have. This could lead to double unlocking, when a row was unlocked first after reading into the cache, and then when taken from cache, as well as to unlocking of rows which were actually used (but taken from cache). Delegate part of the unlocking logic to the access method, and in JT_EQ_REF count how many times a record was actually used in the join. Unlock it only if it's usage count is 0. Implemented review comments.
Diffstat (limited to 'sql/structs.h')
-rw-r--r--sql/structs.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/structs.h b/sql/structs.h
index a58c18f97c5..2546d241059 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -115,16 +115,22 @@ typedef struct st_reginfo { /* Extra info about reg */
} REGINFO;
-struct st_read_record; /* For referense later */
class SQL_SELECT;
class THD;
class handler;
+struct st_join_table;
+
+void rr_unlock_row(st_join_table *tab);
-typedef struct st_read_record { /* Parameter to read_record */
+struct READ_RECORD { /* Parameter to read_record */
+ typedef int (*Read_func)(READ_RECORD*);
+ typedef void (*Unlock_row_func)(st_join_table *);
struct st_table *table; /* Head-form */
handler *file;
struct st_table **forms; /* head and ref forms */
- int (*read_record)(struct st_read_record *);
+
+ Read_func read_record;
+ Unlock_row_func unlock_row;
THD *thd;
SQL_SELECT *select;
uint cache_records;
@@ -136,7 +142,7 @@ typedef struct st_read_record { /* Parameter to read_record */
uchar *cache,*cache_pos,*cache_end,*read_positions;
IO_CACHE *io_cache;
bool print_error, ignore_not_found_rows;
-} READ_RECORD;
+};
/*