accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Elser (JIRA)" <>
Subject [jira] [Commented] (ACCUMULO-3555) TabletServerBatchReaderIterator doesn't maintain reference to TabletServerBatchReader
Date Tue, 03 Feb 2015 16:48:34 GMT


Josh Elser commented on ACCUMULO-3555:

I'm surprised that this wasn't already done TBH (my brain is playing tricks on me because
I totally thought someone did that already).

bq. if the user doesn't do this then they need to maintain a reference to the BatchScanner
and close it when they are done with it

This doesn't address the issue at hand. The user *must* retain an explicit reference to the
BS to use the Iterator which makes the (Batch)Scanner operate differently than a normal Java
Collection would. Perhaps marking them as Closeable (which would generate a compiler warning
if they aren't closed, IIRC) would be a good middle ground?

Fundamentally, the closer we can keep our API to "normal" Java stdlib semantics, the easier
it would be to pick up and use. I recognize that a BatchScanner does have more state and implication
in use than an ArrayList does, but I'm not yet convinced we can't do something to make life
better for users.

> TabletServerBatchReaderIterator doesn't maintain reference to TabletServerBatchReader
> -------------------------------------------------------------------------------------
>                 Key: ACCUMULO-3555
>                 URL:
>             Project: Accumulo
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.6.1
>            Reporter: Josh Elser
>            Assignee: Josh Elser
>            Priority: Blocker
> Had a user in IRC run into this again today upgrading a 1.4 instance to 1.6.0.
> ACCUMULO-587 introduced a {{finalize}} implementation into {{TabletServerBatchReader}}
in an attempt to close the {{BatchScanner}} when the user might have forgotten to do so themselves.
The problem, however, is that the {{TabletServerBatchReaderIterator}} doesn't maintain a reference
to the {{TabletServerBatchReader}} (notice how it only uses it to create a new instnace of
{{ScannerOptions}} using the copy constructor).
> In other words, when the {{TabletServerBatchReaderIterator}} is constructed, it has no
references in the object graph to the {{TabletServerBatchReader}} it was created from. This
means that if clients don't hold onto the BatchScanner instance, it's possible that it gets
closed by the JVM calling {{finalize()}}.

This message was sent by Atlassian JIRA

View raw message