This is an automated email from the ASF dual-hosted git repository. maedhroz pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 86868c6df88b23af3941a087b9f6e7082065d6db Merge: 8e355197f0 2651623af6 Author: Caleb Rackliffe <[email protected]> AuthorDate: Mon Dec 9 15:06:39 2024 -0600 Merge branch 'cassandra-5.0' into trunk * cassandra-5.0: Interpret inet, bigint, varint, and decimal as non-reversed types for query construction and post-filtering CHANGES.txt | 1 + .../cassandra/index/sai/utils/IndexTermType.java | 49 ++++++--- .../sai/cql/DescClusteringRangeQueryTest.java | 112 +++++++++++++++++---- 3 files changed, 130 insertions(+), 32 deletions(-) diff --cc CHANGES.txt index 08ff72184a,6fbc22f8fb..c9d9cb17e0 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,108 -1,6 +1,109 @@@ -5.0.3 +5.1 + * Fix RequestFailureReason constants codes (CASSANDRA-20126) + * Introduce SSTableSimpleScanner for compaction (CASSANDRA-20092) + * Include column drop timestamp in alter table transformation (CASSANDRA-18961) + * Make JMX SSL configurable in cassandra.yaml (CASSANDRA-18508) + * Fix cqlsh CAPTURE command to save query results without trace details when TRACING is ON (CASSANDRA-19105) + * Optionally prevent tombstone purging during repair (CASSANDRA-20071) + * Add post-filtering support for the IN operator in SAI queries (CASSANDRA-20025) + * Don’t finish ongoing decommission and move operations during startup (CASSANDRA-20040) + * Nodetool reconfigure cms has correct return code when streaming fails (CASSANDRA-19972) + * Reintroduce RestrictionSet#iterator() optimization around multi-column restrictions (CASSANDRA-20034) + * Explicitly localize strings to Locale.US for internal implementation (CASSANDRA-19953) + * Add -H option for human-friendly output in nodetool compactionhistory (CASSANDRA-20015) + * Fix type check for referenced duration type for nested types (CASSANDRA-19890) + * In simulation tests, correctly set the tokens of replacement nodes (CASSANDRA-19997) + * During TCM upgrade, retain all properties of existing system tables (CASSANDRA-19992) + * Properly cancel in-flight futures and reject requests in EpochAwareDebounce during shutdown (CASSANDRA-19848) + * Provide clearer exception message on failing commitlog_disk_access_mode combinations (CASSANDRA-19812) + * Add total space used for a keyspace to nodetool tablestats (CASSANDRA-19671) + * Ensure Relation#toRestriction() handles ReversedType properly (CASSANDRA-19950) + * Add JSON and YAML output option to nodetool gcstats (CASSANDRA-19771) + * Introduce metadata serialization version V4 (CASSANDRA-19970) + * Allow CMS reconfiguration to work around DOWN nodes (CASSANDRA-19943) + * Make TableParams.Serializer set allowAutoSnapshots and incrementalBackups (CASSANDRA-19954) + * Make sstabledump possible to show tombstones only (CASSANDRA-19939) + * Ensure that RFP queries potentially stale replicas even with only key columns in the row filter (CASSANDRA-19938) + * Allow nodes to change IP address while upgrading to TCM (CASSANDRA-19921) + * Retain existing keyspace params on system tables after upgrade (CASSANDRA-19916) + * Deprecate use of gossip state for paxos electorate verification (CASSANDRA-19904) + * Update dtest-api to 0.0.17 to fix jvm17 crash in jvm-dtests (CASSANDRA-19239) + * Add resource leak test and Update Netty to 4.1.113.Final to fix leak (CASSANDRA-19783) + * Fix incorrect nodetool suggestion when gossip mode is running (CASSANDRA-19905) + * SAI support for BETWEEN operator (CASSANDRA-19688) + * Fix BETWEEN filtering for reversed clustering columns (CASSANDRA-19878) + * Retry if node leaves CMS while committing a transformation (CASSANDRA-19872) + * Add support for NOT operators in WHERE clauses. Fixed Three Valued Logic (CASSANDRA-18584) + * Allow getendpoints for system tables and make sure getNaturalReplicas work for MetaStrategy (CASSANDRA-19846) + * On upgrade, handle pre-existing tables with unexpected table ids (CASSANDRA-19845) + * Reconfigure CMS before assassinate (CASSANDRA-19768) + * Warn about unqualified prepared statement only if it is select or modification statement (CASSANDRA-18322) + * Update legacy peers tables during node replacement (CASSANDRA-19782) + * Refactor ColumnCondition (CASSANDRA-19620) + * Allow configuring log format for Audit Logs (CASSANDRA-19792) + * Support for noboolean rpm (centos7 compatible) packages removed (CASSANDRA-19787) + * Allow threads waiting for the metadata log follower to be interrupted (CASSANDRA-19761) + * Support dictionary lookup for CassandraPasswordValidator (CASSANDRA-19762) + * Disallow denylisting keys in system_cluster_metadata (CASSANDRA-19713) + * Fix gossip status after replacement (CASSANDRA-19712) + * Ignore repair requests for system_cluster_metadata (CASSANDRA-19711) + * Avoid ClassCastException when verifying tables with reversed partitioner (CASSANDRA-19710) + * Always repair the full range when repairing system_cluster_metadata (CASSANDRA-19709) + * Use table-specific partitioners during Paxos repair (CASSANDRA-19714) + * Expose current compaction throughput in nodetool (CASSANDRA-13890) + * CEP-24 Password validation / generation (CASSANDRA-17457) + * Reconfigure CMS after replacement, bootstrap and move operations (CASSANDRA-19705) + * Support querying LocalStrategy tables with any partitioner (CASSANDRA-19692) + * Relax slow_query_log_timeout for MultiNodeSAITest (CASSANDRA-19693) + * Audit Log entries are missing identity for mTLS connections (CASSANDRA-19669) + * Add support for the BETWEEN operator in WHERE clauses (CASSANDRA-19604) + * Replace Stream iteration with for-loop for SimpleRestriction::bindAndGetClusteringElements (CASSANDRA-19679) + * Consolidate logging on trace level (CASSANDRA-19632) + * Expand DDL statements on coordinator before submission to the CMS (CASSANDRA-19592) + * Fix number of arguments of String.format() in various classes (CASSANDRA-19645) + * Remove unused fields from config (CASSANDRA-19599) + * Refactor Relation and Restriction hierarchies (CASSANDRA-19341) + * Raise priority of TCM internode messages during critical operations (CASSANDRA-19517) + * Add nodetool command to unregister LEFT nodes (CASSANDRA-19581) + * Add cluster metadata id to gossip syn messages (CASSANDRA-19613) + * Reduce heap usage occupied by the metrics (CASSANDRA-19567) + * Improve handling of transient replicas during range movements (CASSANDRA-19344) + * Enable debounced internode log requests to be cancelled at shutdown (CASSANDRA-19514) + * Correctly set last modified epoch when combining multistep operations into a single step (CASSANDRA-19538) + * Add new TriggersPolicy configuration to allow operators to disable triggers (CASSANDRA-19532) + * Use Transformation.Kind.id in local and distributed log tables (CASSANDRA-19516) + * Remove period field from ClusterMetadata and metadata log tables (CASSANDRA-19482) + * Enrich system_views.pending_hints vtable with hints sizes (CASSANDRA-19486) + * Expose all dropwizard metrics in virtual tables (CASSANDRA-14572) + * Ensured that PropertyFileSnitchTest do not overwrite cassandra-toploogy.properties (CASSANDRA-19502) + * Add option for MutualTlsAuthenticator to restrict the certificate validity period (CASSANDRA-18951) + * Fix StorageService::constructRangeToEndpointMap for non-distributed keyspaces (CASSANDRA-19255) + * Group nodetool cms commands into single command group (CASSANDRA-19393) + * Register the measurements of the bootstrap process as Dropwizard metrics (CASSANDRA-19447) + * Add LIST SUPERUSERS CQL statement (CASSANDRA-19417) + * Modernize CQLSH datetime conversions (CASSANDRA-18879) + * Harry model and in-JVM tests for partition-restricted 2i queries (CASSANDRA-18275) + * Refactor cqlshmain global constants (CASSANDRA-19201) + * Remove native_transport_port_ssl (CASSANDRA-19397) + * Make nodetool reconfigurecms sync by default and add --cancel to be able to cancel ongoing reconfigurations (CASSANDRA-19216) + * Expose auth mode in system_views.clients, nodetool clientstats, metrics (CASSANDRA-19366) + * Remove sealed_periods and last_sealed_period tables (CASSANDRA-19189) + * Improve setup and initialisation of LocalLog/LogSpec (CASSANDRA-19271) + * Refactor structure of caching metrics and expose auth cache metrics via JMX (CASSANDRA-17062) + * Allow CQL client certificate authentication to work without sending an AUTHENTICATE request (CASSANDRA-18857) + * Extend nodetool tpstats and system_views.thread_pools with detailed pool parameters (CASSANDRA-19289) + * Remove dependency on Sigar in favor of OSHI (CASSANDRA-16565) + * Simplify the bind marker and Term logic (CASSANDRA-18813) + * Limit cassandra startup to supported JDKs, allow higher JDKs by setting CASSANDRA_JDK_UNSUPPORTED (CASSANDRA-18688) + * Standardize nodetool tablestats formatting of data units (CASSANDRA-19104) + * Make nodetool tablestats use number of significant digits for time and average values consistently (CASSANDRA-19015) + * Upgrade jackson to 2.15.3 and snakeyaml to 2.1 (CASSANDRA-18875) + * Transactional Cluster Metadata [CEP-21] (CASSANDRA-18330) + * Add ELAPSED command to cqlsh (CASSANDRA-18861) + * Add the ability to disable bulk loading of SSTables (CASSANDRA-18781) + * Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787) +Merged from 5.0: + * Interpret inet, bigint, varint, and decimal as non-reversed types for query construction and post-filtering (CASSANDRA-20100) - * Fix delayed gossip shutdown messages clobbering startup states that leave restarted nodes appearing down (CASSANDRA-20033) * Streamline the serialized format for index status gossip messages (CASSANDRA-20058) * Batch clusterings into single SAI partition post-filtering reads (CASSANDRA-19497) * Ban the usage of "var" instead of full types in the production code (CASSANDRA-20038) diff --cc test/unit/org/apache/cassandra/index/sai/cql/DescClusteringRangeQueryTest.java index 0ac25ecc6b,7a93947cfd..b85ca4aab9 --- a/test/unit/org/apache/cassandra/index/sai/cql/DescClusteringRangeQueryTest.java +++ b/test/unit/org/apache/cassandra/index/sai/cql/DescClusteringRangeQueryTest.java @@@ -37,11 -41,30 +41,34 @@@ public class DescClusteringRangeQueryTe execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 3, 'MA')"); execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 4, 'TX')"); - ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); - assertRowsNet(rangeRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + beforeAndAfterFlush(() -> + { + ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); + assertRowsNet(rangeRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); ++ ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); ++ assertRowsNet(betweenRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + }); + } - ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); - assertRowsNet(betweenRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + @Test + public void testReversedLongBetween() throws Throwable + { + createTable("CREATE TABLE %s(p int, c bigint, abbreviation ascii, PRIMARY KEY (p, c)) WITH CLUSTERING ORDER BY (c DESC)"); + createIndex("CREATE INDEX clustering_test_index ON %s(c) USING 'sai'"); + createIndex("CREATE INDEX abbreviation_test_index ON %s(abbreviation) USING 'sai'"); + + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 1, 'CA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 2, 'MA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 3, 'MA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 4, 'TX')"); + + beforeAndAfterFlush(() -> + { + ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); + assertRowsNet(rangeRowsNet, row (0, 3L, "MA"), row (0, 2L, "MA")); ++ ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); ++ assertRowsNet(betweenRowsNet, row (0, 3L, "MA"), row (0, 2L, "MA")); + }); } @Test @@@ -56,11 -79,30 +83,34 @@@ execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 3, 'MA')"); execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 4, 'TX')"); - ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); - assertRowsNet(rangeRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + beforeAndAfterFlush(() -> + { + ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); + assertRowsNet(rangeRowsNet, row (0, new BigInteger("3"), "MA"), row (0, new BigInteger("2"), "MA")); ++ ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); ++ assertRowsNet(betweenRowsNet, row (0, new BigInteger("3"), "MA"), row (0, new BigInteger("2"), "MA")); + }); + } - ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); - assertRowsNet(betweenRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + @Test + public void testReversedBigDecimalBetween() throws Throwable + { + createTable("CREATE TABLE %s(p int, c decimal, abbreviation ascii, PRIMARY KEY (p, c)) WITH CLUSTERING ORDER BY (c DESC)"); + createIndex("CREATE INDEX clustering_test_index ON %s(c) USING 'sai'"); + createIndex("CREATE INDEX abbreviation_test_index ON %s(abbreviation) USING 'sai'"); + + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 1.1, 'CA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 2.1, 'MA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 2.9, 'MA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 4.0, 'TX')"); + + beforeAndAfterFlush(() -> + { + ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c > 1.9 AND c < 3.0 AND abbreviation = 'MA'"); + assertRowsNet(rangeRowsNet, row (0, new BigDecimal("2.9"), "MA"), row (0, new BigDecimal("2.1"), "MA")); ++ ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 1.9 AND 3.0 AND abbreviation = 'MA'"); ++ assertRowsNet(betweenRowsNet, row (0, new BigDecimal("2.9"), "MA"), row (0, new BigDecimal("2.1"), "MA")); + }); } @Test @@@ -70,16 -112,34 +120,38 @@@ createIndex("CREATE INDEX clustering_test_index ON %s(c) USING 'sai'"); createIndex("CREATE INDEX abbreviation_test_index ON %s(abbreviation) USING 'sai'"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, '127.0.0.1', 'CA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, '127.0.0.2', 'MA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, '127.0.0.3', 'MA')"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, '127.0.0.4', 'TX')"); + + beforeAndAfterFlush(() -> + { + ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= '127.0.0.2' AND c <= '127.0.0.3' AND abbreviation = 'MA'"); + assertRowsNet(rangeRowsNet, row (0, InetAddress.getByName("127.0.0.3"), "MA"), row (0, InetAddress.getByName("127.0.0.2"), "MA")); ++ ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN '127.0.0.2' AND '127.0.0.3' AND abbreviation = 'MA'"); ++ assertRowsNet(betweenRowsNet, row (0, InetAddress.getByName("127.0.0.3"), "MA"), row (0, InetAddress.getByName("127.0.0.2"), "MA")); + }); + } + + @Test + public void testReversedIntBetweenWithAnalyzer() throws Throwable + { + createTable("CREATE TABLE %s(p int, c int, abbreviation ascii, PRIMARY KEY (p, c)) WITH CLUSTERING ORDER BY (c DESC)"); + createIndex("CREATE INDEX clustering_test_index ON %s(c) USING 'sai'"); + createIndex("CREATE INDEX abbreviation_test_index ON %s(abbreviation) USING 'sai' WITH OPTIONS = {'case_sensitive': 'false'}"); + execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 1, 'CA')"); execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 2, 'MA')"); execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 3, 'MA')"); execute("INSERT INTO %s(p, c, abbreviation) VALUES (0, 4, 'TX')"); - flush(); - - ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); - assertRowsNet(rangeRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); - ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); - assertRowsNet(betweenRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + beforeAndAfterFlush(() -> + { + ResultSet rangeRowsNet = executeNet("SELECT * FROM %s WHERE c >= 2 AND c <= 3 AND abbreviation = 'MA'"); + assertRowsNet(rangeRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); ++ ResultSet betweenRowsNet = executeNet("SELECT * FROM %s WHERE c BETWEEN 2 AND 3 AND abbreviation = 'MA'"); ++ assertRowsNet(betweenRowsNet, row (0, 3, "MA"), row (0, 2, "MA")); + }); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
