[
https://issues.apache.org/jira/browse/HDFS-16847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17636939#comment-17636939
]
ASF GitHub Bot commented on HDFS-16847:
---------------------------------------
omalley commented on code in PR #5145:
URL: https://github.com/apache/hadoop/pull/5145#discussion_r1028638870
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java:
##########
@@ -88,6 +88,15 @@ protected abstract <T extends BaseRecord> BufferedReader
getReader(
protected abstract <T extends BaseRecord> BufferedWriter getWriter(
String path);
+ /**
Review Comment:
I think that separating this out from getWriter is confusing and
unnecessary. Just make getWriter public in all 3 classes.
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java:
##########
@@ -88,6 +88,15 @@ protected abstract <T extends BaseRecord> BufferedReader
getReader(
protected abstract <T extends BaseRecord> BufferedWriter getWriter(
String path);
+ /**
Review Comment:
Although do add the VisibleForTesting annotation.
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java:
##########
@@ -348,25 +357,28 @@ public <T extends BaseRecord> boolean putAll(
for (Entry<String, T> entry : toWrite.entrySet()) {
String recordPath = entry.getKey();
String recordPathTemp = recordPath + "." + now() + TMP_MARK;
- BufferedWriter writer = getWriter(recordPathTemp);
+ BufferedWriter writer = getBufferedWriter(recordPathTemp);
+ boolean recordWrittenSuccessfully = true;
Review Comment:
Initialize the value to false and then only set it to true when the write
completes.
> RBF: StateStore writer should not commit tmp fail if there was an error in
> writing the file.
> --------------------------------------------------------------------------------------------
>
> Key: HDFS-16847
> URL: https://issues.apache.org/jira/browse/HDFS-16847
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs, rbf
> Reporter: Simbarashe Dzinamarira
> Assignee: Simbarashe Dzinamarira
> Priority: Critical
> Labels: pull-request-available
>
> 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:
> [https://github.com/apache/hadoop/blob/7d39abd799a5f801a9fd07868a193205ab500bfa/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileBaseImpl.java#L369]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]