-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-15963. Unreleased volume references cause an infinite loop. #2889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
💔 -1 overall
This message was automatically generated. |
fd41b65 to
c81875c
Compare
c81875c to
fa37c6a
Compare
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
| } catch (RuntimeException re) { | ||
| int afterCnt = vol.getReferenceCount(); | ||
| assertEquals(beforeCnt, afterCnt); | ||
| re.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printing the stack trace is redundant here. let's remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll remove it.
| } | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a timeout (a class-wide timeout is preferred) here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll add it.
...va/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskAsyncLazyPersistService.java
Show resolved
Hide resolved
...fs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java
Show resolved
Hide resolved
...in/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetAsyncDiskService.java
Show resolved
Hide resolved
| int afterCnt = volume.getReferenceCount(); | ||
| assertEquals(beforeCnt, afterCnt); | ||
|
|
||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it interrupts, let it throw. No need to handle the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
| Assert.assertTrue( | ||
| beforeCnts[i] == afterCnt || beforeCnts[i] == (afterCnt - 1)); | ||
| } | ||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to handle the interruption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
| } | ||
|
|
||
| @Test | ||
| public void testReleaseVolumeRefIfExceptionThrown() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could rewritten this test as a true unit test: A BlockSender with mocks. However, given the dependency on the DataNode class, I recognize this is not trivial.
...-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDataTransferProtocol.java
Show resolved
Hide resolved
|
Failed junit tests have nothing to do with this PR. I ran them locally and all of them passed. |
jojochuang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks almost ready. Just nits in the test.
| Assert.assertTrue( | ||
| beforeCnts[i] == afterCnt || beforeCnts[i] == (afterCnt - 1)); | ||
| } | ||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
| int afterCnt = volume.getReferenceCount(); | ||
| assertEquals(beforeCnt, afterCnt); | ||
|
|
||
| } catch (InterruptedException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't being clear myself. You don't have to catch the exception. Instead, add InterruptedException to the test method signature.
|
💔 -1 overall
This message was automatically generated. |
|
Please fix the spotbugs warning. Other than that I am +1. |
|
Thanks @zhangshuyan0 for your great catch here. LGTM. +1 from my side. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
Hexiaoqiao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failed unit tests seem not related to this PR. +1.
@jojochuang do you mind give double check? I think it is ready to commit this PR. anymore suggestions? Thanks.
|
@jojochuang Hi Wei-Chiu, any furthermore comment here? If not, I would like to commit this PR shortly. Thanks. |
|
Go ahead. Thanks! |
|
Committed to trunk. Thanks @zhangshuyan0 for your works! Thanks @jojochuang for your reviews! |
…che#2889) Contributed by Shuyan Zhang. Reviewed-by: Wei-Chiu Chuang <[email protected]> Reviewed-by: He Xiaoqiao <[email protected]>
…che#2889) Contributed by Shuyan Zhang. Reviewed-by: Wei-Chiu Chuang <[email protected]> Reviewed-by: He Xiaoqiao <[email protected]>
This patch releases the three previously unreleased volume references.