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

[#4765] fix node name to be harmonized with xa node name #4806

Merged

Conversation

ochaloup
Copy link
Contributor

fixes #4765

Narayana node name needs to be correctly set and it should be documented what it's for in the Quarkus documentation.

@ochaloup
Copy link
Contributor Author

@tomjenkinson would you be so kind and check this PR?

@ochaloup ochaloup force-pushed the issue4765-harmonise-node-name-xa-node-name branch 2 times, most recently from c56e421 to e51cd28 Compare October 24, 2019 08:16
@@ -23,7 +25,8 @@ public void setNodeName(final TransactionManagerConfiguration transactions) {

try {
arjPropertyManager.getCoreEnvironmentBean().setNodeIdentifier(transactions.nodeName);
TxControl.setXANodeName(transactions.xaNodeName.orElse(transactions.nodeName));
jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Collections.singletonList(transactions.nodeName));
TxControl.setXANodeName(transactions.nodeName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we genuinely need the TxControl setting here? I would imagine it can be controlled through the arjPropertyManager directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the problematic issue of the whole narayana configuration. Once the TxControl class is first initialized (and that's decision of the JVM, not possible to be influence. normally the TxControl is initialized as class when accessed first time) then any change done in the arjPropertyManager has no effect for the further use.
As we can't be sure what setter is started first or where the TxControl data is needed for the first time during Quarkus startup I consider this as the safe way (or maybe even necessary).

A bit related point is that I created a jira about rethinking the configuration of the whole Narayana. That came from discussion with @mmusgrov, here https://issues.jboss.org/browse/JBTM-3215

Copy link
Contributor

Choose a reason for hiding this comment

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

What we do have to be certain of is there are no transactions that could be created before this is called and indeed the recovery manager has not started running before it. Are you sure that is the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'm not sure if it's the case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that this code must run before the transaction service is created? In which case I would expect no transactions could be created before this runs? Or is that not the case in Quarkus? IOW could there be a transaction created with the default (non-unique) node ID and that could therefore lead to data integrity issue?

/cc @mmusgrov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tomjenkinson the need of use TxControl.setXANodeName is not caused by time when the transaction service is created. The need is caused by the fact that we can't be sure that nobody else calls the TxControl setter. When it happens then all data are initialized. When this method is called after the setter was used before then changes in the bean have no effect.

In summary, by me the TxControl call is needed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for confirming. I suppose you are less concerned about the setter being called (which as you say it is public) but rather when the class is loaded it will read the value as set in the arjPropertyManager: https://github.com/jbosstm/narayana/blob/master/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java#L238

In that case, I understand the point - thanks!

@@ -46,6 +49,7 @@ public void setDefaultProperties(Properties properties) {

public void setDefaultTimeout(TransactionManagerConfiguration transactions) {
transactions.defaultTransactionTimeout.ifPresent(defaultTimeout -> {
arjPropertyManager.getCoordinatorEnvironmentBean().setDefaultTimeout((int) defaultTimeout.getSeconds());
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 - could the TxControl statement immediately following be removed too do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I assume it can't be. Just pointing that for WFLY we need to call TxControl. But WFLY configuration is more dynamic, so there it could be truly obvious.

@ochaloup ochaloup force-pushed the issue4765-harmonise-node-name-xa-node-name branch from e51cd28 to 2418c29 Compare November 5, 2019 17:00
Copy link
Member

@Sanne Sanne left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@Sanne Sanne added the backport? label Nov 7, 2019
@Sanne Sanne modified the milestones: 1.0.0.Final, 1.1.0 Nov 7, 2019
@Sanne Sanne merged commit 6f162de into quarkusio:master Nov 7, 2019
gsmet added a commit to gsmet/quarkus that referenced this pull request Nov 14, 2019
@gsmet gsmet removed the backport? label Nov 14, 2019
@gsmet gsmet modified the milestones: 1.1.0, 1.0.0.Final Nov 14, 2019
jmartisk pushed a commit to jmartisk/quarkus that referenced this pull request Nov 15, 2019
ia3andy pushed a commit to dmlloyd/quarkus that referenced this pull request Nov 19, 2019
Simulant87 pushed a commit to Simulant87/quarkus that referenced this pull request Nov 23, 2019
Simulant87 pushed a commit to Simulant87/quarkus that referenced this pull request Nov 23, 2019
mmusgrov pushed a commit to mmusgrov/quarkus that referenced this pull request Dec 13, 2019
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.

narayana-jta extension: harmonise the node name and the xa node name to a single value
4 participants