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

GH-259: Ensure lock state after HZ cluster shutdown #260

Closed

Conversation

RobbanHoglund
Copy link

I have tested this implementation/fix against a running HZ cluster (client/server mode) running version 5.1.1.

This will ensure that, if a HZ cluster is totally shut down and then restarted the leader state will be reset if the client still possess/regain the lock.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

So, summarizing your change.
It looks like we need only to ensure that on every leader election we call cpSubSystem.getLock() instead of that stored into the property.

The rest of your changes are somehow not relevant...

Thanks

@RobbanHoglund
Copy link
Author

The actual fix is here:

if (LeaderInitiator.this.getLock().isLockedByCurrentThread()) {
	if (!this.leader) {
	  // Since we have the lock we need to ensure that the leader flag is set
	 this.leader = true;
	}

Btw, Thanks for reviewing my code. :)

@artembilan
Copy link
Member

Merged as e11e65e.

@RobbanHoglund ,

thank you very much for the contribution; looking forward for more!

BTW, we are in agreement to merge this Extensions project with main Spring Integration one: #254.
So, if you wish to contribute more, feel free to migrate HZ module and upgrade it respectively to the latest deps and so!

@artembilan artembilan closed this May 18, 2022
@RobbanHoglund
Copy link
Author

Thanks for the good collaboration. And indeed I would gladly contribute if needed, especially with the Hazelcast parts.

@artembilan
Copy link
Member

I would gladly contribute if needed

Right, as I said: we need now to migrate HZ extension project to Spring Integration as a module.
We did recently something similar for SMB one: spring-projects/spring-integration#3791.

So, that's kinda the story we may consider as a contribution at the moment for HZ.

Thanks

@RobbanHoglund RobbanHoglund deleted the fenced_lock_fix branch May 20, 2022 08:53
@RobbanHoglund
Copy link
Author

Hi,
I did an attempt here:
spring-projects/spring-integration#3812

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.

2 participants