Skip to content

Commit 6a5fab5

Browse files
committed
(improvement) log a warning when importing of lz4 or snappy packages fails.
If it is not available, the driver will silently not use compression. Not very very silently, as you will see in debug level only something like: "No available compression types supported on both ends. locally supported: odict_keys([]). remotely supported: ['lz4', 'snappy']" Make this log line a an error level log. Add to the import failure a debug level log. I think it wouldn't be too noisy and is clear enough for the developer. Signed-off-by: Yaniv Kaul <[email protected]>
1 parent 472b679 commit 6a5fab5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cassandra/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
try:
6565
import lz4
6666
except ImportError:
67+
log.debug("lz4 package could not be imported. LZ4 Compression will not be available")
6768
pass
6869
else:
6970
# The compress and decompress functions we need were moved from the lz4 to
@@ -102,6 +103,7 @@ def lz4_decompress(byts):
102103
try:
103104
import snappy
104105
except ImportError:
106+
log.debug("snappy package could not be imported. Snappy Compression will not be available")
105107
pass
106108
else:
107109
# work around apparently buggy snappy decompress
@@ -1408,7 +1410,7 @@ def _handle_options_response(self, options_response):
14081410
overlap = (set(locally_supported_compressions.keys()) &
14091411
set(remote_supported_compressions))
14101412
if len(overlap) == 0:
1411-
log.debug("No available compression types supported on both ends."
1413+
log.error("No available compression types supported on both ends."
14121414
" locally supported: %r. remotely supported: %r",
14131415
locally_supported_compressions.keys(),
14141416
remote_supported_compressions)

0 commit comments

Comments
 (0)