hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Meil <doug.m...@explorysmedical.com>
Subject Re: HTable thread safe for read?
Date Sun, 14 Aug 2011 13:29:47 GMT

I wouldn't do it...   Some of the other committers can comment more on
this, but there is state cached in HTable instances when scanning.

E.g.,...

 protected class ClientScanner implements ResultScanner {
    private final Log CLIENT_LOG = LogFactory.getLog(this.getClass());
    // HEADSUP: The scan internal start row can change as we move through
table.
    private Scan scan;
    private boolean closed = false;
    // Current region scanner is against.  Gets cleared if current region
goes
    // wonky: e.g. if it splits on us.
    private HRegionInfo currentRegion = null;
    private ScannerCallable callable = null;
    private final LinkedList<Result> cache = new LinkedList<Result>();
    private final int caching;
    private long lastNext;
    // Keep lastResult returned successfully in case we have to reset
scanner.
    private Result lastResult = null;







On 8/14/11 3:24 AM, "Yi Liang" <whitesky@gmail.com> wrote:

>From the javadoc of HTable:
>
>"This class is not thread safe for updates; the underlying write buffer
>can be corrupted if multiple threads contend over a single HTable
>instance."
>
>Does that mean HTable is thread safe if we only use it to get rows?
>
>Thanks,
>Yi


Mime
View raw message