I am trying to list the column families in Cassandra using the Astyanax driver. It lists the keyspaces OK, but many column families are missing from the output.
I have a simple program for this:
import com.netflix.astyanax.AstyanaxContext;
import com.netflix.astyanax.Cluster;
import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl;
import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor;
import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
import com.netflix.astyanax.ddl.KeyspaceDefinition;
import com.netflix.astyanax.impl.AstyanaxConfigurationImpl;
import com.netflix.astyanax.thrift.ThriftFamilyFactory;
public class App {
public static void main(String[] args) throws Exception {
ConnectionPoolConfigurationImpl cpool = new ConnectionPoolConfigurationImpl("ConnectionPool")
.setPort(9160)
.setSeeds("localhost");
AstyanaxConfigurationImpl astyanaxConfiguration = new AstyanaxConfigurationImpl();
AstyanaxContext.Builder ctxBuilder = new AstyanaxContext.Builder();
ctxBuilder.forCluster("Cluster")
.withAstyanaxConfiguration(astyanaxConfiguration)
.withConnectionPoolConfiguration(cpool)
.withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
AstyanaxContext<Cluster> clusterContext = ctxBuilder.buildCluster(ThriftFamilyFactory.getInstance());
clusterContext.start();
Cluster cluster = clusterContext.getClient();
for (KeyspaceDefinition ksDef : cluster.describeKeyspaces()) {
List<ColumnFamilyDefinition> cfDefList = ksDef.getColumnFamilyList();
System.out.println("there are " + cfDefList.size() + " column families in keyspace " + ksDef.getName());
for (ColumnFamilyDefinition cfDef : cfDefList) System.out.println(" - " + cfDef.getName());
}
It can list the keyspaces, but many of the column families are missing. here is the output. It can be seen that many of the default keyspaces are there, but many of the column families are missing.
there are 0 column families in keyspace system_distributed
there are 3 column families in keyspace system
- hints
- schema_keyspaces
- IndexInfo
there are 2 column families in keyspace system_auth
- role_members
- resource_role_permissons_index
there are 0 column families in keyspace system_traces
I can use cqlsh to confirm that the column families do exist
cqlsh> DESCRIBE COLUMNFAMILIES
Keyspace system_traces
----------------------
events sessions
Keyspace system_auth
--------------------
resource_role_permissons_index role_permissions role_members roles
Keyspace system
---------------
available_ranges size_estimates schema_usertypes compactions_in_progress
range_xfers peers paxos schema_aggregates
schema_keyspaces schema_triggers batchlog schema_columnfamilies
schema_columns sstable_activity schema_functions local
"IndexInfo" peer_events compaction_history hints
Keyspace system_distributed
---------------------------
repair_history parent_repair_history
The output above is using cassandra 2.2, but I have confirm the behaviour in other versions of cassandra and scylla.