This is an automated email from the ASF dual-hosted git repository. brandonwilliams pushed a commit to branch cassandra-3.0 in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-3.0 by this push: new 6bb585bf5d Warn when cqlsh does not match the server version it was built with 6bb585bf5d is described below commit 6bb585bf5db106322c9569d76f3178c79ed53d5c Author: Brandon Williams <brandonwilli...@apache.org> AuthorDate: Thu Aug 17 13:23:47 2023 -0500 Warn when cqlsh does not match the server version it was built with Patch by brandonwilliams; reviewed by bereng for CASSANDRA-18745 --- .build/build-cqlsh.xml | 24 ++++++++++++++++++++++++ CHANGES.txt | 1 + bin/cqlsh.py | 11 +++++++++++ build.xml | 3 ++- 4 files changed, 38 insertions(+), 1 deletion(-) 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project basedir="." name="apache-cassandra-cqlsh-tasks" + xmlns:if="ant:if"> + <target name="set-cqlsh-version"> + <echo file="pylib/cqlshlib/serverversion.py" append="false">version = "${base.version}"${line.separator}</echo> + </target> +</project> diff --git a/CHANGES.txt b/CHANGES.txt index ea9b1024e3..702733eaaf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 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 3e5cac1470..f9fcc656d5 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -171,6 +171,7 @@ from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT, 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 @@ -797,6 +798,8 @@ class Shell(cmd.Cmd): if stdin is None: stdin = sys.stdin + self.check_build_versions() + if tty: self.reset_prompt() self.report_connection() @@ -816,6 +819,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 dd75f1746c..76525e35d4 100644 --- a/build.xml +++ b/build.xml @@ -684,7 +684,7 @@ </target> <!-- create properties file with C version --> - <target name="createVersionPropFile"> + <target name="createVersionPropFile" depends="set-cqlsh-version"> <taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/> <mkdir dir="${version.properties.dir}"/> <propertyfile file="${version.properties.dir}/version.properties"> @@ -1970,4 +1970,5 @@ <import file="${basedir}/.build/build-resolver.xml"/> <import file="${basedir}/.build/build-rat.xml"/> <import file="${basedir}/.build/build-owasp.xml"/> + <import file="${basedir}/.build/build-cqlsh.xml"/> </project> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org