Skip to content

Commit

Permalink
HDFS-16513. [SBN read] Observer Namenode does not trigger the edits r…
Browse files Browse the repository at this point in the history
…olling of active Namenode
  • Loading branch information
tomscut committed Mar 21, 2022
1 parent 62d59e5 commit 0cf9128
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,14 @@ public boolean isInStandbyState() {
HAServiceState.OBSERVER == haContext.getState().getServiceState();
}

public boolean isInObserverState() {
if (haContext == null || haContext.getState() == null) {
return haEnabled;
}

return HAServiceState.OBSERVER == haContext.getState().getServiceState();
}

/**
* return a list of blocks & their locations on {@code datanode} whose
* total size is {@code size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ private void doWork() {
// read any more transactions since the last time a roll was
// triggered.
boolean triggeredLogRoll = false;
if (tooLongSinceLastLoad() &&
if (!namesystem.isInObserverState() && tooLongSinceLastLoad() &&
lastRollTriggerTxId < lastLoadedTxnId) {
triggerActiveLogRoll();
triggeredLogRoll = true;
Expand Down

0 comments on commit 0cf9128

Please sign in to comment.