Bug #14417 RBR: Thread-safety and table maps

Submitted: 28 Oct 2005 8:55 Modified: 1 Dec 2005 19:30
Reporter: Mats Kindahl Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0-wl1012 OS:Any (ALL)
Assigned to: Mats Kindahl CPU Architecture:Any

[28 Oct 2005 8:55] Mats Kindahl
Description:
Situation
---------

When executing, it is necessary to decide if the current table is
mapped or require new table-map event to be generated.  All table maps
are invalidated at the end of a transaction (or statement, if
autocommit is on), so by keeping a table map version for each table
and the binary log, it is possible to detect if the last table map
event was generated for an earlier transaction.

Problems
--------

**Guilhem [regarding get_table_id()]**: what if tid was !=
table_mapping::NO_TABLE and has just been set to == by another thread,
under mutex? the read-without-mutex here may see the old, !=, and thus
the function will wrongly do nothing?

**Guilhem [regarding update_table_map_version()]**: I have noted in
several places that there is a LOCK_log mutex missing (for example in
the incrementation above).

Question
--------

Is there a problem with the scheme regarding thread-safety?

How to repeat:
Code inspection.
[24 Nov 2005 20:31] Mats Kindahl
There is a race condition where a Query_log_event can be inserted between a Table_map_log_event and the corresponding Rows_log_event. The reason is that there is no single lock that protects the sequence of generating these two events. This thread-insafety was noted elsewhere, but is added to this bug since it is related to the use of table maps and table map versions.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.