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

HDDS-4660. Update OMTransactionInfo to TransactionInfo with functions added #1833

Closed
wants to merge 3 commits into from

Conversation

amaliujia
Copy link
Contributor

@amaliujia amaliujia commented Jan 22, 2021

What changes were proposed in this pull request?

Requirements:

  1. Rename OMTransactionInfo to TransactionInfo (to be used by both OM and SCM), same for the codec.
  2. Add extra functions in https://github.com/apache/ozone/blob/HDDS-2823/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMTransactionInfo.java to OMTransactionInfo.

By doing so, we can use the TransactionInfo in HDDS-2823 and remove duplicate code

What is the link to the Apache JIRA

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

How was this patch tested?

UT

@amaliujia
Copy link
Contributor Author

R: @hanishakoneru

@amaliujia
Copy link
Contributor Author

also R: @GlenGeng @runzhiwang

@bshashikant
Copy link
Contributor

@hanishakoneru , can you please check this ??

Copy link
Contributor

@hanishakoneru hanishakoneru left a comment

Choose a reason for hiding this comment

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

Thanks @amaliujia for working on this.
Patch LGTM overall.
Did you test for compatibility? It does not look like there is incompatibility but better to be sure.

this.term = currentTerm;
this.transactionIndex = transactionIndex;
}

public boolean isInitialized() {
return transactionIndex == -1 && term == 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is not being called anywhere.
Also, if initialized, then txIndex should not be equal to -1, right?

return this.getTransactionIndex() <= info.getTransactionIndex() ? -1 : 1;
} else {
return this.getTerm() < info.getTerm() ? -1 : 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if I am missing something but couldn't find the usage for this function.
And shouldn't compareTo() return 0 if the TransactionInfo's are same?

Copy link
Contributor

@bshashikant bshashikant left a comment

Choose a reason for hiding this comment

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

@amaliujia , can we move TransactionInfo class to hdds-common probbaly (or another suitable package), so that reusability in both SCM and OM becomes easier.

@amaliujia
Copy link
Contributor Author

@bshashikant @hanishakoneru

I guess maybe I will directly make this change in HDDS-2823. Based on current feedback, it seems people got confused on unused functions, which is useful in HDDS-2823. Also moving stuff to hdds-common is happening in HDDS-2823 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants