@Override public void onKeyspaceChanged(KeyspaceMetadata current, KeyspaceMetadata previous) { if (!current.getName().equals(keyspace)) { return; } String oldReplicationFactor = previous.getReplication().get("replication_factor"); String newReplicationFactor = current.getReplication().get("replication_factor"); if (!oldReplicationFactor.equals(newReplicationFactor)) { logger.info("replication_factor of " + keyspace + " has changed from " + oldReplicationFactor + " to " + newReplicationFactor); maybeUpdateGCGraceSeconds(); } }
@Override public void onKeyspaceChanged(KeyspaceMetadata current, KeyspaceMetadata previous) { if (!current.getName().equals(keyspace)) { return; } String oldReplicationFactor = previous.getReplication().get("replication_factor"); String newReplicationFactor = current.getReplication().get("replication_factor"); if (!oldReplicationFactor.equals(newReplicationFactor)) { logger.info("replication_factor of " + keyspace + " has changed from " + oldReplicationFactor + " to " + newReplicationFactor); maybeUpdateGCGraceSeconds(); } }
static Map<String, String> readMetadata(String keyspace, Cluster cluster) { Map<String, String> metadata = new LinkedHashMap<>(); try (Session ignored = cluster.connect()) { KeyspaceMetadata keyspaceMetadata = getKeyspaceMetadata(keyspace, cluster); Map<String, String> replication = keyspaceMetadata.getReplication(); if ("SimpleStrategy".equals(replication.get("class")) && "1".equals(replication.get("replication_factor"))) { LOG.warn("running with RF=1, this is not suitable for production. Optimal is 3+"); } Map<String, String> tracesCompaction = keyspaceMetadata.getTable("traces").getOptions().getCompaction(); metadata.put("traces.compaction.class", tracesCompaction.get("class")); } return metadata; }
static Metadata readMetadata(Session session) { KeyspaceMetadata keyspaceMetadata = getKeyspaceMetadata(session); Map<String, String> replication = keyspaceMetadata.getReplication(); if ("SimpleStrategy".equals(replication.get("class")) && "1".equals( replication.get("replication_factor"))) { LOG.warn("running with RF=1, this is not suitable for production. Optimal is 3+"); } String compactionClass = keyspaceMetadata.getTable("traces").getOptions().getCompaction().get("class"); boolean hasDefaultTtl = hasUpgrade1_defaultTtl(keyspaceMetadata); if (!hasDefaultTtl) { LOG.warn("schema lacks default ttls: apply {}, or set CassandraStorage.ensureSchema=true", UPGRADE_1); } return new Metadata(compactionClass, hasDefaultTtl); }
static Metadata readMetadata(Session session) { KeyspaceMetadata keyspaceMetadata = getKeyspaceMetadata(session); Map<String, String> replication = keyspaceMetadata.getReplication(); if ("SimpleStrategy".equals(replication.get("class")) && "1".equals(replication.get("replication_factor"))) { LOG.warn("running with RF=1, this is not suitable for production. Optimal is 3+"); } String compactionClass = keyspaceMetadata.getTable("traces").getOptions().getCompaction().get("class"); boolean hasDefaultTtl = hasUpgrade1_defaultTtl(keyspaceMetadata); if (!hasDefaultTtl) { LOG.warn( "schema lacks default ttls: apply {}, or set CassandraStorage.ensureSchema=true", UPGRADE_1); } return new Metadata(compactionClass, hasDefaultTtl); }
static Metadata readMetadata(Session session) { KeyspaceMetadata keyspaceMetadata = ensureKeyspaceMetadata(session, session.getLoggedKeyspace()); Map<String, String> replication = keyspaceMetadata.getReplication(); if ("SimpleStrategy".equals(replication.get("class"))) { if ("1".equals(replication.get("replication_factor"))) { LOG.warn("running with RF=1, this is not suitable for production. Optimal is 3+"); } ConsistencyLevel cl = session.getCluster().getConfiguration().getQueryOptions().getConsistencyLevel(); checkState( ConsistencyLevel.ONE == cl, "Do not define `local_dc` and use SimpleStrategy"); } String compactionClass = keyspaceMetadata.getTable("span").getOptions().getCompaction().get("class"); return new Metadata(compactionClass); }
logger.info("Checking tables in " + keyspace + " to see if gc_grace_seconds needs to be updated"); Stopwatch stopwatch = Stopwatch.createStarted(); Map<String, String> replication = session.getCluster().getMetadata().getKeyspace(keyspace).getReplication(); String replicationFactor = replication.get("replication_factor"); Completable check;
logger.info("Checking tables in " + keyspace + " to see if gc_grace_seconds needs to be updated"); Stopwatch stopwatch = Stopwatch.createStarted(); Map<String, String> replication = session.getCluster().getMetadata().getKeyspace(keyspace).getReplication(); String replicationFactor = replication.get("replication_factor"); Completable check;