[
https://issues.apache.org/jira/browse/HDFS-16531?focusedWorklogId=755572&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-755572
]
ASF GitHub Bot logged work on HDFS-16531:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Apr/22 03:43
Start Date: 12/Apr/22 03:43
Worklog Time Spent: 10m
Work Description: Hexiaoqiao commented on code in PR #4148:
URL: https://github.com/apache/hadoop/pull/4148#discussion_r847921761
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -2466,11 +2466,12 @@ boolean setReplication(final String src, final short
replication)
logAuditEvent(false, operationName, src);
throw e;
}
- if (success) {
+ if (status == FSDirAttrOp.SetRepStatus.SUCCESS) {
getEditLog().logSync();
- logAuditEvent(true, operationName, src);
}
- return success;
+ logAuditEvent(status != FSDirAttrOp.SetRepStatus.INVALID,
Review Comment:
IMO, this does not changes the prior log except additional false log when
setReplication failed.
a. if status == FSDirAttrOp.SetRepStatus.SUCCESS, it logs a true since
`status != FSDirAttrOp.SetRepStatus.INVALID`;
b. if status == FSDirAttrOp.SetRepStatus.UNCHANGED, it also logs a true
which is same as before.
c. if status == FSDirAttrOp.SetRepStatus.INVALID, it logs a false which is
additional compare to before logic.
Issue Time Tracking
-------------------
Worklog Id: (was: 755572)
Time Spent: 40m (was: 0.5h)
> Avoid setReplication logging an edit record if old replication equals the new
> value
> -----------------------------------------------------------------------------------
>
> Key: HDFS-16531
> URL: https://issues.apache.org/jira/browse/HDFS-16531
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: namenode
> Reporter: Stephen O'Donnell
> Assignee: Stephen O'Donnell
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> I recently came across a NN log where about 800k setRep calls were made,
> setting the replication from 3 to 3 - ie leaving it unchanged.
> Even in a case like this, we log an edit record, an audit log, and perform
> some quota checks etc.
> I believe it should be possible to avoid some of the work if we check for
> oldRep == newRep and jump out of the method early.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]