Merge branch 'cassandra-5.0' into trunk

This commit is contained in:
Brandon Williams 2023-08-18 10:15:46 -05:00
commit 94c3cf74ef
4 changed files with 43 additions and 4 deletions

24
.build/build-cqlsh.xml Normal file
View File

@ -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>

View File

@ -198,6 +198,11 @@ Merged from 4.0:
* Partial compaction can resurrect deleted data (CASSANDRA-18507)
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)
* Remove unused suppressions (CASSANDRA-18724)
4.1.4

View File

@ -456,7 +456,7 @@
</target>
<!-- create properties file with C version -->
<target name="_createVersionPropFile" depends="_get-git-sha">
<target name="_createVersionPropFile" depends="_get-git-sha,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">
@ -2073,4 +2073,5 @@
<import file="${build.helpers.dir}/build-owasp.xml"/>
<import file="${build.helpers.dir}/build-git.xml"/>
<import file="${build.helpers.dir}/build-checkstyle.xml"/>
<import file="${build.helpers.dir}/build-cqlsh.xml"/>
</project>

View File

@ -82,9 +82,8 @@ from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT,
DEFAULT_TIMESTAMP_FORMAT, CqlType, DateTimeFormat,
format_by_type)
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.util import get_file_encoding_bomsize, is_file_secure
from cqlshlib.serverversion import version as build_version
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 9042
@ -433,6 +432,8 @@ class Shell(cmd.Cmd):
if stdin is None:
stdin = sys.stdin
self.check_build_versions()
if tty:
self.reset_prompt()
self.report_connection()
@ -449,6 +450,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