You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Lars Hofhansl (JIRA)" <ji...@apache.org> on 2012/12/17 23:12:13 UTC

[jira] [Created] (HBASE-7371) Blocksize in TestHFileBlock is unintentionally small

Lars Hofhansl created HBASE-7371:
------------------------------------

             Summary: Blocksize in TestHFileBlock is unintentionally small
                 Key: HBASE-7371
                 URL: https://issues.apache.org/jira/browse/HBASE-7371
             Project: HBase
          Issue Type: Sub-task
            Reporter: Lars Hofhansl
            Priority: Minor


Looking at TestHFileBlock.writeBlocks I see this:
{code}
      for (int j = 0; j < rand.nextInt(500); ++j) {
        // This might compress well.
        dos.writeShort(i + 1);
        dos.writeInt(j + 1);
      }
{code}

The result is probably not what the author intended. {{rand.nextInt(500)}} is evaluated during each iterations and that leads to very small blocks size mostly between ~100 and 300 bytes or so.

The author probably intended this:
{code}
      int size = rand.nextInt(500);
      for (int j = 0; j < size; ++j) {
        // This might compress well.
        dos.writeShort(i + 1);
        dos.writeInt(j + 1);
      }
{code}

This leads to more reasonable block sizes between ~200 and 3000 bytes

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira