[ 
https://issues.apache.org/jira/browse/HDFS-8387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16116628#comment-16116628
 ] 

Rakesh R commented on HDFS-8387:
--------------------------------

[~andrew.wang]
Following are different cases where it casting long to int in 
{{StripedBlockUtil.java}}. Apart from first case all other cases looks mostly 
OK to me and please let me know your feedback.

# I think, only below case need to be fixed and should use {{long 
lastStripeDataLen}}
{code}
Line 177:     final int lastStripeDataLen = (int)(dataSize % stripeSize);
{code}
# Since the Block size is long, so casting is needed here.{code}
        Line 182:     final int numStripes = (int) ((dataSize - 1) / stripeSize 
+ 1);
        Line 231:     int cellIdxInBlk = (int) (offsetInBlk / cellSize);
{code}
# Uses ByteBuffer and takes integer datatype for position, limit etc, so 
casting is needed here.
{code}
        Line 320:         (int) (rangeStartInBlockGroup % ((long) cellSize * 
dataBlkNum));
        Line 328:         int overLapLen = (int) (overlapEnd - overlapStart + 
1);
        Line 331:           final int pos = (int) (bufOffset + overlapStart - 
cellStart);
{code}
# Uses int datatype to represent indexing and integer casting is OK.
{code}
        Line 401:     int firstCellIdxInBG = (int) (rangeStartInBlockGroup / 
cellSize);
        Line 402:     int lastCellIdxInBG = (int) (rangeEndInBlockGroup / 
cellSize);
{code}
# Cell size is int type, so the result will be within int value and uses int 
datatype for storing the values.
{code}
        Line 406:     final int firstCellOffset = (int) (rangeStartInBlockGroup 
% cellSize);
        Line 408:         (int) Math.min(cellSize - (rangeStartInBlockGroup % 
cellSize), len);
        Line 412:       final int lastCellSize = (int) (rangeEndInBlockGroup % 
cellSize) + 1;
        Line 521:         int overLapLen = (int) (overlapEnd - overlapStart + 
1);
        Line 531:             (int) (done + overlapStart - cellStart), 
overLapLen);
        Line 919:     return (int) (reportedBlock.getBlockId() &
{code}

> Erasure Coding: Revisit the long and int datatypes usage in striping logic
> --------------------------------------------------------------------------
>
>                 Key: HDFS-8387
>                 URL: https://issues.apache.org/jira/browse/HDFS-8387
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>              Labels: hdfs-ec-3.0-nice-to-have
>
> This idea of this jira is to revisit the usage of {{long}} and {{int}} data 
> types in the striping logic.
> Related discussion 
> [here|https://issues.apache.org/jira/browse/HDFS-8294?focusedCommentId=14540788&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14540788]
>  in HDFS-8294



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to