hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LN (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HBASE-686) memcache.getScanner didn't return the first row(if it exists), cause HScannerInterface's output incorrect
Date Sat, 14 Jun 2008 08:17:45 GMT

    [ https://issues.apache.org/jira/browse/HBASE-686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605048#action_12605048
] 

LN commented on HBASE-686:
--------------------------

a testcase for this issue, i add this to TestHMemcache.java for reproduce and validating my
patch.
    /**
     * Test memcache scanner scanning cached rows, see HBASE-686
     * @throws IOException
     */
    public void testScanner_686() throws IOException
    {
        addRows(this.hmemcache);
        long timestamp = System.currentTimeMillis();
        Text[] cols = new Text[COLUMNS_COUNT * ROW_COUNT];
        for (int i = 0; i < ROW_COUNT; i++)
        {
            for (int ii = 0; ii < COLUMNS_COUNT; ii++)
            {
                cols[(ii + (i * COLUMNS_COUNT))] = getColumnName(i, ii);
            }
        }
        //starting from each row, validate results should contain the starting row
        for (int startRowId = 0; startRowId < ROW_COUNT; startRowId++)
        {
            HInternalScannerInterface scanner =
                    this.hmemcache.getScanner(timestamp, cols
                            , new Text(getRowName(startRowId)));
            HStoreKey key = new HStoreKey();
            TreeMap<Text, byte[]> results = new TreeMap<Text, byte[]>();
            for (int i = 0; scanner.next(key, results); i++)
            {
                int rowId = startRowId + i;
                assertTrue("Row name",
                        key.toString().startsWith(getRowName(rowId).toString()));
                assertEquals("Count of columns", COLUMNS_COUNT,
                        results.size());
                TreeMap<Text, byte[]> row = new TreeMap<Text, byte[]>();
                for (Map.Entry<Text, byte[]> e : results.entrySet())
                {
                    row.put(e.getKey(), e.getValue());
                }
                isExpectedRow(rowId, row);
                // Clear out set.  Otherwise row results accumulate.
                results.clear();
            }
        }
    }


> memcache.getScanner didn't return the first row(if it exists), cause HScannerInterface's
output incorrect
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-686
>                 URL: https://issues.apache.org/jira/browse/HBASE-686
>             Project: Hadoop HBase
>          Issue Type: Bug
>    Affects Versions: 0.1.2
>            Reporter: LN
>
> HTable.obtainScanner methods should return the start row if it exists, although HTable's
javadoc didn't clearly desc. but i found the result of htable scanners sometimes contain the
start row, sometimes not.
> after more testing and code review, i found it should be a bug in HStore.Memcache.MemcacheScanner.
in the constructor it set this.currentRow = firstRow, but when doing next(), there's a this.currentRow
= getNextRow(this.currentRow) before fetch result.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message