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 "FuzzingTeam (Jira)" <ji...@apache.org> on 2022/10/11 12:34:00 UTC

[jira] [Comment Edited] (HADOOP-18491) RawErasureCoderBenchmark.configure() returns negative values of data and throughput in the output

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

FuzzingTeam edited comment on HADOOP-18491 at 10/11/22 12:33 PM:
-----------------------------------------------------------------

Unlike the other input parameter *chunkSizeKB* of the same method, there is no direct/indirect check for negative values of {*}dataSizeMB{*}.

 

*Code section of current configure method implementation*
{code:java}
public static void configure(int dataSizeMB, int chunkSizeKB) {
  chunkSize = chunkSizeKB * 1024;
  // buffer size needs to be a multiple of (numDataUnits * chunkSize)
  int round = (int) Math.round(
      TARGET_BUFFER_SIZE_MB * 1024.0 / NUM_DATA_UNITS / chunkSizeKB);
  Preconditions.checkArgument(round > 0);
  bufferSizeKB = NUM_DATA_UNITS * chunkSizeKB * round;
  System.out.println("Using " + bufferSizeKB / 1024 + "MB buffer.");

  round = (int) Math.round(
      (dataSizeMB * 1024.0) / bufferSizeKB);
  if (round == 0) {
    round = 1;
  }
  totalDataSizeKB = round * bufferSizeKB;
} {code}
 

{*}Solution{*}:-

We propose adding an argument check for {*}dataSizeMB{*}, which handles negative values by throwing an IllegalArgumentException, just like it is done for {*}chunkSizeKB{*}.


was (Author: JIRAUSER296392):
Unlike the other input parameter *chunkSizeKB* of the same method, there is no direct/indirect check for negative values of {*}dataSizeMB{*}.

 

*Code section of current configure method implementation*
{code:java}
public static void configure(int dataSizeMB, int chunkSizeKB) {
  chunkSize = chunkSizeKB * 1024;
  // buffer size needs to be a multiple of (numDataUnits * chunkSize)
  int round = (int) Math.round(
      TARGET_BUFFER_SIZE_MB * 1024.0 / NUM_DATA_UNITS / chunkSizeKB);
  Preconditions.checkArgument(round > 0);
  bufferSizeKB = NUM_DATA_UNITS * chunkSizeKB * round;
  System.out.println("Using " + bufferSizeKB / 1024 + "MB buffer.");

  round = (int) Math.round(
      (dataSizeMB * 1024.0) / bufferSizeKB);
  if (round == 0) {
    round = 1;
  }
  totalDataSizeKB = round * bufferSizeKB;
} {code}

**

{*}Solution{*}:-

*We propose adding an argument check for* {*}dataSizeMB{*}{*}, which handles negative values by throwing an IllegalArgumentException, just like it is done for{*} {*}chunkSizeKB.{*}{*}{*}

> RawErasureCoderBenchmark.configure() returns negative values of data and throughput in the output
> -------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-18491
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18491
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 3.3.4
>            Reporter: FuzzingTeam
>            Priority: Major
>              Labels: pull-request-available
>
> The method _configure_ of class BenchData inside RawErasureCoderBenchmark.java, when provided with a negative value for its input parameter ({_}int dataSizeMB{_}) returns negative values of data and throughput instead of logging an error or throwing an exception.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org