[
https://issues.apache.org/jira/browse/HDFS-11001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15606906#comment-15606906
]
Anu Engineer commented on HDFS-11001:
-------------------------------------
[~xyao] Thanks for a very detailed code review. Please see my comments below.
bq. 1. Have you considered ReaderWriterLock to reduce contentions between
getCommand(Read) and addCommand(Write)?
I did, but both getCommand and addCommand are write operations in our world.
The reason being that getCommand returns the list of all commands at this point
time, and we replace the commandMap with an empty list.
bq. 2. Uninitialized nullList, I would suggest us returning an empty list with
flight-weight pattern to simplify the caller's logic without null checking.
Also, running foreach with null list throws NPE.
We actually allocate this list in the constructor and it is fly-weight pattern
as much as I can see. It does the allocation only once and then uses this list
to return whenever we need.Since we allocate this list in the constructor what
we return from getCommand is guaranteed to be not null.
{code}
nullList = new LinkedList<>();
nullList.add(NullCommand.newBuilder().build());
{code}
bq. 3. NIT: Can we use the Builder to implement
RegisteredCommand#getFromProtobuf() for consistency?
will do.
bq. 4. I can't find any caller of SCMNodeManager#register from the production
code
This will be called from the datanode directly. When we modify the SCM main
code you will see calls coming into this function. I am leaving that part for
the end to make sure that tests are not broken in ozone branch.
bq. 5. Can we use CamelCase instead of '_' for the enum in protoc?
sure, will do. Thanks for the catch. I will update the patch shortly.
> Ozone:SCM: Add support for registerNode in SCM
> ----------------------------------------------
>
> Key: HDFS-11001
> URL: https://issues.apache.org/jira/browse/HDFS-11001
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: ozone
> Affects Versions: HDFS-7240
> Reporter: Anu Engineer
> Assignee: Anu Engineer
> Fix For: HDFS-7240
>
> Attachments: HDFS-11001-HDFS-7240.001.patch,
> HDFS-11001-HDFS-7240.002.patch
>
>
> Adds support for a datanode registration. Right now SCM relies on Namenode
> for the datanode registration. With this change we will be able to run SCM
> independently if needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]