[ 
https://issues.apache.org/jira/browse/HDFS-17924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18083449#comment-18083449
 ] 

ASF GitHub Bot commented on HDFS-17924:
---------------------------------------

ZanderXu commented on code in PR #8509:
URL: https://github.com/apache/hadoop/pull/8509#discussion_r3302791730


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -4660,6 +4692,21 @@ public void run() {
       }
     }
 
+    private boolean shouldRoll() {
+      long numEdits = getCorrectTransactionsSinceLastLogRoll();
+      long timeSinceLastRollMs = Time.monotonicNow() - lastRollMs;
+      if (numEdits > rollThreshold || (
+          maxRollIntervalMs > 0 &&
+              timeSinceLastRollMs >= maxRollIntervalMs &&
+              numEdits > 1)) {

Review Comment:
   ```
   bool tooLongSinceLastRoll() {
     return maxRollIntervalMs > 0 && timeSinceLastRollMs >= maxRollIntervalMs;
   }
   ```
   
   `if (numEdits > rollThreshold || (tooLongSinceLastRoll() && numEdits > 1))`





> Improve NameNode edit log rolling controls
> ------------------------------------------
>
>                 Key: HDFS-17924
>                 URL: https://issues.apache.org/jira/browse/HDFS-17924
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: hdfs
>            Reporter: Felix N
>            Assignee: Felix N
>            Priority: Minor
>              Labels: pull-request-available
>
> Currently, all 3 kinds of NNs trigger rollEditLog at some time interval and 
> based on the number of edits using a threshold check.
> If a subcluster has a lot of observers, active can roll very frequently, up 
> to dozens of times per hour. This ticket aims improve that via 2 configurable 
> features:
>  * Only active should perform rollEditLog periodically, and it should 
> guarantee a roll as long as there's something to roll, at a reasonable 
> interval.
>  * Standby and observer NNs can opt out of sending rollEditLog.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to