[
https://issues.apache.org/jira/browse/HDFS-16960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17703475#comment-17703475
]
ASF GitHub Bot commented on HDFS-16960:
---------------------------------------
zhangshuyan0 commented on PR #5499:
URL: https://github.com/apache/hadoop/pull/5499#issuecomment-1478896102
It is a great idea to avoid unnecessary `FSEditLog#logSync()` costs. We may
be able to make this feature more general.
When `FSEditLogAsync` is used, `FSEditLog#logSync()` does nothing because
`THREAD_EDIT.get()` is null.
https://github.com/apache/hadoop/blob/67e02a92e0b9c4da3dcdd01f231a98f243f12d06/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogAsync.java#L139-L149
So we only need to pay attention to the scenarios where `FSEditLog` is used.
https://github.com/apache/hadoop/blob/67e02a92e0b9c4da3dcdd01f231a98f243f12d06/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java#L661-L664
I think we can solve this problem in a similar way, modify `FSEditLog` as
follows:
```
public void logSync() {
// Fetch the transactionId of this thread.
if (myTransactionId.get().txid != -1) {
long id = myTransactionId.get().txid;
logSync(id);
myTransactionId.get().txid = -1;
}
}
```
In this way, we don't have to consider whether there is EditLog written
every time we call logSync().
Please feel free to disagree.
> Remove useless getEditLog().logSync() for setTimes(), setPermission() and
> setQuota() PRC
> ----------------------------------------------------------------------------------------
>
> Key: HDFS-16960
> URL: https://issues.apache.org/jira/browse/HDFS-16960
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Major
> Labels: pull-request-available
>
> Remove useless getEditLog().logSync() for setTimes(), setPermission() and
> setQuota() PRC if there is no changed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]