Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Avoid using ObjectUtils.getFirstNonNull in Schema (CASSANDRA-21394)
* Allow nodetool garbagecollect to take a user defined list of SSTables (CASSANDRA-16767)
* Add a guardrail for misprepared statements (CASSANDRA-21139)
* Remove hostname from ClientsTable and GossipInfoTable (CASSANDRA-21539)
Merged from 6.0:
* Reduce allocations in DefaultQueryOptions (CASSANDRA-21467)
* Allow unreserved keywords as user and identity names in USER and IDENTITY statements (CASSANDRA-21510)
Expand Down
15 changes: 5 additions & 10 deletions doc/modules/cassandra/pages/managing/operating/virtualtables.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ We shall discuss some of the virtual tables in more detail next.

The `clients` virtual table lists all active connections (connected
clients) including their ip address, port, client_options, connection stage, driver
name, driver version, hostname, protocol version, request count, ssl
name, driver version, protocol version, request count, ssl
enabled, ssl protocol and user name:

[source, console]
Expand All @@ -190,7 +190,6 @@ cqlsh> SELECT * FROM system_views.clients;
connection_stage | ready
driver_name | DataStax Python Driver
driver_version | 3.25.0
hostname | localhost
protocol_version | 5
request_count | 16
ssl_cipher_suite | null
Expand All @@ -206,7 +205,6 @@ cqlsh> SELECT * FROM system_views.clients;
connection_stage | ready
driver_name | DataStax Python Driver
driver_version | 3.25.0
hostname | localhost
protocol_version | 5
request_count | 4
ssl_cipher_suite | null
Expand All @@ -222,7 +220,6 @@ cqlsh> SELECT * FROM system_views.clients;
connection_stage | ready
driver_name | DataStax Java driver for Apache Cassandra(R)
driver_version | 4.13.0
hostname | localhost
protocol_version | 5
request_count | 18
ssl_cipher_suite | null
Expand All @@ -238,7 +235,6 @@ cqlsh> SELECT * FROM system_views.clients;
connection_stage | ready
driver_name | DataStax Java driver for Apache Cassandra(R)
driver_version | 4.13.0
hostname | localhost
protocol_version | 5
request_count | 7
ssl_cipher_suite | null
Expand Down Expand Up @@ -275,7 +271,6 @@ VIRTUAL TABLE system_views.clients (
connection_stage text,
driver_name text,
driver_version text,
hostname text,
protocol_version int,
request_count bigint,
ssl_cipher_suite text,
Expand Down Expand Up @@ -673,10 +668,10 @@ results in:
+
[source, cql]
----
address | port | connection_stage | driver_name | driver_version | hostname | protocol_version | request_count | ssl_cipher_suite | ssl_enabled | ssl_protocol | username
-----------+-------+------------------+------------------------+----------------+-----------|||+------------------+---------------+------------------+-------------+--------------+-----------
127.0.0.1 | 37308 | ready | DataStax Python Driver | 3.21.0.post0 | localhost | 4 | 17 | null | False | null | anonymous
127.0.0.1 | 37310 | ready | DataStax Python Driver | 3.21.0.post0 | localhost | 4 | 8 | null | False | null | anonymous
address | port | connection_stage | driver_name | driver_version | protocol_version | request_count | ssl_cipher_suite | ssl_enabled | ssl_protocol | username
-----------+-------+------------------+------------------------+----------------+------------------+---------------+------------------+-------------+--------------+-----------
127.0.0.1 | 37308 | ready | DataStax Python Driver | 3.21.0.post0 | 4 | 17 | null | False | null | anonymous
127.0.0.1 | 37310 | ready | DataStax Python Driver | 3.21.0.post0 | 4 | 8 | null | False | null | anonymous

(2 rows)
----
3 changes: 0 additions & 3 deletions src/java/org/apache/cassandra/db/virtual/ClientsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ final class ClientsTable extends AbstractVirtualTable
{
private static final String ADDRESS = "address";
private static final String PORT = "port";
private static final String HOSTNAME = "hostname";
private static final String USERNAME = "username";
private static final String CONNECTION_STAGE = "connection_stage";
private static final String PROTOCOL_VERSION = "protocol_version";
Expand All @@ -61,7 +60,6 @@ final class ClientsTable extends AbstractVirtualTable
.partitioner(new LocalPartitioner(InetAddressType.instance))
.addPartitionKeyColumn(ADDRESS, InetAddressType.instance)
.addClusteringColumn(PORT, Int32Type.instance)
.addRegularColumn(HOSTNAME, UTF8Type.instance)
.addRegularColumn(USERNAME, UTF8Type.instance)
.addRegularColumn(CONNECTION_STAGE, UTF8Type.instance)
.addRegularColumn(PROTOCOL_VERSION, Int32Type.instance)
Expand All @@ -88,7 +86,6 @@ public DataSet data()
InetSocketAddress remoteAddress = client.remoteAddress();

result.row(remoteAddress.getAddress(), remoteAddress.getPort())
.column(HOSTNAME, remoteAddress.getHostName())
.column(USERNAME, client.username().orElse(null))
.column(CONNECTION_STAGE, toLowerCaseLocalized(client.stage().toString()))
.column(PROTOCOL_VERSION, client.protocolVersion())
Expand Down
3 changes: 0 additions & 3 deletions src/java/org/apache/cassandra/db/virtual/GossipInfoTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ final class GossipInfoTable extends AbstractVirtualTable

static final String ADDRESS = "address";
static final String PORT = "port";
static final String HOSTNAME = "hostname";
static final String GENERATION = "generation";
static final String HEARTBEAT = "heartbeat";

Expand Down Expand Up @@ -98,7 +97,6 @@ public DataSet data()
EndpointState localState = new EndpointState(entry.getValue());

SimpleDataSet dataSet = result.row(endpoint.getAddress(), endpoint.getPort())
.column(HOSTNAME, endpoint.getHostName())
.column(GENERATION, getGeneration(localState))
.column(HEARTBEAT, getHeartBeat(localState));

Expand Down Expand Up @@ -175,7 +173,6 @@ private static TableMetadata buildTableMetadata(String keyspace)
.partitioner(new LocalPartitioner(InetAddressType.instance))
.addPartitionKeyColumn(ADDRESS, InetAddressType.instance)
.addClusteringColumn(PORT, Int32Type.instance)
.addRegularColumn(HOSTNAME, UTF8Type.instance)
.addRegularColumn(GENERATION, Int32Type.instance)
.addRegularColumn(HEARTBEAT, Int32Type.instance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void testSelectAll()
shouldUseEncryption(true);
shouldUseClientCertificate(true);
ResultSet result = executeNet("SELECT * FROM vts.clients");
assertThat(result.getColumnDefinitions().size()).isEqualTo(15);
for (Row r : result)
{
Assert.assertEquals(InetAddress.getLoopbackAddress(), r.getInet("address"));
Expand All @@ -78,7 +79,6 @@ public void testSelectAll()
Assert.assertNotNull(r.getMap("client_options", String.class, String.class));
Assert.assertTrue(r.getLong("request_count") > 0 );
// the following are questionable if they belong here
Assert.assertEquals("localhost", r.getString("hostname"));
Assertions.assertThat(r.getMap("client_options", String.class, String.class))
.hasEntrySatisfying("DRIVER_VERSION", value -> assertThat(value.contains(r.getString("driver_name"))))
.hasEntrySatisfying("DRIVER_VERSION", value -> assertThat(value.contains(r.getString("driver_version"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ public void testSelectAllWithStateTransitions() throws Throwable

assertThat(resultSet.size()).isEqualTo(1);
UntypedResultSet.Row row = resultSet.one();
assertThat(row.getColumns().size()).isEqualTo(66);
assertThat(row.getColumns().size()).isEqualTo(65);

assertThat(endpoint).isNotNull();
assertThat(localState).isNotNull();
assertThat(row.getInetAddress("address")).isEqualTo(endpoint.getAddress());
assertThat(row.getInt("port")).isEqualTo(endpoint.getPort());
assertThat(row.getString("hostname")).isEqualTo(endpoint.getHostName());
assertThat(row.getInt("generation")).isEqualTo(localState.getHeartBeatState().getGeneration());
assertThat(row.getInt("heartbeat")).isNotNull();

Expand Down