Skip to content

Commit

Permalink
Add more logging for zero byte reads
Browse files Browse the repository at this point in the history
  • Loading branch information
akharit committed Oct 15, 2020
1 parent c5557ec commit 9339b26
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.0.51 (2020-10-15)
+++++++++++++++++++
* Add more logging for zero byte reads to investigate root cause.

0.0.50 (2020-09-10)
+++++++++++++++++++
* Fix bug with retrying for ADAL exception parsing.
Expand Down
2 changes: 1 addition & 1 deletion azure/datalake/store/__init__.py
Expand Up @@ -6,7 +6,7 @@
# license information.
# --------------------------------------------------------------------------

__version__ = "0.0.50"
__version__ = "0.0.51"

from .core import AzureDLFileSystem
from .multithread import ADLDownloader
Expand Down
14 changes: 10 additions & 4 deletions azure/datalake/store/core.py
Expand Up @@ -1135,7 +1135,9 @@ def _read_blocksize(self, offset=-1):
self.end = self.size
self.cache = b""
return
if offset >= self.start and offset < self.end:
if self.start <= offset < self.end:
logger.info("Read offset {offset} is within cache {start}-{end}. "
"Not going to server.".format(offset=offset, start=self.start, end=self.end))
return
if offset > self.size:
raise ValueError('Read offset is outside the File')
Expand Down Expand Up @@ -1165,9 +1167,13 @@ def read(self, length=-1):
if not data_read: # Check to catch possible server errors. Ideally shouldn't happen.
flag += 1
if flag >= 5:
raise DatalakeIncompleteTransferException('Could not read data: {}. '
'Repeated zero byte reads. '
'Possible file corruption'.format(self.path))
exception_string = "Current Location:{loc}, " \
"File Size:{size}, Cache Start:{start}, " \
"Cache End:{end}".format(loc=self.loc, size=self.size,
start=self.start, end=self.end)
raise DatalakeIncompleteTransferException('Could not read data: {path}. '
'Repeated zero byte reads. Possible file corruption. File Details'
'{details}'.format(path=self.path, details=exception_string))
out += data_read
self.loc += len(data_read)
length -= len(data_read)
Expand Down

0 comments on commit 9339b26

Please sign in to comment.