我正在使用下面的cassandra服务器,而试图创建一个表名,我得到以下错误。
2023-09-11 13:57:55,961 [info] c.a.l.s.r.c.CassandraCluster - Connected to Cassandra cluster: Amazon Keyspaces
2023-09-11 13:57:55,961 [info] c.a.l.s.r.c.CassandraCluster - Creating schema using file '/tmp/schema.cql', keyspace: '<keyspace>'
2023-09-11 13:57:55,981 [warn] c.a.l.s.r.c.CassandraCluster - Schema operation failed: Unknown property 'read_repair'
2023-09-11 13:57:55,983 [warn] c.a.l.s.r.c.CassandraCluster - Schema operation failed: Unknown property 'additional_write_policy'
2023-09-11 13:57:55,983 [info] c.a.l.s.r.c.CassandraCluster - Finished creating schema
Oops, cannot start the server.
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Error injecting constructor, com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table wilshire_dev_lineage_stats.stats
at com.ac.lineage.stats.repository.cassandra.CQLExecutor.<init>(CQLExecutor.java:30)
while locating com.ac.lineage.stats.repository.cassandra.CQLExecutor
for the 2nd parameter of com.ac.lineage.stats.repository.cassandra.CassandraRepository.<init>(CassandraRepository.java:47)
at com.ac.lineage.stats.repository.cassandra.CassandraRepository.class(CassandraRepository.java:41)
while locating com.ac.lineage.stats.repository.cassandra.CassandraRepository
while locating com.ac.lineage.stats.repository.StatisticsRepository
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table wilshire_dev_lineage_stats.stats
at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49)
at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:35)
at com.datastax.driver.core.AbstractSession.prepare(AbstractSession.java:86)
at com.ac.lineage.stats.repository.cassandra.CQLExecutor.<init>(CQLExecutor.java:37)
at com.ac.lineage.stats.repository.cassandra.CQLExecutor$$FastClassByGuice$$7a988c18.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:42)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:65)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:306)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:62)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:184)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:111)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:78)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:200)
at play.inject.guice.GuiceBuilder.injector(GuiceBuilder.java:211)
at play.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.java:121)
at play.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.java:32)
at play.api.ApplicationLoader$JavaApplicationLoaderAdapter$1.load(ApplicationLoader.scala:181)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:53)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table wilshire_dev_lineage_stats.stats
at com.datastax.driver.core.Responses$Error.asException(Responses.java:181)
at com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:250)
at com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:219)
at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:213)
at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:202)
at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:118)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
Cassandra版本:
[cqlsh 6.1.0 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
表架构:
CREATE TABLE keyspace.stats_summary (
dataset_id text,
snapshot_end timestamp,
snapshot_start timestamp,
dataview_name text,
datamodel_id text,
summary text,
PRIMARY KEY (dataset_id, snapshot_end, snapshot_start, dataview_name, datamodel_id)
) WITH CLUSTERING ORDER BY (snapshot_end DESC, snapshot_start DESC, dataview_name ASC, datamodel_id ASC)
AND additional_write_policy = '99p'
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND cdc = false
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND default_time_to_live = 0
我的问题:
1.在哪个版本下read_repair和additional_write_policy属性被添加到Cassandra?
1.如何找到哪个版本启动了我自己的这些属性?
问候,BKV
如果我重写create语句,删除所有附加属性,我就可以创建表。
2条答案
按热度按时间7vux5j2d1#
我不确定这些属性是什么时候引入的,但看起来
additional_write_policy
将被重命名为CASSANDRA-14761的一部分。然而,这从来没有实现,因为这张票还没有解决。话虽如此,看起来该属性是Cassandra 4.0的新属性。我也试过上面的表CQL,它在4.0、4.1和新的Cassandra 5.0 alpha版本中都能工作。
但是,如果您使用Amazon Keyspaces,那么任何人都可以猜测哪些表属性有效。Apache Cassandra和Amazon Keyspaces之间的兼容性问题是众所周知的。如果这是Keyspaces的问题,我不会感到惊讶,但不是Cassandra。
如果你想知道某些表属性是什么时候添加到项目中的,你可以搜索Cassandra JIRA项目。要到达那里,只需按照CASSANDRA-14761的链接。
js5cn81o2#
看起来你试图从运行较新版本Cassandra的集群中重新创建一个模式,但它包含无效的CQL:
我不知道
read_repair
是一个属性,我不认为它存在于任何版本的Cassandra中。曾经有一些名为read_repair_chance
和dclocal_read_repair_chance
的表属性与read-repairs(在读取请求期间同步/修复副本的过程)相关联,但自Cassandra 3.0.17,3.11.3和4.0(CASSANDRA-13910)以来,它们已被弃用。在任何情况下,您都需要检查模式文件(
/tmp/schema.cql
)并删除对read_repair
的任何引用,因为它不是有效的CQL模式语法。表选项
additional_write_policy
从speculative_write_threshold
(CASSANDRA-14820)重命名,用于指定Transient Replication的阈值,这是Cassandra 4.0(CASSANDRA-14404)中引入的新功能,因此在Cassandra的早期版本中不可用。Amazon Keyspaces is based on Apache Cassandra 3.11.2因此它不支持瞬时复制:
Amazon Keyspaces(适用于Apache Cassandra)以九节点Apache Cassandra 3.11.2群集的形式显示给客户端,并支持与Apache Cassandra 3.11.2兼容的驱动程序和客户端。
由于您的CQL架构源自运行Cassandra 4.x+的集群,因此您将无法将其导入Amazon Keyspaces示例。您需要检查架构并重写它,使其不包含新特性。这意味着,如果您计划从Cassandra 4.x集群导入SSTable,它们将与Amazon Keyspaces不兼容,因为它们采用不同的SSTable格式。干杯!干杯!