accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher <>
Subject Re: Scanner / Batch Scanner Reuse
Date Wed, 16 Jan 2019 00:09:49 GMT
They can be reused, if they haven't been closed (they are
AutoCloseable and should be closed when you're done with them). I
wouldn't recommend it, though. While most of the work is done in the
scanner's iterator() method, the close() method on the scanner API
implicitly associates the scanner's resources with the entire scanner,
and not just its iterator. This can be hard to reason about if you're
trying to predict performance impact. It's probably better to think of
each instance of scanner having one set of resources for one
iterator/query. The behavior could also change between versions. (For
example, regular, non-batch, scanners currently don't do anything in
their close() method, but that is expected to change in future to help
clean up unused server-side resources when a scan is finished).

In short: yes, they can be reused (if not closed), but I wouldn't do
it; you'll probably not see much benefit, and there may be unintended

On Mon, Jan 14, 2019 at 2:05 PM gtotsline <> wrote:
> Hi -
> Can Scanners / Batch Scanners be reused?  Is there any downside to reusing a
> scanner (e.g. poorer performance)?  I assume creating a scanner takes time,
> so asking this question to see if I can avoid needlessly recreating a
> BatchScanner every time I do a query.
> Thanks!
> --
> Sent from:

View raw message