Add a warning to cqlsh 6.0.0 that DESCRIBE does not work with a Cassandra 3.x servers

patch by Ekaterina Dimitrova; reviewed by Adam Holmberg and Benjamin Lerer for CASSANDRA-16652
This commit is contained in:
Ekaterina Dimitrova 2021-05-11 20:01:15 -04:00
parent 2ca525b6b7
commit 77a370c424
3 changed files with 29 additions and 20 deletions

View File

@ -1,4 +1,5 @@
4.0-rc2
* Add a warning to cqlsh 6.0.0 that DESCRIBE does not work with a Cassandra 3.x servers (CASSANDRA-16652)
* cqlsh: fix DESC TYPE with non-ascii character in the identifier (CASSANDRA-16400)
* Remove drivers dependency and bring cql_keywords_reserved on server side (CASSANDRA-16659)
* Fix in-browser "help", Python 3 (CASSANDRA-16658)

View File

@ -124,6 +124,8 @@ New features
Upgrading
---------
- DESCRIBE|DESC was moved to server side in Cassandra 4.0. As a consequence DESRIBE|DESC will not work in cqlsh 6.0.0
being connected to earlier major Cassandra versions where DESCRIBE does not exist server side.
- cqlsh shell startup script now prefers 'python3' before 'python' when identifying a runtime.
- As part of the Internode Messaging improvement work in CASSANDRA-15066, matching response verbs for every request
verb were introduced and verbs were renamed. DroppedMessageMetrics pre-4.0 are now available with _REQ suffix. As

View File

@ -1369,30 +1369,36 @@ class Shell(cmd.Cmd):
stmt = SimpleStatement(parsed.extract_orig(), consistency_level=cassandra.ConsistencyLevel.LOCAL_ONE, fetch_size=self.page_size if self.use_paging else None)
future = self.session.execute_async(stmt)
try:
result = future.result()
if self.connection_versions['build'][0] < '4':
print('\nWARN: DESCRIBE|DESC was moved to server side in Cassandra 4.0. As a consequence DESRIBE|DESC '
'will not work in cqlsh %r connected to Cassandra %r, the version that you are connected to. '
'DESCRIBE does not exist server side prior Cassandra 4.0.'
% (version, self.connection_versions['build']))
else:
try:
result = future.result()
what = parsed.matched[1][1].lower()
what = parsed.matched[1][1].lower()
if what in ('columnfamilies', 'tables', 'types', 'functions', 'aggregates'):
self.describe_list(result)
elif what == 'keyspaces':
self.describe_keyspaces(result)
elif what == 'cluster':
self.describe_cluster(result)
elif what:
self.describe_element(result)
if what in ('columnfamilies', 'tables', 'types', 'functions', 'aggregates'):
self.describe_list(result)
elif what == 'keyspaces':
self.describe_keyspaces(result)
elif what == 'cluster':
self.describe_cluster(result)
elif what:
self.describe_element(result)
except CQL_ERRORS as err:
err_msg = ensure_text(err.message if hasattr(err, 'message') else str(err))
self.printerr(err_msg.partition("message=")[2].strip('"'))
except Exception:
import traceback
self.printerr(traceback.format_exc())
except CQL_ERRORS as err:
err_msg = ensure_text(err.message if hasattr(err, 'message') else str(err))
self.printerr(err_msg.partition("message=")[2].strip('"'))
except Exception:
import traceback
self.printerr(traceback.format_exc())
if future:
if future.warnings:
self.print_warnings(future.warnings)
if future:
if future.warnings:
self.print_warnings(future.warnings)
do_desc = do_describe