mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-02 22:25:48 +00:00
This PR adds server-side `DESCRIBE` statement, which is required in latest cqlsh version. The only change from the user perspective is the `DESC ...` statement can be used with cqlsh version >= 6.0. Previously the statement was executed from client side, but starting with Cassandra 4.0 and cqlsh 6.0, execution of describe was moved to server side, so the user was unable to do `DESC ...` with Scylla and cqlsh 6.0. Implemented describe statements: - `DESC CLUSTER` - `DESC [FULL] SCHEMA` - `DESC [ONLY] KEYSPACE` - `DESC KEYSPACES/TYPES/FUNCTIONS/AGGREGATES/TABLES` - `DESC TYPE/FUNCTION/AGGREGATE/MATERIALIZED VIEW/INDEX/TABLE` - `DESC` [Cassandra's implementation for reference](https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java) Changes in this patch: - cql3::util: added `single_quite()` function - added `data_dictionary::keyspace_element` interface - implemented `data_dictionary::keyspace_element` for: - keyspace_metadata, - UDT, UDF, UDA - schema - cql3::functions: added `get_user_functions()` and `get_user_aggregates()` to get all UDFs/UDAs in specified keyspace - data_dictionary::user_types_metadata: added `has_type()` function - extracted `describe_ring()` from storage_service to standalone helper function in `locator/util.hh` - storage_proxy: added `describe_ring()` (implemented using helper function mentioned above) - extended CQL grammar to handle describe statement - increased version in `version.hh` to 4.0.0, so cqlsh will use server-side describe statement Referring: https://github.com/scylladb/scylla/issues/9571, https://github.com/scylladb/scylladb/issues/11475 Closes #11106 * github.com:scylladb/scylladb: version: Increasing version cql-pytest: Add tests for server-side describe statement cql-pytest: creating random elements for describe's tests cql3: Extend CQL grammar with server-side describe statement cql3:statements: server-side describe statement data_dictonary: add `get_all_keyspaces()` and `get_user_keyspaces()` storage_proxy: add `describe_ring()` method storage_service, locator: extract describe_ring() data_dictionary:user_types_metadata: add has_type() function cql3:functions: `get_user_functions()` and `get_user_aggregates()` implement `keyspace_element` interface data_dictionary: add `keyspace_element` interface cql3: single_quote() util function view: row_lock: lock_ck: reindent test/topology: enable replace tests service/raft: report an error when Raft ID can't be found in `raft_group0::remove_from_group0` service: handle replace correctly with Raft enabled gms/gossiper: fetch RAFT_SERVER_ID during shadow round service: storage_service: sleep 2*ring_delay instead of BROADCAST_INTERVAL before replace