szetszwo commented on code in PR #6395:
URL: https://github.com/apache/ozone/pull/6395#discussion_r1528885585
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -178,6 +184,13 @@ public TermIndex getLastNotifiedTermIndex() {
@Override
protected synchronized boolean updateLastAppliedTermIndex(TermIndex
newTermIndex) {
assertUpdateIncreasingly("lastApplied", getLastAppliedTermIndex(),
newTermIndex);
+ // if newTermIndex getting updated is within sequence of notifiedTermIndex
(i.e. from lastSkippedIndex and
+ // notifiedTermIndex), then can update directly to lastNotifiedTermIndex
as it ensure previous double buffer's
+ // Index is notified or getting notified matching lastSkippedIndex
+ if (newTermIndex.getIndex() <= getLastNotifiedTermIndex().getIndex()
+ && getLastAppliedTermIndex().getIndex() >= lastSkippedIndex) {
Review Comment:
Don't call `getLastAppliedTermIndex()` twice, i.e.
```java
@Override
protected synchronized boolean updateLastAppliedTermIndex(TermIndex
newTermIndex) {
final TermIndex lastApplied = getLastAppliedTermIndex();
assertUpdateIncreasingly("lastApplied", lastApplied, newTermIndex);
// if newTermIndex getting updated is within sequence of
notifiedTermIndex (i.e. from lastSkippedIndex and
// notifiedTermIndex), then can update directly to lastNotifiedTermIndex
as it ensure previous double buffer's
// Index is notified or getting notified matching lastSkippedIndex
if (newTermIndex.getIndex() < getLastNotifiedTermIndex().getIndex()
&& lastApplied.getIndex() >= lastSkippedIndex) {
newTermIndex = getLastNotifiedTermIndex();
}
return super.updateLastAppliedTermIndex(newTermIndex);
}
```
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -178,6 +184,13 @@ public TermIndex getLastNotifiedTermIndex() {
@Override
protected synchronized boolean updateLastAppliedTermIndex(TermIndex
newTermIndex) {
assertUpdateIncreasingly("lastApplied", getLastAppliedTermIndex(),
newTermIndex);
+ // if newTermIndex getting updated is within sequence of notifiedTermIndex
(i.e. from lastSkippedIndex and
+ // notifiedTermIndex), then can update directly to lastNotifiedTermIndex
as it ensure previous double buffer's
+ // Index is notified or getting notified matching lastSkippedIndex
+ if (newTermIndex.getIndex() <= getLastNotifiedTermIndex().getIndex()
Review Comment:
Use `<` instead of `<=`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]