Tabnine Logo
TableOptionsMetadata
Code IndexAdd Tabnine to your IDE (free)

How to use
TableOptionsMetadata
in
com.datastax.driver.core

Best Java code snippets using com.datastax.driver.core.TableOptionsMetadata (Showing top 20 results out of 315)

origin: com.datastax.cassandra/cassandra-driver-core

if (options.isCompactStorage()) and(sb.append("COMPACT STORAGE"), formatted);
if (!clusteringOrder.isEmpty()) and(appendClusteringOrder(sb), formatted);
sb.append("read_repair_chance = ").append(options.getReadRepairChance());
and(sb, formatted)
  .append("dclocal_read_repair_chance = ")
  .append(options.getLocalReadRepairChance());
if (cassandraVersion.getMajor() < 2
  || (cassandraVersion.getMajor() == 2 && cassandraVersion.getMinor() == 0))
 and(sb, formatted).append("replicate_on_write = ").append(options.getReplicateOnWrite());
and(sb, formatted).append("gc_grace_seconds = ").append(options.getGcGraceInSeconds());
and(sb, formatted)
  .append("bloom_filter_fp_chance = ")
  .append(options.getBloomFilterFalsePositiveChance());
if (cassandraVersion.getMajor() < 2
  || cassandraVersion.getMajor() == 2 && cassandraVersion.getMinor() < 1)
 and(sb, formatted)
   .append("caching = '")
   .append(options.getCaching().get("keys"))
   .append('\'');
else and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching()));
if (options.getComment() != null)
 and(sb, formatted)
   .append("comment = '")
   .append(options.getComment().replace("'", "''"))
   .append('\'');
and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction()));
and(sb, formatted).append("compression = ").append(formatOptionMap(options.getCompression()));
if (cassandraVersion.getMajor() >= 2) {
 and(sb, formatted).append("default_time_to_live = ").append(options.getDefaultTimeToLive());
origin: prestodb/presto

String comment = tableMeta.getOptions().getComment();
Set<String> hiddenColumns = ImmutableSet.of();
if (comment != null && comment.startsWith(PRESTO_COMMENT_METADATA)) {
origin: com.datastax.cassandra/cassandra-driver-core

  .onMaterializedViewAdded(removed.capture());
assertThat(removed.getValue()).hasName("mv1");
assertThat(removed.getValue().getOptions().getCompaction().get("class"))
  .contains("SizeTieredCompactionStrategy");
      .getMaterializedView("mv1")
      .getOptions()
      .getCompaction()
      .get("class"))
  .contains("SizeTieredCompactionStrategy");
verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1))
  .onMaterializedViewChanged(current.capture(), previous.capture());
assertThat(previous.getValue().getOptions().getCompaction().get("class"))
  .contains("SizeTieredCompactionStrategy");
assertThat(current.getValue().getOptions().getCompaction().get("class"))
  .contains("LeveledCompactionStrategy");
      .getMaterializedView("mv1")
      .getOptions()
      .getCompaction()
      .get("class"))
  .contains("LeveledCompactionStrategy");
origin: io.zipkin.java/zipkin-storage-cassandra

static boolean hasUpgrade1_defaultTtl(KeyspaceMetadata keyspaceMetadata) {
 // TODO: we need some approach to forward-check compatibility as well.
 //  backward: this code knows the current schema is too old.
 //  forward:  this code knows the current schema is too new.
 return keyspaceMetadata.getTable("traces").getOptions().getDefaultTimeToLive() > 0;
}
origin: com.datastax.cassandra/cassandra-driver-core

assertThat(table.getOptions().getCompression())
  .contains(entry("class", "org.apache.cassandra.io.compress.DeflateCompressor"))
  .contains(entry("chunk_length_in_kb", "128"));
origin: com.datastax.cassandra/cassandra-driver-core

public TableMetadataAssert hasComment(String comment) {
 assertThat(actual.getOptions().getComment()).isEqualTo(comment);
 return this;
}
origin: io.zipkin/zipkin-cassandra-core

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;
}
origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1

static boolean hasUpgrade1_defaultTtl(KeyspaceMetadata keyspaceMetadata) {
 // TODO: we need some approach to forward-check compatibility as well.
 //  backward: this code knows the current schema is too old.
 //  forward:  this code knows the current schema is too new.
 return keyspaceMetadata.getTable("traces").getOptions().getDefaultTimeToLive() > 0;
}
origin: org.janusgraph/janusgraph-cql

Map<String, String> getCompressionOptions(final String name) throws BackendException {
  final KeyspaceMetadata keyspaceMetadata = Option.of(this.cluster.getMetadata().getKeyspace(this.keyspace))
      .getOrElseThrow(() -> new PermanentBackendException(String.format("Unknown keyspace '%s'", this.keyspace)));
  return Option.of(keyspaceMetadata.getTable(name))
      .map(tableMetadata -> tableMetadata.getOptions().getCompression())
      .getOrElseThrow(() -> new PermanentBackendException(String.format("Unknown table '%s'", name)));
}
origin: com.datastax.cassandra/cassandra-driver-core

assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5);
assertThat(table.getOptions().getLocalReadRepairChance()).isEqualTo(0.6);
assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42);
assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01);
assertThat(table.getOptions().getComment()).isEqualTo("My awesome table");
assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL"));
assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10"));
assertThat(table.getOptions().getCompaction())
  .contains(entry("class", "org.apache.cassandra.db.compaction.LeveledCompactionStrategy"));
assertThat(table.getOptions().getCompaction()).contains(entry("sstable_size_in_mb", "15"));
assertThat(table.getOptions().getCompression())
  .contains(
    entry(
assertThat(table.getOptions().getCompression())
  .contains(entry("chunk_length_in_kb", "128")); // note the "in" prefix
assertThat(table.getOptions().getDefaultTimeToLive()).isEqualTo(0);
assertThat(table.getOptions().getSpeculativeRetry()).isEqualTo("99.9PERCENTILE");
assertThat(table.getOptions().getIndexInterval()).isNull();
assertThat(table.getOptions().getMinIndexInterval()).isEqualTo(128);
assertThat(table.getOptions().getMaxIndexInterval()).isEqualTo(2048);
assertThat(table.getOptions().getReplicateOnWrite()).isTrue(); // default
assertThat(table.getOptions().getCrcCheckChance()).isEqualTo(0.5);
assertThat(table.getOptions().getExtensions()).isEmpty(); // default
assertThat(table.getOptions().getMemtableFlushPeriodInMs()).isEqualTo(1000);
assertThat(table.asCQLQuery())
  .contains("read_repair_chance = 0.5")
assertThat(table.getOptions().getReadRepairChance()).isEqualTo(0.5);
origin: com.datastax.cassandra/cassandra-driver-core

public TableMetadataAssert doesNotHaveComment(String comment) {
 assertThat(actual.getOptions().getComment()).isNotEqualTo(comment);
 return this;
}
origin: io.zipkin.java/zipkin-storage-cassandra

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);
}
origin: io.zipkin.zipkin2/zipkin-storage-cassandra

CassandraSpanStore(CassandraStorage storage) {
 Session session = storage.session();
 maxTraceCols = storage.maxTraceCols();
 indexFetchMultiplier = storage.indexFetchMultiplier();
 strictTraceId = storage.strictTraceId();
 searchEnabled = storage.searchEnabled();
 spans = new SelectFromSpan.Factory(session, strictTraceId, maxTraceCols);
 dependencies = new SelectDependencies.Factory(session);
 if (searchEnabled) {
  KeyspaceMetadata md = Schema.ensureKeyspaceMetadata(session, storage.keyspace());
  indexTtl = md.getTable(TABLE_TRACE_BY_SERVICE_SPAN).getOptions().getDefaultTimeToLive();
  spanNames = new SelectSpanNames.Factory(session);
  serviceNames = new SelectServiceNames.Factory(session).create();
  traceIdsFromServiceSpan = new SelectTraceIdsFromServiceSpan.Factory(session);
  spanTable = initialiseSelectTraceIdsFromSpan(session);
 } else {
  indexTtl = 0;
  spanNames = null;
  serviceNames = null;
  spanTable = null;
  traceIdsFromServiceSpan = null;
 }
}
origin: com.datastax.dse/dse-java-driver-core

assertThat(table.getOptions().getCompression())
  .contains(entry("class", "org.apache.cassandra.io.compress.DeflateCompressor"))
  .contains(entry("chunk_length_in_kb", "128"));
origin: io.prestosql.cassandra/cassandra-driver

if (options.isCompactStorage())
  and(sb.append("COMPACT STORAGE"), formatted);
if (!Iterables.all(clusteringOrder, isAscending))
  and(appendClusteringOrder(sb), formatted);
sb.append("read_repair_chance = ").append(options.getReadRepairChance());
and(sb, formatted).append("dclocal_read_repair_chance = ").append(options.getLocalReadRepairChance());
if (cassandraVersion.getMajor() < 2 || (cassandraVersion.getMajor() == 2 && cassandraVersion.getMinor() == 0))
  and(sb, formatted).append("replicate_on_write = ").append(options.getReplicateOnWrite());
and(sb, formatted).append("gc_grace_seconds = ").append(options.getGcGraceInSeconds());
and(sb, formatted).append("bloom_filter_fp_chance = ").append(options.getBloomFilterFalsePositiveChance());
if (cassandraVersion.getMajor() < 2 || cassandraVersion.getMajor() == 2 && cassandraVersion.getMinor() < 1)
  and(sb, formatted).append("caching = '").append(options.getCaching().get("keys")).append('\'');
else
  and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching()));
if (options.getComment() != null)
  and(sb, formatted).append("comment = '").append(options.getComment().replace("'", "''")).append('\'');
