情况1:
重启服务后,新增数据的插入没有问题,数据库中能查到,但是项目中查询的结果是浮动的,
即偶尔查询正确,偶尔会出现本次重启服务后新增数据没查到,仅查询到原有数据(重启服务之前
已有的数据)的情况;
情况2:
在重启服务后,原有的数据不会出现查询时丢数据的情况;
情况3:
已上现象为整个项目中普遍存在的情况,即任意表都会出现上述情况;
情况4:
上述查询问题即使在不存在事务的简单查询中也存在;
附示例:
以下为筛选日志结果:
数据库记录数为3条,查询结果为2和3,并且一直持续存在;
、、、
[ERROR]-[Thread: 201712022233077548st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 20171202223308468Dst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233088862st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233093165st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223309843Fst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233102741st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233109243st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233116034st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233123791st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233130438st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233136847st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233144678st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223314845Cst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233152237st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223315588Est.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233159568st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 20171202223316739Bst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233173903st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233180297st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 20171202223318843Cst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233194784st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233201245st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223320520Fst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233210862st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233214528st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223321817Cst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233224558st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 20171202223323240Cst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 20171202223323909Dst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233245542st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233253420st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233259899st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223326365Fst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233267379st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233271049st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223327605Est.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233282475st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233288928st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233298680st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 20171202223330510Dst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233311501st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233319217st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223332300Ast.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 201712022233326794st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223333046Dst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===2
[ERROR]-[Thread: 20171202223333414Cst.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233342048st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233348460st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233354911st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
[ERROR]-[Thread: 201712022233362800st.ParameterRequest.printTheResponsePara()]: ===Para:[1, 2]===3
、、、
以下为查询结果为2时的查询sql
、、、
[20171202223331921753A0] [DEBUG] org.mybatis.spring.SqlSessionUtils - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@82fbac2]
[20171202223331921753A0] [DEBUG] org.mybatis.spring.SqlSessionUtils - Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@82fbac2] from current transaction
[20171202223331921753A0] [DEBUG] c.T.d.s.w.o.O.getOrdersForMulti - ==> Preparing: select * from orders
WHERE member_id
= ? and order_state
IN ( ? , ? ) order by id desc limit ?,?
[20171202223331921753A0] [DEBUG] c.T.d.s.w.o.O.getOrdersForMulti - ==> Parameters: 24(String), 1(Integer), 2(Integer), 0(Integer), 10(Integer)
[20171202223331921753A0] [DEBUG] c.T.d.s.w.o.O.getOrdersForMulti - <== Total: 2
、、、
以下为查询结果为3时的查询sql
、、、
[20171202223333414C2A60] [DEBUG] o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
[20171202223333414C2A60] [DEBUG] o.m.s.t.SpringManagedTransaction - JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@708060c1] will not be managed by Spring
[20171202223333414C2A60] [DEBUG] c.T.d.s.w.o.O.getOrdersForMulti - ==> Preparing: select * from orders
WHERE member_id
= ? and order_state
IN ( ? , ? ) order by id desc limit ?,?
[20171202223333414C2A60] [DEBUG] c.T.d.s.w.o.O.getOrdersForMulti - ==> Parameters: 24(String), 1(Integer), 2(Integer), 0(Integer), 10(Integer)
[20171202223333414C2A60] [DEBUG] c.T.d.s.w.o.O.getOrdersForMulti - <== Total: 3
[20171202223333414C2A60] [DEBUG] org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3103e6df]
[20171202223333414C2A60] [DEBUG] o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
[20171202223333414C2A60] [DEBUG] org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession
[20171202223333414C2A60] [DEBUG] org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@222f700b] was not registered for synchronization because synchronization is not active
、、、