[
https://issues.apache.org/jira/browse/HDFS-8499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zhe Zhang updated HDFS-8499:
----------------------------
Attachment: HDFS-8499.UCFeature.patch
I'm halfway through implementing the 2nd option discussed above, where
{{BlockInfoUC}} is an interface and shared UC logic is moved to a feature
(attaching the {{UCFeature}} patch). It is already messier than the 1st option
(02 patch).
Here's a basic comparison of the 2 options to solve the multi-inheritance
problem:
# UC through inheritance, Striped/Contiguous logic a feature/helper:
{code}
BlockInfo (abstract)
/ | \
BlockInfoStriped | BlockInfoContiguous
|
BlockInfoUC(abstract)
/ \
BlockInfoStripedUC BlockInfoContiguousUC
{code}
#* (y) Existing trunk codes using the abstractions of {{BlockInfo}} and
{{BlockInfoUC}} remain unchanged.
#* (y) The static methods in Striped/Contiguous helper classes are relatively
simple
#* (n) Weakening access permission for internal states, especially {{triplets}}
to package level. We could create a package just for {{BlockInfo}} related
classes but that's more changes.
#* (n) Losing the abstraction of _striped complete or UC blocks_. The
helper/feature class for striped blocks needs to maintain {{indices}}.
# Striped/Contiguous through inheritance, UC as a feature:
{code}
BlockInfo (abstract)
/ \
BlockInfoStriped BlockInfoContiguous
| |
| BlockInfoUC |
| (interface) |
| / \ |
BlockInfoStripedUC BlockInfoContiguousUC
{code}
(y) Closer to current HDFS-7285 code
(y) Preserving the shared {{indices}} field in {{BlockInfoStriped}} and
{{BlockInfoStripedUC}}.
(n) There is more shared UC logic than Striped/Contiguous logic. The
{{BlockInfoUCFeature}} class itself is more complex than
{{BlockInfoContiguous/StripedFeature}}.
(n) Involves messy change to convert between {{BlockInfoUC}} and
{{BlockInfo}}. For example, method signatures, like
{{FSNameSystem#isInSnapshot}}, need to be changed because {{BlockInfoUC}} is no
longer a subclass of {{BlockInfo}}.
Looks to me option #1 will probably minimize changes to trunk and make
reviewing easier. Would like to hear more opinions. Thanks!
> Merge BlockInfoUnderConstruction into trunk
> -------------------------------------------
>
> Key: HDFS-8499
> URL: https://issues.apache.org/jira/browse/HDFS-8499
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: namenode
> Affects Versions: 2.7.0
> Reporter: Zhe Zhang
> Assignee: Zhe Zhang
> Attachments: HDFS-8499.00.patch, HDFS-8499.01.patch,
> HDFS-8499.02.patch, HDFS-8499.UCFeature.patch
>
>
> In HDFS-7285 branch, the {{BlockInfoUnderConstruction}} interface provides a
> common abstraction for striped and contiguous UC blocks. This JIRA aims to
> merge it to trunk.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)