and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction()));
and(sb, formatted).append("compression = ").append(formatOptionMap(options.getCompression()));
if (cassandraVersion.getMajor() >= 2) {
  and(sb, formatted).append("default_time_to_live = ").append(options.getDefaultTimeToLive());
  and(sb, formatted).append("speculative_retry = '").append(options.getSpeculativeRetry()).append('\'');
  if (options.getIndexInterval() != null)
    and(sb, formatted).append("index_interval = ").append(options.getIndexInterval());
  and(sb, formatted).append("min_index_interval = ").append(options.getMinIndexInterval());
  and(sb, formatted).append("max_index_interval = ").append(options.getMaxIndexInterval());
  and(sb, formatted).append("crc_check_chance = ").append(options.getCrcCheckChance());
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_escape_single_quote_table_comment() {
 // given
 String cql =
   String.format(
     "CREATE TABLE %s.single_quote (\n"
       + "    c1 int PRIMARY KEY\n"
       + ") WITH  comment = 'comment with single quote '' should work'",
     keyspace);
 // when
 session().execute(cql);
 TableMetadata table = cluster().getMetadata().getKeyspace(keyspace).getTable("single_quote");
 // then
 assertThat(table.getOptions().getComment())
   .isEqualTo("comment with single quote ' should work");
 assertThat(table.asCQLQuery()).contains("comment = 'comment with single quote '' should work'");
}
origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1

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);
}
origin: com.facebook.presto.cassandra/cassandra-driver

if (options.isCompactStorage())
  and(sb.append("COMPACT STORAGE"), formatted);
if (!Iterables.all(clusteringOrder, isAscending))
  and(appendClusteringOrder(sb), formatted);
sb.append("read_repair_chance = ").append(options.getReadRepairChance());
and(sb, formatted).append("dclocal_read_repair_chance = ").append(options.getLocalReadRepairChance());
if (cassandraVersion.getMajor() < 2 || (cassandraVersion.getMajor() == 2 && cassandraVersion.getMinor() == 0))
  and(sb, formatted).append("replicate_on_write = ").append(options.getReplicateOnWrite());
and(sb, formatted).append("gc_grace_seconds = ").append(options.getGcGraceInSeconds());
and(sb, formatted).append("bloom_filter_fp_chance = ").append(options.getBloomFilterFalsePositiveChance());
if (cassandraVersion.getMajor() < 2 || cassandraVersion.getMajor() == 2 && cassandraVersion.getMinor() < 1)
  and(sb, formatted).append("caching = '").append(options.getCaching().get("keys")).append('\'');
else
  and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching()));
if (options.getComment() != null)
  and(sb, formatted).append("comment = '").append(options.getComment().replace("'", "''")).append('\'');
and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction()));
and(sb, formatted).append("compression = ").append(formatOptionMap(options.getCompression()));
if (cassandraVersion.getMajor() >= 2) {
  and(sb, formatted).append("default_time_to_live = ").append(options.getDefaultTimeToLive());
  and(sb, formatted).append("speculative_retry = '").append(options.getSpeculativeRetry()).append('\'');
  if (options.getIndexInterval() != null)
    and(sb, formatted).append("index_interval = ").append(options.getIndexInterval());
  and(sb, formatted).append("min_index_interval = ").append(options.getMinIndexInterval());
  and(sb, formatted).append("max_index_interval = ").append(options.getMaxIndexInterval());
  and(sb, formatted).append("crc_check_chance = ").append(options.getCrcCheckChance());
origin: com.datastax.dse/dse-java-driver-core

public TableMetadataAssert hasComment(String comment) {
 assertThat(actual.getOptions().getComment()).isEqualTo(comment);
 return this;
}
origin: io.zipkin.zipkin2/zipkin-storage-cassandra

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);
}
com.datastax.driver.coreTableOptionsMetadata

Most used methods

  • getCompaction
    Returns the compaction options for this table.
  • getComment
    Returns the commentary set for this table.
  • getDefaultTimeToLive
    Returns the default TTL for this table. Note: this option is not available in Cassandra 1.2 and will
  • getCompression
    Returns the compression options for this table.
  • getBloomFilterFalsePositiveChance
    Returns the false positive chance for the Bloom filter of this table.
  • getCaching
    Returns the caching options for this table.
  • getCrcCheckChance
    When compression is enabled, this option defines the probability with which checksums for compressed
  • getGcGraceInSeconds
    Returns the tombstone garbage collection grace time in seconds for this table.
  • getIndexInterval
    Returns the index interval option for this table. Note: this option is not available in Cassandra 1.
  • getLocalReadRepairChance
    Returns the cluster local read repair chance set for this table.
  • getMaxIndexInterval
    Returns the maximum index interval option for this table. Note: this option is available in Cassandr
  • getMinIndexInterval
    Returns the minimum index interval option for this table. Note: this option is available in Cassandr
  • getMaxIndexInterval,
  • getMinIndexInterval,
  • getReadRepairChance,
  • getReplicateOnWrite,
  • getSpeculativeRetry,
  • isCompactStorage,
  • <init>,
  • isCDC,
  • isNullOrAbsent,
  • getMemtableFlushPeriodInMs

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • compareTo (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now