上下文:使用的框架是 Spring,所有查询都使用 JdbcTemplate 运行。Mysql Server 版本为 5.6.19。这table是一个InnoDB table和默认值,并且设置了auto commit隔离级别可重复读取。
问题:Insert一个事务发生在一个事务中select,读取插入的相同数据的一个没有看到数据。在select运行后,在insert之后的insert交易都有commited。
我在 mysql 中启用了 bin 日志和一般日志。相关日志如下
二进制日志:
SET TIMESTAMP=1438265764/*!*/;
BEGIN
/*!*/;
# at 249935389
#150730 14:16:04 server id 1 end_log_pos 249935606 CRC32 0xa6aca292 Query thread_id=40 exec_time=0 error_code=0
SET TIMESTAMP=1438265764/*!*/;
insert into user_geo_loc_latest(user_id, lat, lng) values(x,y,z) on duplicate key update lat=y, lng=z
/*!*/;
# at 249935606
#150730 14:16:06 server id 1 …Run Code Online (Sandbox Code Playgroud)