-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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: fix access key loss after server restart #5097
Merged
slievrly
merged 22 commits into
apache:develop
from
renliangyu857:bugfix_accesskey_loss_afterserverrestart
Nov 27, 2022
Merged
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2a09ddd
bugfix:fix access key loss after server restart
renliangyu857 2cb9648
Merge branch 'develop' into bugfix_accesskey_loss_afterserverrestart
slievrly 0ab7064
Merge branch 'develop' into bugfix_accesskey_loss_afterserverrestart
funky-eyes f1810b9
reconstruct
renliangyu857 c2aae48
throw exception when TmNettyRemotingClient#getInstance() returns null
renliangyu857 5b9a0ac
resolve test failure
renliangyu857 d61b8f5
Merge branch 'develop' into bugfix_accesskey_loss_afterserverrestart
renliangyu857 3a8354f
Merge branch 'develop' into bugfix_accesskey_loss_afterserverrestart
funky-eyes 115ec7d
Update TmNettyRemotingClient.java
renliangyu857 68d45d5
Update TmNettyClientTest.java
renliangyu857 fa4ad71
Update TmNettyClientTest.java
renliangyu857 4de0017
Update DefaultSagaTransactionalTemplate.java
renliangyu857 c4c8411
Update TMClient.java
renliangyu857 54eae20
Merge branch 'develop' into bugfix_accesskey_loss_afterserverrestart
xingfudeshi 62fe80d
retain ak/sk get/set method
renliangyu857 a624eea
Merge branch 'bugfix_accesskey_loss_afterserverrestart' of https://gi…
renliangyu857 ae94944
resolve test failure
renliangyu857 8b7197e
retain set/get accessKey
renliangyu857 d2dbbf1
Update TmNettyRemotingClient.java
renliangyu857 b045b28
Update TmNettyRemotingClient.java
renliangyu857 648eeeb
Update develop.md
renliangyu857 9f569ae
Update GlobalTransactionScanner.java
renliangyu857 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,6 @@ | |
|
||
import static io.seata.core.constants.ConfigurationKeys.EXTRA_DATA_KV_CHAR; | ||
import static io.seata.core.constants.ConfigurationKeys.EXTRA_DATA_SPLIT_CHAR; | ||
import static io.seata.core.constants.ConfigurationKeys.SEATA_ACCESS_KEY; | ||
import static io.seata.core.constants.ConfigurationKeys.SEATA_SECRET_KEY; | ||
|
||
/** | ||
* The rm netty client. | ||
|
@@ -67,8 +65,8 @@ public final class TmNettyRemotingClient extends AbstractNettyRemotingClient { | |
private String applicationId; | ||
private String transactionServiceGroup; | ||
private final AuthSigner signer; | ||
private String accessKey; | ||
private String secretKey; | ||
private final String accessKey = ConfigurationFactory.getInstance().getConfig(ConfigurationKeys.ACCESS_KEY,null); | ||
private final String secretKey = ConfigurationFactory.getInstance().getConfig(ConfigurationKeys.SECRET_KEY,null); | ||
|
||
|
||
private TmNettyRemotingClient(NettyClientConfig nettyClientConfig, | ||
|
@@ -99,24 +97,9 @@ public void onChangeEvent(ConfigurationChangeEvent event) { | |
* @return the instance | ||
*/ | ||
public static TmNettyRemotingClient getInstance(String applicationId, String transactionServiceGroup) { | ||
return getInstance(applicationId, transactionServiceGroup, null, null); | ||
} | ||
|
||
/** | ||
* Gets instance. | ||
* | ||
* @param applicationId the application id | ||
* @param transactionServiceGroup the transaction service group | ||
* @param accessKey the access key | ||
* @param secretKey the secret key | ||
* @return the instance | ||
*/ | ||
public static TmNettyRemotingClient getInstance(String applicationId, String transactionServiceGroup, String accessKey, String secretKey) { | ||
TmNettyRemotingClient tmRpcClient = getInstance(); | ||
tmRpcClient.setApplicationId(applicationId); | ||
tmRpcClient.setTransactionServiceGroup(transactionServiceGroup); | ||
tmRpcClient.setAccessKey(accessKey); | ||
tmRpcClient.setSecretKey(secretKey); | ||
return tmRpcClient; | ||
} | ||
|
||
|
@@ -162,32 +145,6 @@ public void setTransactionServiceGroup(String transactionServiceGroup) { | |
this.transactionServiceGroup = transactionServiceGroup; | ||
} | ||
|
||
/** | ||
* Sets access key. | ||
* | ||
* @param accessKey the access key | ||
*/ | ||
protected void setAccessKey(String accessKey) { | ||
if (null != accessKey) { | ||
this.accessKey = accessKey; | ||
return; | ||
} | ||
this.accessKey = System.getProperty(SEATA_ACCESS_KEY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is recommended to keep this part, but also to determine if it is null. 建议保留,但同样需要判空。 |
||
} | ||
|
||
/** | ||
* Sets secret key. | ||
* | ||
* @param secretKey the secret key | ||
*/ | ||
protected void setSecretKey(String secretKey) { | ||
if (null != secretKey) { | ||
this.secretKey = secretKey; | ||
return; | ||
} | ||
this.secretKey = System.getProperty(SEATA_SECRET_KEY); | ||
} | ||
|
||
@Override | ||
public void init() { | ||
// registry processor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to retain the method without the ak/sk parameter.
建议保留无ak/sk 参数的方法。