hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julius <jcpl...@ameritech.net>
Subject InternalScanner seems in perpetual loop
Date Sat, 20 Jul 2013 22:27:25 GMT
I'm trying to implement an endpoint coprocessor that among other things,
does a scan on region rows.

I understand an internalscanner should scan only the rows within its region,
and that's  what I want.

However, the scanner seems to stay in a perpetual loop (the "do/while"
below), even though I tried to set start/end keys, max number of versions, etc.

If I just leave it running, it never returns.
I noticed that when I wrote trace messages to a file, saving just the keys
for the scanned rows, the longer I leave it running, the more duplicate
records for the same keys I get.

Does anyone have any ideas?

Thanks,

Julius


                regStartKey = env.getRegion().getStartKey();
                regEndKey = env.getRegion().getEndKey();

                Scan scan = new Scan(regStartKey,regEndKey);
                scan.addColumn("cf".getBytes(), "d".getBytes() );
                scan.setMaxVersions(1);
                scan.setBatch(10000);
                scan.setCaching(10000);
                scan.setStartRow(regStartKey);
                scan.setStopRow(regEndKey);

                InternalScanner scanner = env.getRegion().getScanner(scan);
            
                List<KeyValue> results = new ArrayList<KeyValue>();

                results.clear();
                scanner.next(results);
                KeyValue[] resultArray = {}; 

                boolean hasMore = false;

                do {
                        results.clear();
                        hasMore = scanner.next(results,1);
                        if (results.size()==0) break;

                        resultArray = results.toArray(resultArray);
                        KeyValue kv = resultArray[0];
                        byte[] thisKey = kv.getRow();
                        bw.write( new String(thisKey) + "\n");
                        nScannedRecs++;

                } while (hasMore);
                scanner.close();



Mime
View raw message