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 90f8f99dfe..a96137164e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ Merged from 3.11: * Moved jflex from runtime to build dependencies (CASSANDRA-18664) 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) * Fix Requires for Java for RPM package (CASSANDRA-18751) * Fix CQLSH online help topic link (CASSANDRA-17534) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 00bd00d134..4ca4469604 100755 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -165,6 +165,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 @@ -511,6 +512,8 @@ class Shell(cmd.Cmd): if stdin is None: stdin = sys.stdin + self.check_build_versions() + if tty: self.reset_prompt() self.maybe_warn_py2() @@ -532,6 +535,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 ec1aba8368..0b914175bb 100644 --- a/build.xml +++ b/build.xml @@ -864,7 +864,7 @@ - + @@ -2223,4 +2223,5 @@ +