hanishakoneru commented on a change in pull request #1833:
URL: https://github.com/apache/ozone/pull/1833#discussion_r570580843
##########
File path:
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/ratis/TransactionInfo.java
##########
@@ -52,11 +52,23 @@ private OMTransactionInfo(String transactionInfo) {
transactionIndex = Long.parseLong(tInfo[1]);
}
- private OMTransactionInfo(long currentTerm, long transactionIndex) {
+ private TransactionInfo(long currentTerm, long transactionIndex) {
this.term = currentTerm;
this.transactionIndex = transactionIndex;
}
+ public boolean isInitialized() {
+ return transactionIndex == -1 && term == 0;
+ }
+
+ public int compareTo(TransactionInfo info) {
+ if (info.getTerm() == this.getTerm()) {
+ return this.getTransactionIndex() <= info.getTransactionIndex() ? -1 : 1;
+ } else {
+ return this.getTerm() < info.getTerm() ? -1 : 1;
+ }
Review comment:
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?
##########
File path:
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/ratis/TransactionInfo.java
##########
@@ -52,11 +52,23 @@ private OMTransactionInfo(String transactionInfo) {
transactionIndex = Long.parseLong(tInfo[1]);
}
- private OMTransactionInfo(long currentTerm, long transactionIndex) {
+ private TransactionInfo(long currentTerm, long transactionIndex) {
this.term = currentTerm;
this.transactionIndex = transactionIndex;
}
+ public boolean isInitialized() {
+ return transactionIndex == -1 && term == 0;
Review comment:
This function is not being called anywhere.
Also, if initialized, then txIndex should not be equal to -1, right?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]