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

If the node name is longer than 28 bytes, shorten it with SHA-224 #36752

Merged

Conversation

turing85
Copy link
Contributor

Resolves #30491

@quarkus-bot quarkus-bot bot added the area/narayana Transactions / Narayana label Oct 27, 2023
Copy link
Contributor

@mmusgrov mmusgrov left a comment

Choose a reason for hiding this comment

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

Thanks

@turing85
Copy link
Contributor Author

@mmusgrov you're welcome 🙂

@quarkus-bot

This comment has been minimized.

Copy link
Contributor

@mmusgrov mmusgrov left a comment

Choose a reason for hiding this comment

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

Since approving the PR I've received some concerns about this change. The requests are:

  • to change the log message from info to warn
  • to ask users to opt into the change via a config property that controls whether or not shortening of the node id should be allowed

In addition, we have a similar problem in WildFly and Narayana so I will start a discussion in the narayana-users forum about adding the feature to Narayana so that all runtimes can benefit from the change.

@turing85
Copy link
Contributor Author

Since approving the PR I've received some concerns about this change. The requests are:

* to change the log message from info to warn

* to ask users to opt into the change via a config property that controls whether or not shortening of the node id should be allowed

In addition, we have a similar problem in WildFly and Narayana so I will start a discussion in the narayana-users forum about adding the feature to Narayana so that all runtimes can benefit from the change.

So... should I implement those changes, or do we want to wait for the result of the discussion?

@mmusgrov
Copy link
Contributor

So... should I implement those changes, or do we want to wait for the result of the discussion?

Personally I'd say that the only one up for debate is the default value for the property. If the default is to fail the boot, the current behaviour, then the user will detect the issue during the commissioning phase so I'd maybe lean a little in that direction, besides, it would minimise surprise for existing users. Let's give people a couple of days to respond and if nothing is forthcoming then we should decide.

@marcosgopen
Copy link
Contributor

marcosgopen commented Oct 31, 2023

So... should I implement those changes, or do we want to wait for the result of the discussion?

Personally I'd say that the only one up for debate is the default value for the property. If the default is to fail the boot, the current behaviour, then the user will detect the issue during the commissioning phase so I'd maybe lean a little in that direction, besides, it would minimise surprise for existing users. Let's give people a couple of days to respond and if nothing is forthcoming then we should decide.

I agree with Mike. I think that the default behaviour of the property is to fail the boot. If user want to change this behaviour they need to change the value of the property, in this way they will be aware that the 'node name' might change (when longer than 28 bytes) from the expected one because it will be shorten with SHA-224.

@turing85 turing85 force-pushed the feature/30491-shorten-node-name-if-necessary branch from e29d3a8 to 07b3a4c Compare October 31, 2023 18:39
@turing85
Copy link
Contributor Author

@mmusgrov I added the changes (they were minimal). The property name is of course up to debate, but the change is trivial.

Copy link

quarkus-bot bot commented Oct 31, 2023

✔️ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Copy link
Contributor

@mmusgrov mmusgrov left a comment

Choose a reason for hiding this comment

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

Looks great.

@turing85 There were no comments on the message that I posted to the narayana google users group so I think this is ready for merging.

@turing85
Copy link
Contributor Author

turing85 commented Nov 2, 2023

Looks great.

@turing85 There were no comments on the message that I posted to the narayana google users group so I think this is ready for merging.

Okay, then all that is left to do is an approval (github still says that merging is blocked and that an approval is needed). @maxandersen Can you approve this one?

@gsmet gsmet merged commit 3eda9e4 into quarkusio:main Nov 6, 2023
41 checks passed
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Nov 6, 2023
@quarkus-bot quarkus-bot bot added this to the 3.6 - main milestone Nov 6, 2023
@gsmet
Copy link
Member

gsmet commented Nov 6, 2023

Thanks!

* @see #nodeName
*/
@ConfigItem(defaultValue = "false")
public boolean shortenNodeNameIfNecessary;
Copy link
Contributor

@gastaldi gastaldi Nov 6, 2023

Choose a reason for hiding this comment

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

How about naming it truncateNodeName or simply shortenNodeName? The ifNecessary makes my chin itch a bit 😀

Copy link
Contributor

Choose a reason for hiding this comment

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

How about making it true by default as a precaution?

Copy link
Member

Choose a reason for hiding this comment

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

this is not truncation. Truncate is rather abrupt/finite in nature.

maybe compress as this will be a lossy-but-hopefully-not-significant-compression ?

btw. why the "ifNecessary" part ? if its necessary why is it not true by default?

Copy link
Member

Choose a reason for hiding this comment

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

i.e. since this seems necessary I would argue it should be default on and possible to turn off. At least in main with good release note metnion - if this was for LTS branch I could see how one could argue it should stay off.

Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

this is not truncation. Truncate is rather abrupt/finite in nature.

maybe compress as this will be a lossy-but-hopefully-not-significant-compression ?

Right, compress makes more sense

btw. why the "ifNecessary" part ? if its necessary why is it not true by default?

+1

Copy link
Contributor Author

@turing85 turing85 Nov 6, 2023

Choose a reason for hiding this comment

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

How about naming it truncateNodeName or simply shortenNodeName? The ifNecessary makes my chin itch a bit 😀

@gastaldi @maxandersen
"if necessary" because the shortening takes play if and only if the node-name is longer thank 28 bytes. I know that it is unwieldy. This is why I explicitly said the name is up for discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it's less unlikely to happen, but would truncating be a problem if the algorithm isn't available?

Hard to say. This depends how the node names are constructed. If one has long names and a common prefix, then this might lead to name duplication.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw. why the "ifNecessary" part ? if its necessary why is it not true by default?

Historically the default is to fail startup if the nodeIdentifier, set by the user or the platform, is too long. Since the use of a hash incurs the risk of collisions and can result in non ACID behaviour it should not be the default - the user has to opt in to the added risk of using a hash since only they can quantify the risk to their application.

Copy link
Member

Choose a reason for hiding this comment

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

ok, how about simply "hashNodeNameIfNecessary" or simply "hashNodeName" which still will only happen if needed but with hash it at least signals what happens and collision awareness could be necessary.

Copy link
Contributor

@mmusgrov mmusgrov Nov 8, 2023

Choose a reason for hiding this comment

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

"hashNodeName" sounds reasonable, the docs will let the user know what effect it will have.

@turing85 turing85 deleted the feature/30491-shorten-node-name-if-necessary branch March 6, 2024 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/narayana Transactions / Narayana kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate right-length node name
6 participants