[
https://issues.apache.org/jira/browse/HDFS-16991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18032302#comment-18032302
]
ASF GitHub Bot commented on HDFS-16991:
---------------------------------------
github-actions[bot] closed pull request #5591: HDFS-16991. fix
testMkdirsRaceWithObserverRead
URL: https://github.com/apache/hadoop/pull/5591
> Fix testMkdirsRaceWithObserverRead
> ----------------------------------
>
> Key: HDFS-16991
> URL: https://issues.apache.org/jira/browse/HDFS-16991
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs
> Affects Versions: 3.3.4
> Reporter: fanluo
> Assignee: fanluo
> Priority: Minor
> Labels: pull-request-available
>
> The test case testMkdirsRaceWithObserverRead which in TestObserverNode
> sometimes failed like this:
> {code:java}
> java.lang.AssertionError: Client #1 lastSeenStateId=-9223372036854775808
> activStateId=5
> null at org.junit.Assert.fail(Assert.java:89)
> at org.junit.Assert.assertTrue(Assert.java:42)
> at
> org.apache.hadoop.hdfs.server.namenode.ha.TestObserverNode.testMkdirsRaceWithObserverRead(TestObserverNode.java:607)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> {code}
> i think the Thread.sleep() should move into the sub threads, like this:
> {code:java}
> public void run() {
> try {
> fs.mkdirs(DIR_PATH);
> Thread.sleep(150); // wait until mkdir is logged
> clientState.lastSeenStateId = HATestUtil.getLastSeenStateId(fs);
> assertSentTo(fs, 0); FileStatus stat = fs.getFileStatus(DIR_PATH);
> assertSentTo(fs, 2);
> assertTrue("Should be a directory", stat.isDirectory());
> } catch (FileNotFoundException ioe) {
> clientState.fnfe = ioe;
> } catch (Exception e) {
> fail("Unexpected exception: " + e);
> }
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]