-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDFS-16847: RBF: Prevents StateStoreFileSystemImpl from committing tmp file after encountering an IOException. #5145
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. |
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 @simbadzina for your contribution.
@goiri - Do you think we can add a specific UT for this change? Also, I can see the current test has been updated to check it.
I am +1 overall.
Thanks for the reviews @ashutoshcipher and @goiri . In this review I didn't update tests.
(1) felt like overkill. I couldn't get (2) to work because serializeString() is a protected method in a parent class. |
...ava/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileSystemImpl.java
Show resolved
Hide resolved
I've added a unit test. Without my patch, we get the following error due to an error reading a corrupted state store.
|
598979b
to
65a8b97
Compare
.../java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java
Outdated
Show resolved
Hide resolved
.../java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java
Outdated
Show resolved
Hide resolved
@@ -234,6 +234,25 @@ public <T extends BaseRecord> void testInsert( | |||
assertEquals(11, records2.size()); | |||
} | |||
|
|||
public <T extends BaseRecord> void testInsertWithErrorDuringWrite( |
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.
8000To test my above comment, you would need two iterations of the loop where the first is a failure and the second is a success. The test passes despite the issue because there is only a single write.
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.
Yeah, this test doesn't capture the error I'd made. I tried changing the test to do a failure and then a success but I can't get mockito to work right.
Since I'm working with a spy I need to use the doThrow().when(...) syntax. However, to have a change of behavior I believe mock wants me to use when(...).doThrow().doCallRealMethod().
@mkuchenbecker If it is okay, I'll leave the test as it is. It exposes the original bug in the code and validate that my patch address it.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
.../java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java
Outdated
Show resolved
Hide resolved
.../java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java
Show resolved
Hide resolved
99c79c9
to
c8251b5
Compare
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
.../java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java
Outdated
Show resolved
Hide resolved
💔 -1 overall
This message was automatically generated. |
25493b5
to
49c6039
Compare
🎊 +1 overall
This message was automatically generated. |
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.
+1 LGTM
…p file after encountering an IOException. (#5145)
…p file after encountering an IOException. (#5145)
…p file after encountering an IOException. (apache#5145)
…p file after encountering an IOException. (apache#5145) (Cherrypicked from 9d37ee0)
HDFS-16847: Prevents StateStoreFileSystemImpl from committing tmp file after encountering an IOException.
Description of PR
The file based implementation of the RBF state store has a commit step that moves a temporary file to a permanent location.
There is a check to see if the write of the temp file was successfully, however, the code to commit doesn't check the success flag.
This is the relevant code:
hadoop/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java
Line 369 in 7d39abd
How was this patch tested?
Ran tests in TestStateStoreFileSystem
For code changes: