Thank you very much, It works!, and sorry for my stupid code.

2017-12-10 18:26 GMT+08:00 张铎(Duo Zhang) <palomino...@gmail.com>:

> You need to clear the values every time before you call rs.next otherwise
> the list will become larger and larger.
>
> 2017-12-10 15:05 GMT+08:00 Yang Zhang <zhang.yang...@gmail.com>:
>
> > Hello everyone
> >
> >          I am using coprocessor in HBase. When I try to Scan a Region
> using
> > RegionScanner , It will takes a long time. Even 100 times longer than
> Scan
> > from HBase shell. So I believe there must be something wrong.
> >
> >         What's more, HBase will also give no response when I try to
> disable
> > this table and try to delete.
> >
> >         My HBase version is 0.98.4,,Table row number is 500000,all data
> is
> > in one region.I do this in preScannerOpen hooks.
> >
> >         My code is below,Anybody can help? Thanks very much!
> >
> > private void testScan(String regionInfo, RegionCoprocessorEnvironment
> > env,RegionScanner regionScanner){
> >     IndexTree indexTree = new JavaTreeMap(new Node());
> >     regionIndexMap.put(regionInfo, indexTree);
> >     Scan scan = new Scan();
> >     scan.setFilter(new FirstKeyOnlyFilter());
> >
> >     long totalNum = 0;
> >     long start = System.currentTimeMillis();
> >
> >     try {
> >         RegionScanner rs = env.getRegion().getScanner(scan);
> >         List<Cell> values = new LinkedList<>();
> >         while (rs.next(values)){
> >             totalNum++;
> >         }
> >     } catch (IOException e) {
> >         e.printStackTrace();
> >     }
> >     long end = System.currentTimeMillis();
> >     logger.error("==== TestScanAllRegion Cost :"+(end-start)+"
> > RegionNum :"+totalNum);
> > }
> >
>

Reply via email to