Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

Add Sentinel MyBatis adapter module

Open kaizi2009 opened this issue 6 years ago • 11 comments

Resolves #1113

Why we need it?

Database needs sentinel, because:

In most cases, the bottleneck of the system is the database. Although there are web or rpc sentinel, but some unimportant requests occupy database resources.

How to verify it?

Implements org.apache.ibatis.plugin.Interceptor

Junit:

module: sentinel-adapter/sentinel-mybatis-adapter com.alibaba.csp.sentinel.adapter.mybatis.test.TestMapperInterceptor com.alibaba.csp.sentinel.adapter.mybatis.test.TestMybatisTransactional com.alibaba.csp.sentinel.adapter.mybatis.test.TestReadInterceptor com.alibaba.csp.sentinel.adapter.mybatis.test.TestTotalInterceptor com.alibaba.csp.sentinel.adapter.mybatis.test.TestWriteInterceptor

kaizi2009 avatar Oct 26 '19 15:10 kaizi2009

Codecov Report

Merging #1118 into master will increase coverage by 0.05%. The diff coverage is 56.60%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1118      +/-   ##
============================================
+ Coverage     43.53%   43.59%   +0.05%     
- Complexity     1677     1695      +18     
============================================
  Files           364      371       +7     
  Lines         10492    10543      +51     
  Branches       1409     1414       +5     
============================================
+ Hits           4568     4596      +28     
- Misses         5365     5384      +19     
- Partials        559      563       +4     
Impacted Files Coverage Δ Complexity Δ
...ibaba/csp/sentinel/slots/block/BlockException.java 44.44% <8.33%> (-9.85%) 10.00 <2.00> (+2.00) :arrow_down:
...nel/adapter/mybatis/SentinelMapperInterceptor.java 41.66% <41.66%> (ø) 3.00 <3.00> (?)
...l/adapter/mybatis/AbstractSentinelInterceptor.java 73.68% <73.68%> (ø) 5.00 <5.00> (?)
...dapter/mybatis/SentinelCommandTypeInterceptor.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...tinel/adapter/mybatis/SentinelReadInterceptor.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...ntinel/adapter/mybatis/SentinelSqlInterceptor.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...inel/adapter/mybatis/SentinelTotalInterceptor.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...inel/adapter/mybatis/SentinelWriteInterceptor.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)
...ava/com/alibaba/csp/sentinel/node/ClusterNode.java 96.55% <0.00%> (-3.45%) 10.00% <0.00%> (-1.00%)
...tinel/slots/block/flow/param/ParamFlowChecker.java 55.70% <0.00%> (-0.68%) 29.00% <0.00%> (-1.00%)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update be4d058...c3de882. Read the comment docs.

codecov-io avatar Oct 26 '19 16:10 codecov-io

Could you please also sync your code with the master branch?

sczyh30 avatar Jan 15 '20 02:01 sczyh30

Could you please also sync your code with the master branch?

OK.

kaizi2009 avatar Jan 15 '20 14:01 kaizi2009

Could you please also sync your code with the master branch?

OK.

@kaizi2009 Hi, any progress?

sczyh30 avatar Feb 18 '20 06:02 sczyh30

Friendly ping :)

sczyh30 avatar Mar 26 '20 05:03 sczyh30

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 30 '20 13:03 CLAassistant

Could you please also sync your code with the master branch?

OK.

@kaizi2009 Hi, any progress?

Done. Sorry, I'm busy these days.

kaizi2009 avatar Mar 30 '20 16:03 kaizi2009

@sczyh30 Please review the code.

kaizi2009 avatar Aug 12 '21 12:08 kaizi2009

@sczyh30 Please review the code. ( ^___^ )

kaizi2009 avatar Sep 07 '21 07:09 kaizi2009

@sczyh30 Merging is blocked。What do I need to do next?

kaizi2009 avatar Apr 28 '22 07:04 kaizi2009

Still in progress?

ddavidzhang avatar Jan 15 '25 07:01 ddavidzhang

This appears to be a practical adapter, but we're closing this PR due to prolonged inactivity. If you'd like to continue contributing, feel free to create a new PR based on the 1.8 branch and we'll prioritize processing it promptly.

LearningGp avatar Oct 09 '25 02:10 LearningGp