You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "hfutatzhanghb (via GitHub)" <gi...@apache.org> on 2023/02/03 06:58:42 UTC
[GitHub] [hadoop] hfutatzhanghb commented on a diff in pull request #5330: HDFS-16898. Make write lock fine-grain in method processCommandFromActor
hfutatzhanghb commented on code in PR #5330:
URL: https://github.com/apache/hadoop/pull/5330#discussion_r1095415826
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java:
##########
@@ -679,16 +679,19 @@ boolean processCommandFromActor(DatanodeCommand cmd,
actor.reRegister();
return false;
}
+ boolean isActiveActor;
writeLock();
try {
- if (actor == bpServiceToActive) {
- return processCommandFromActive(cmd, actor);
- } else {
- return processCommandFromStandby(cmd, actor);
- }
+ isActiveActor = actor == bpServiceToActive;
} finally {
writeUnlock();
}
+
+ if (actor == bpServiceToActive) {
+ return processCommandFromActive(cmd, actor);
+ } else {
+ return processCommandFromStandby(cmd, actor);
+ }
Review Comment:
Hi, @virajjasani . thanks for your careful review. Surely, before [HDFS-6788](https://issues.apache.org/jira/browse/HDFS-6788), this part was covered by synchronized lock.
but in method `processCommandFromActive` and `processCommandFromStandby`, it just use the parameter actor to print log info. The lock here is just trying to decide actor is whether bpServiceToActive or not and determine to execute either processCommandFromActive or processCommandFromStandby.
when occurs switchover between active namenode and standby namenode, the datanodes would be set to stale status, in stale status, we are not allowed to delete blocks directly, we put those blocks into postponedMisreplicatedBlocks. So, even we execute the DatanodeCommand from the previous active namenode(now standby), it is okay.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org