hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Boyd <joseph.b...@cbsinteractive.com>
Subject Re: Multiple versions scanning
Date Fri, 18 Feb 2011 17:10:43 GMT
        scan.setMaxVersions(Integer.MAX_VALUE); // or some other integer


On Thu, Feb 17, 2011 at 9:28 PM, Subhash Bhushan
<subhash.bhushan@stratalabs.in> wrote:
> Hi,
>
> I am using a prefix mechanism for storing row keys and I have a separate
> table to store my secondary index.
> Attached is a snapshot of the schema.
>
> Whenever I find an existing ISBN in ISBNs table, I extract the prefix key
> and over-write the existing record in Lists table with a new timestamp.
>
> I am using a scanner to extract records of a particular list (prefix):
> ------------------------------------------------------------------------------------------------------------------------
>         List<Stocklists> list = new ArrayList<Stocklists>();
>
>         byte [] startRow = PrefixKey.createKeyWithPrefix(prefix,0);
>         byte [] stopRow =
> PrefixKey.createKeyWithPrefix(prefix,Integer.MAX_VALUE);
>
>         Scan scan = new Scan(startRow, stopRow);
>         scan.setTimeStamp(timestamp);
>
> scan.addFamily(Bytes.toBytes(Constants.StocklistsConstants.TAB_STOCKLISTS_CF_DETAIL));
>
>         try {
>             ResultScanner rs = table.getScanner(scan);
>             Result rDetail = null;
>
>             while((rDetail = rs.next()) != null) {
>                 list.add(getStocklistsFromResult(rDetail));
>             }
>
>             rs.close();
>         } catch (IOException e) {
>             e.printStackTrace();
>             return null;
>         }
>         return list;
> ------------------------------------------------------------------------------------------------------------------------
>
> The issue is that I get 5 records for list 1, but I get only 4 records for
> list 2.
> I should have got 5 records for list 2 as well, because there are 2 versions
> (timestamps) of the same value present.
>
> What am I missing?
>
> Regards,
> Subhash Bhushan.
>

Mime
View raw message