mirror of https://github.com/apache/cassandra
Remove hostname field from both tables since it's already in the primary key
This commit is contained in:
parent
8fd77ffea3
commit
ba974a1fda
|
|
@ -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
|
The `clients` virtual table lists all active connections (connected
|
||||||
clients) including their ip address, port, client_options, connection stage, driver
|
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:
|
enabled, ssl protocol and user name:
|
||||||
|
|
||||||
[source, console]
|
[source, console]
|
||||||
|
|
@ -190,7 +190,6 @@ cqlsh> SELECT * FROM system_views.clients;
|
||||||
connection_stage | ready
|
connection_stage | ready
|
||||||
driver_name | DataStax Python Driver
|
driver_name | DataStax Python Driver
|
||||||
driver_version | 3.25.0
|
driver_version | 3.25.0
|
||||||
hostname | localhost
|
|
||||||
protocol_version | 5
|
protocol_version | 5
|
||||||
request_count | 16
|
request_count | 16
|
||||||
ssl_cipher_suite | null
|
ssl_cipher_suite | null
|
||||||
|
|
@ -206,7 +205,6 @@ cqlsh> SELECT * FROM system_views.clients;
|
||||||
connection_stage | ready
|
connection_stage | ready
|
||||||
driver_name | DataStax Python Driver
|
driver_name | DataStax Python Driver
|
||||||
driver_version | 3.25.0
|
driver_version | 3.25.0
|
||||||
hostname | localhost
|
|
||||||
protocol_version | 5
|
protocol_version | 5
|
||||||
request_count | 4
|
request_count | 4
|
||||||
ssl_cipher_suite | null
|
ssl_cipher_suite | null
|
||||||
|
|
@ -222,7 +220,6 @@ cqlsh> SELECT * FROM system_views.clients;
|
||||||
connection_stage | ready
|
connection_stage | ready
|
||||||
driver_name | DataStax Java driver for Apache Cassandra(R)
|
driver_name | DataStax Java driver for Apache Cassandra(R)
|
||||||
driver_version | 4.13.0
|
driver_version | 4.13.0
|
||||||
hostname | localhost
|
|
||||||
protocol_version | 5
|
protocol_version | 5
|
||||||
request_count | 18
|
request_count | 18
|
||||||
ssl_cipher_suite | null
|
ssl_cipher_suite | null
|
||||||
|
|
@ -238,7 +235,6 @@ cqlsh> SELECT * FROM system_views.clients;
|
||||||
connection_stage | ready
|
connection_stage | ready
|
||||||
driver_name | DataStax Java driver for Apache Cassandra(R)
|
driver_name | DataStax Java driver for Apache Cassandra(R)
|
||||||
driver_version | 4.13.0
|
driver_version | 4.13.0
|
||||||
hostname | localhost
|
|
||||||
protocol_version | 5
|
protocol_version | 5
|
||||||
request_count | 7
|
request_count | 7
|
||||||
ssl_cipher_suite | null
|
ssl_cipher_suite | null
|
||||||
|
|
@ -275,7 +271,6 @@ VIRTUAL TABLE system_views.clients (
|
||||||
connection_stage text,
|
connection_stage text,
|
||||||
driver_name text,
|
driver_name text,
|
||||||
driver_version text,
|
driver_version text,
|
||||||
hostname text,
|
|
||||||
protocol_version int,
|
protocol_version int,
|
||||||
request_count bigint,
|
request_count bigint,
|
||||||
ssl_cipher_suite text,
|
ssl_cipher_suite text,
|
||||||
|
|
@ -673,10 +668,10 @@ results in:
|
||||||
+
|
+
|
||||||
[source, cql]
|
[source, cql]
|
||||||
----
|
----
|
||||||
address | port | connection_stage | driver_name | driver_version | hostname | protocol_version | request_count | ssl_cipher_suite | ssl_enabled | ssl_protocol | username
|
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 | localhost | 4 | 17 | null | False | null | anonymous
|
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 | localhost | 4 | 8 | 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)
|
(2 rows)
|
||||||
----
|
----
|
||||||
|
|
@ -38,7 +38,6 @@ final class ClientsTable extends AbstractVirtualTable
|
||||||
{
|
{
|
||||||
private static final String ADDRESS = "address";
|
private static final String ADDRESS = "address";
|
||||||
private static final String PORT = "port";
|
private static final String PORT = "port";
|
||||||
private static final String HOSTNAME = "hostname";
|
|
||||||
private static final String USERNAME = "username";
|
private static final String USERNAME = "username";
|
||||||
private static final String CONNECTION_STAGE = "connection_stage";
|
private static final String CONNECTION_STAGE = "connection_stage";
|
||||||
private static final String PROTOCOL_VERSION = "protocol_version";
|
private static final String PROTOCOL_VERSION = "protocol_version";
|
||||||
|
|
@ -61,7 +60,6 @@ final class ClientsTable extends AbstractVirtualTable
|
||||||
.partitioner(new LocalPartitioner(InetAddressType.instance))
|
.partitioner(new LocalPartitioner(InetAddressType.instance))
|
||||||
.addPartitionKeyColumn(ADDRESS, InetAddressType.instance)
|
.addPartitionKeyColumn(ADDRESS, InetAddressType.instance)
|
||||||
.addClusteringColumn(PORT, Int32Type.instance)
|
.addClusteringColumn(PORT, Int32Type.instance)
|
||||||
.addRegularColumn(HOSTNAME, UTF8Type.instance)
|
|
||||||
.addRegularColumn(USERNAME, UTF8Type.instance)
|
.addRegularColumn(USERNAME, UTF8Type.instance)
|
||||||
.addRegularColumn(CONNECTION_STAGE, UTF8Type.instance)
|
.addRegularColumn(CONNECTION_STAGE, UTF8Type.instance)
|
||||||
.addRegularColumn(PROTOCOL_VERSION, Int32Type.instance)
|
.addRegularColumn(PROTOCOL_VERSION, Int32Type.instance)
|
||||||
|
|
@ -88,7 +86,6 @@ final class ClientsTable extends AbstractVirtualTable
|
||||||
InetSocketAddress remoteAddress = client.remoteAddress();
|
InetSocketAddress remoteAddress = client.remoteAddress();
|
||||||
|
|
||||||
result.row(remoteAddress.getAddress(), remoteAddress.getPort())
|
result.row(remoteAddress.getAddress(), remoteAddress.getPort())
|
||||||
.column(HOSTNAME, remoteAddress.getHostName())
|
|
||||||
.column(USERNAME, client.username().orElse(null))
|
.column(USERNAME, client.username().orElse(null))
|
||||||
.column(CONNECTION_STAGE, toLowerCaseLocalized(client.stage().toString()))
|
.column(CONNECTION_STAGE, toLowerCaseLocalized(client.stage().toString()))
|
||||||
.column(PROTOCOL_VERSION, client.protocolVersion())
|
.column(PROTOCOL_VERSION, client.protocolVersion())
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ final class GossipInfoTable extends AbstractVirtualTable
|
||||||
|
|
||||||
static final String ADDRESS = "address";
|
static final String ADDRESS = "address";
|
||||||
static final String PORT = "port";
|
static final String PORT = "port";
|
||||||
static final String HOSTNAME = "hostname";
|
|
||||||
static final String GENERATION = "generation";
|
static final String GENERATION = "generation";
|
||||||
static final String HEARTBEAT = "heartbeat";
|
static final String HEARTBEAT = "heartbeat";
|
||||||
|
|
||||||
|
|
@ -98,7 +97,6 @@ final class GossipInfoTable extends AbstractVirtualTable
|
||||||
EndpointState localState = new EndpointState(entry.getValue());
|
EndpointState localState = new EndpointState(entry.getValue());
|
||||||
|
|
||||||
SimpleDataSet dataSet = result.row(endpoint.getAddress(), endpoint.getPort())
|
SimpleDataSet dataSet = result.row(endpoint.getAddress(), endpoint.getPort())
|
||||||
.column(HOSTNAME, endpoint.getHostName())
|
|
||||||
.column(GENERATION, getGeneration(localState))
|
.column(GENERATION, getGeneration(localState))
|
||||||
.column(HEARTBEAT, getHeartBeat(localState));
|
.column(HEARTBEAT, getHeartBeat(localState));
|
||||||
|
|
||||||
|
|
@ -175,7 +173,6 @@ final class GossipInfoTable extends AbstractVirtualTable
|
||||||
.partitioner(new LocalPartitioner(InetAddressType.instance))
|
.partitioner(new LocalPartitioner(InetAddressType.instance))
|
||||||
.addPartitionKeyColumn(ADDRESS, InetAddressType.instance)
|
.addPartitionKeyColumn(ADDRESS, InetAddressType.instance)
|
||||||
.addClusteringColumn(PORT, Int32Type.instance)
|
.addClusteringColumn(PORT, Int32Type.instance)
|
||||||
.addRegularColumn(HOSTNAME, UTF8Type.instance)
|
|
||||||
.addRegularColumn(GENERATION, Int32Type.instance)
|
.addRegularColumn(GENERATION, Int32Type.instance)
|
||||||
.addRegularColumn(HEARTBEAT, Int32Type.instance);
|
.addRegularColumn(HEARTBEAT, Int32Type.instance);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ public class ClientsTableTest extends CQLTester
|
||||||
shouldUseEncryption(true);
|
shouldUseEncryption(true);
|
||||||
shouldUseClientCertificate(true);
|
shouldUseClientCertificate(true);
|
||||||
ResultSet result = executeNet("SELECT * FROM vts.clients");
|
ResultSet result = executeNet("SELECT * FROM vts.clients");
|
||||||
|
assertThat(result.getColumnDefinitions().size()).isEqualTo(15);
|
||||||
for (Row r : result)
|
for (Row r : result)
|
||||||
{
|
{
|
||||||
Assert.assertEquals(InetAddress.getLoopbackAddress(), r.getInet("address"));
|
Assert.assertEquals(InetAddress.getLoopbackAddress(), r.getInet("address"));
|
||||||
|
|
@ -78,7 +79,6 @@ public class ClientsTableTest extends CQLTester
|
||||||
Assert.assertNotNull(r.getMap("client_options", String.class, String.class));
|
Assert.assertNotNull(r.getMap("client_options", String.class, String.class));
|
||||||
Assert.assertTrue(r.getLong("request_count") > 0 );
|
Assert.assertTrue(r.getLong("request_count") > 0 );
|
||||||
// the following are questionable if they belong here
|
// the following are questionable if they belong here
|
||||||
Assert.assertEquals("localhost", r.getString("hostname"));
|
|
||||||
Assertions.assertThat(r.getMap("client_options", String.class, String.class))
|
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_name"))))
|
||||||
.hasEntrySatisfying("DRIVER_VERSION", value -> assertThat(value.contains(r.getString("driver_version"))));
|
.hasEntrySatisfying("DRIVER_VERSION", value -> assertThat(value.contains(r.getString("driver_version"))));
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,12 @@ public class GossipInfoTableTest extends CQLTester
|
||||||
|
|
||||||
assertThat(resultSet.size()).isEqualTo(1);
|
assertThat(resultSet.size()).isEqualTo(1);
|
||||||
UntypedResultSet.Row row = resultSet.one();
|
UntypedResultSet.Row row = resultSet.one();
|
||||||
assertThat(row.getColumns().size()).isEqualTo(66);
|
assertThat(row.getColumns().size()).isEqualTo(65);
|
||||||
|
|
||||||
assertThat(endpoint).isNotNull();
|
assertThat(endpoint).isNotNull();
|
||||||
assertThat(localState).isNotNull();
|
assertThat(localState).isNotNull();
|
||||||
assertThat(row.getInetAddress("address")).isEqualTo(endpoint.getAddress());
|
assertThat(row.getInetAddress("address")).isEqualTo(endpoint.getAddress());
|
||||||
assertThat(row.getInt("port")).isEqualTo(endpoint.getPort());
|
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("generation")).isEqualTo(localState.getHeartBeatState().getGeneration());
|
||||||
assertThat(row.getInt("heartbeat")).isNotNull();
|
assertThat(row.getInt("heartbeat")).isNotNull();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue