brfrn169 commented on a change in pull request #1889: HDFS-15215 The Timestamp 
for longest write/read lock held log is wrong
URL: https://github.com/apache/hadoop/pull/1889#discussion_r391371213
 
 

 ##########
 File path: 
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/FakeTimer.java
 ##########
 @@ -29,17 +29,19 @@
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public class FakeTimer extends Timer {
+  private long now;
   private long nowNanos;
 
   /** Constructs a FakeTimer with a non-zero value */
   public FakeTimer() {
     // Initialize with a non-trivial value.
+    now = 1577836800000L; // 2020-01-01 00:00:00,000+0000
 
 Review comment:
   Thank you for the comment.
   
   Actually, I think it's more real behavior than original one, because 
`Timer.now()` returns the time based on `System.currentTimeMillis()`, and 
`Timer.monotonicNow()` and `Timer.monotonicNowNanos()` return the time based on 
`System.nanoTime()`, which are different times. 
   
   This change is useful to verify the fix in this PR. Also, it doesn't break 
the existing tests.
   
   What do you think?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to