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 e7b058cfa2..ecb58c25ca 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Merged from 4.0:
* Migrate Python optparse to argparse (CASSANDRA-17914)
Merged from 3.11:
Merged from 3.0:
+ * 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 0a656c2d32..ca381a904f 100755
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -155,6 +155,7 @@ from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT,
from cqlshlib.tracing import print_trace, print_trace_session
from cqlshlib.util import get_file_encoding_bomsize
from cqlshlib.util import is_file_secure
+from cqlshlib.serverversion import version as build_version
DEFAULT_HOST = '127.0.0.1'
@@ -521,6 +522,8 @@ class Shell(cmd.Cmd):
if stdin is None:
stdin = sys.stdin
+ self.check_build_versions()
+
if tty:
self.reset_prompt()
self.report_connection()
@@ -537,6 +540,14 @@ class Shell(cmd.Cmd):
self.single_statement = single_statement
self.is_subshell = is_subshell
+ 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 batch_mode(self):
return not self.tty
diff --git a/build.xml b/build.xml
index f99fe469f4..3593d4bd70 100644
--- a/build.xml
+++ b/build.xml
@@ -900,7 +900,7 @@
-
+
@@ -2406,4 +2406,5 @@
+