diff options
| author | Wouter Bolsterlee <uws@xs4all.nl> | 2014-11-24 23:16:46 +0100 |
|---|---|---|
| committer | Wouter Bolsterlee <uws@xs4all.nl> | 2014-11-24 23:16:46 +0100 |
| commit | 8a27521bf9a80411f46a600751329e92e43fccf9 (patch) | |
| tree | bca91ba440b41dd18bac57ca47401bc5ffee1942 | |
| parent | 15b5311f0011a3c29d606a2b5fbedbcd828dbef0 (diff) | |
| download | happybase-8a27521bf9a80411f46a600751329e92e43fccf9.tar.gz | |
Correctly handle scanner that are smaller than expected
Fixes #72.
| -rw-r--r-- | NEWS.rst | 4 | ||||
| -rw-r--r-- | happybase/table.py | 9 |
2 files changed, 8 insertions, 5 deletions
@@ -9,6 +9,10 @@ HappyBase 0.9 Release date: *not yet released* +* Fix an issue where scanners would return fewer results than expected due to + HBase not always behaving as its documentation suggests. (`issue #72 + <https://github.com/wbolster/happybase/issues/72>`_). + * Add support for the Thrift compact protocol (``TCompactProtocol``) in :py:class:`Connection`. diff --git a/happybase/table.py b/happybase/table.py index 60e74be..ac897d2 100644 --- a/happybase/table.py +++ b/happybase/table.py @@ -389,6 +389,9 @@ class Table(object): items = self.connection.client.scannerGetList( scan_id, how_many) + if not items: + break # scan has finished + n_fetched += len(items) for n_returned, item in enumerate(items, n_returned + 1): @@ -401,11 +404,7 @@ class Table(object): yield item.row, row if limit is not None and n_returned == limit: - return - - # Avoid round-trip when exhausted - if len(items) < how_many: - break + break # not interested in the remainder finally: self.connection.client.scannerClose(scan_id) logger.debug( |
