使用已弃用语法的缓存选项

时间:2017-03-27 09:34:40

标签: cassandra cassandra-2.1

我们发出这样的警告:

WARN  [SharedPool-Worker-3] 2017-03-23 11:57:06,054 CFPropDefs.java:172 - Setting caching options with deprecated syntax.

创建这样的CF时:

CREATE TABLE "CF_ConversationIndex" (
  key blob,
  column1 blob,
  column2 timeuuid,
  column3 blob,
  value blob,
  PRIMARY KEY (key, column1, column2, column3) ) WITH COMPACT STORAGE
  AND CLUSTERING ORDER BY (column1 ASC, column2 ASC, column3 ASC)
  AND bloom_filter_fp_chance = 0.01
  AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
  AND comment = 'Maintain the conversationID/ThreadID.'
  AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy',
                    'max_threshold': '32'}
  AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.SnappyCompressor'}
  AND dclocal_read_repair_chance = 0.1
  AND default_time_to_live = 0
  AND gc_grace_seconds = 1036800
  AND max_index_interval = 2048
  AND memtable_flush_period_in_ms = 0
  AND min_index_interval = 128
  AND read_repair_chance = 0.0
  AND speculative_retry = 'NONE';

在C * 2.1.17集群上,并且根据CQL 3.1 for C* 2.1

,奇怪的是缓存选项看起来没问题

2 个答案:

答案 0 :(得分:3)

尝试在没有“'”的情况下执行它:

AND caching = {"keys":"ALL", "rows_per_partition":"NONE"}

也许这会对错误消息有所了解,语法看起来还不错:

public CachingOptions getCachingOptions() throws SyntaxException, ConfigurationException
{
    CachingOptions options = null;
    Object val = properties.get(KW_CACHING);
    if (val == null)
        return null;
    else if (val instanceof Map)
        options = CachingOptions.fromMap(getMap(KW_CACHING));
    else if (val instanceof String) // legacy syntax
    {
        options = CachingOptions.fromString(getSimple(KW_CACHING));
        logger.warn("Setting caching options with deprecated syntax.");
    }
    return options;
}

指向缓存文档的链接: http://apiwave.com/java/snippets/addition/org.apache.cassandra.cache.CachingOptions

答案 1 :(得分:3)

在缓存选项中,删除附加单引号并将双引号更改为单引号

AND caching = {'keys':'ALL', 'rows_per_partition':'NONE'}