Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: the redis lock key and the session key has conflict #3148

Merged
merged 2 commits into from
Sep 25, 2020
Merged

bugfix: the redis lock key and the session key has conflict #3148

merged 2 commits into from
Sep 25, 2020

Conversation

lightClouds917
Copy link
Contributor

Ⅰ. Describe what this PR did

the lock has this key,it is a name of hash:
private static final String DEFAULT_REDIS_SEATA_GLOBAL_LOCK_PREFIX = "SEATA_GLOBAL_LOCK";
the session has this key,it is a name of string:
private static final String DEFAULT_REDIS_SEATA_GLOBAL_PREFIX = "SEATA_GLOBAL_";

They have the same prefix :SEATA_GLOBAL_ ,the RedisTransactionStoreManager# public List<GlobalSession> readSession(GlobalStatus[] statuses) ,use the redis scan of key SEATA_GLOBAL_* to get(key).
It will cause:
redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value at redis.clients.jedis.Protocol.processError(Protocol.java:132) at redis.clients.jedis.Protocol.process(Protocol.java:166) at redis.clients.jedis.Protocol.read(Protocol.java:220) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:318) at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:255) at redis.clients.jedis.Connection.getBulkReply(Connection.java:245) at redis.clients.jedis.Jedis.get(Jedis.java:181) at io.seata.server.storage.redis.store.RedisTransactionStoreManager.readSession(RedisTransactionStoreManager.java:230) at io.seata.server.storage.redis.store.RedisTransactionStoreManager.readSession(RedisTransactionStoreManager.java:290) at io.seata.server.storage.redis.session.RedisSessionManager.findGlobalSessions(RedisSessionManager.java:188) at io.seata.server.storage.redis.session.RedisSessionManager.allSessions(RedisSessionManager.java:178) at io.seata.server.coordinator.DefaultCoordinator.timeoutCheck(DefaultCoordinator.java:216) at io.seata.server.coordinator.DefaultCoordinator.lambda$init$20(DefaultCoordinator.java:404) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java) at

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-commenter
Copy link

Codecov Report

Merging #3148 into develop will decrease coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3148      +/-   ##
=============================================
- Coverage      50.46%   50.33%   -0.13%     
  Complexity      3110     3110              
=============================================
  Files            593      593              
  Lines          19571    19570       -1     
  Branches        2427     2396      -31     
=============================================
- Hits            9876     9851      -25     
  Misses          8702     8702              
- Partials         993     1017      +24     
Impacted Files Coverage Δ Complexity Δ
...rage/redis/store/RedisTransactionStoreManager.java 36.36% <100.00%> (ø) 20.00 <1.00> (ø)
...obuf/convertor/BranchRegisterRequestConvertor.java 90.47% <0.00%> (-9.53%) 3.00% <0.00%> (ø%)
...otobuf/convertor/GlobalBeginResponseConvertor.java 92.59% <0.00%> (-7.41%) 3.00% <0.00%> (ø%)
...otobuf/convertor/GlobalCommitRequestConvertor.java 93.75% <0.00%> (-6.25%) 3.00% <0.00%> (ø%)
...otobuf/convertor/GlobalStatusRequestConvertor.java 93.75% <0.00%> (-6.25%) 3.00% <0.00%> (ø%)
...obuf/convertor/GlobalRollbackRequestConvertor.java 93.75% <0.00%> (-6.25%) 3.00% <0.00%> (ø%)
...protobuf/convertor/RegisterTMRequestConvertor.java 94.73% <0.00%> (-5.27%) 3.00% <0.00%> (ø%)
...protobuf/convertor/RegisterRMRequestConvertor.java 90.47% <0.00%> (-4.77%) 3.00% <0.00%> (ø%)
...otobuf/convertor/BranchReportRequestConvertor.java 95.45% <0.00%> (-4.55%) 3.00% <0.00%> (ø%)
...tobuf/convertor/BranchReportResponseConvertor.java 95.45% <0.00%> (-4.55%) 3.00% <0.00%> (ø%)
... and 17 more

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lightClouds917 lightClouds917 changed the title fix: lock session same key fix:the redis lock key and the session key has conflict Sep 24, 2020
Copy link
Contributor

@caohdgege caohdgege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for @caohdgege

@l81893521 l81893521 changed the title fix:the redis lock key and the session key has conflict bugfix: the redis lock key and the session key has conflict Sep 25, 2020
@l81893521 l81893521 merged commit 23924bb into apache:develop Sep 25, 2020
@slievrly slievrly added this to the 1.4.0 milestone Oct 10, 2020
l81893521 pushed a commit to l81893521/seata that referenced this pull request Oct 22, 2020
hicf pushed a commit to hicf/seata that referenced this pull request Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants