diff --git a/HISTORY.rst b/HISTORY.rst index b2a6be6..9f0cedd 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,10 @@ Release History =============== +0.0.52 (2020-11-29) ++++++++++++++++++++ +* Don't invalidate cache when opening files with mode rb, speed up small reads 2x. + 0.0.51 (2020-10-15) +++++++++++++++++++ * Add more logging for zero byte reads to investigate root cause. diff --git a/azure/datalake/store/core.py b/azure/datalake/store/core.py index 9427ae1..f40e5d0 100644 --- a/azure/datalake/store/core.py +++ b/azure/datalake/store/core.py @@ -993,7 +993,8 @@ def __init__(self, azure, path, mode='rb', blocksize=2 ** 25, # always invalidate the cache when checking for existence of a file # that may be created or written to (for the first time). try: - file_data = self.azure.info(path, invalidate_cache=True, expected_error_code=404) + invalidate = mode != 'rb' + file_data = self.azure.info(path, invalidate_cache=invalidate, expected_error_code=404) exists = True except FileNotFoundError: exists = False