Skip to content

Conversation

@guohao-rosicky
Copy link
Contributor

@guohao-rosicky guohao-rosicky commented Jul 6, 2023

What changes were proposed in this pull request?

SCM SequenceIdGenerator#reinitialize only needs to acquire the lock once

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-8978

@xichen01
Copy link
Contributor

xichen01 commented Jul 6, 2023

Could I ask what are the cases where deadlocks happen, and is this PR #5018 related?

@Xushaohong
Copy link
Contributor

The linked Jira is [HDDS-8965], @guohao-rosicky you might need to correct it

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @guohao-rosicky for working on this.

  • Can you please provide more details about the deadlock? It would be great if you could attach a thread dump to the Jira issue.
  • Without knowing the details, I don't think the patch fixes any deadlocks. lock is a ReentrantLock. If it is lock()-ed twice, it needs to be unlock()-ed twice before it is released. Thus lock is held until return from reinitialize, whether it calls invalidateBatch or invalidateBatchInternal.

@guohao-rosicky
Copy link
Contributor Author

Thanks @adoroszlai for the comment, as you said, I was wrong in my description, this modification reduces the locks by one since reinitialize only needs to acquire the locks once

@guohao-rosicky guohao-rosicky changed the title HDDS-8978. Deadlock in scm SequenceIdGenerator HDDS-8978. SCM SequenceIdGenerator#reinitialize only needs to acquire the lock once Jul 12, 2023
Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @guohao-rosicky for clarifying the intent of this change.

throws IOException {
lock.lock();
try {
LOG.info("reinitialize SequenceIdGenerator.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should move the log statement out of the lock.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure.

@adoroszlai adoroszlai merged commit e404831 into apache:master Jul 19, 2023
@adoroszlai
Copy link
Contributor

Thanks @guohao-rosicky for the patch, @xichen01, @Xushaohong for the review.

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.

4 participants