diff --git a/.build/build-cqlsh.xml b/.build/build-cqlsh.xml new file mode 100644 index 0000000000..45e0e46a49 --- /dev/null +++ b/.build/build-cqlsh.xml @@ -0,0 +1,24 @@ + + + + + version = "${base.version}"${line.separator} + + diff --git a/CHANGES.txt b/CHANGES.txt index b8f489b183..7ee07ec953 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,7 @@ 3.11.17 Merged from 3.0: +3.0.30 + * CQLSH emits a warning when the server version doesn't match (CASSANDRA-18745) * Fix missing speculative retries in tablestats (CASSANDRA-18767) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index ba32369529..a2f1a9e5ed 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -175,6 +175,7 @@ from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT, format_by_type, formatter_for) from cqlshlib.tracing import print_trace, print_trace_session from cqlshlib.util import get_file_encoding_bomsize, trim_if_present +from cqlshlib.serverversion import version as build_version DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 9042 @@ -531,6 +532,8 @@ class Shell(cmd.Cmd): if stdin is None: stdin = sys.stdin + self.check_build_versions() + if tty: self.reset_prompt() self.report_connection() @@ -550,6 +553,14 @@ class Shell(cmd.Cmd): def batch_mode(self): return not self.tty + def check_build_versions(self): + baseversion = self.connection_versions['build'] + extra = baseversion.rfind('-') + if extra: + baseversion = baseversion[0:extra] + if baseversion != build_version: + print("WARNING: cqlsh was built against {}, but this server is {}. All features may not work!".format(baseversion, build_version)) + @property def is_using_utf8(self): # utf8 encodings from https://docs.python.org/{2,3}/library/codecs.html diff --git a/build.xml b/build.xml index 30af43ac4d..aa1fc02afc 100644 --- a/build.xml +++ b/build.xml @@ -695,7 +695,7 @@ - + @@ -1972,4 +1972,5 @@ +