我正在尝试将我的 3 节点 Cassandra 集群从版本 3.11.13 升级到 4.1.5。
启动升级节点后出现此错误:
ERROR [main] 2024-06-20 08:48:23,708 CassandraDaemon.java:915 - Exception encountered during startup
java.lang.AssertionError: null
at org.apache.cassandra.schema.TableMetadata$CompactTableMetadata.getCompactValueColumn(TableMetadata.java:1515)
at org.apache.cassandra.schema.TableMetadata$CompactTableMetadata.<init>(TableMetadata.java:1350)
at org.apache.cassandra.schema.TableMetadata$Builder.build(TableMetadata.java:747)
at org.apache.cassandra.schema.SchemaKeyspace.fetchTable(SchemaKeyspace.java:943)
at org.apache.cassandra.schema.SchemaKeyspace.fetchTables(SchemaKeyspace.java:898)
at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:857)
at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesWithout(SchemaKeyspace.java:848)
at org.apache.cassandra.schema.SchemaKeyspace.fetchNonSystemKeyspaces(SchemaKeyspace.java:836)
at org.apache.cassandra.schema.Schema.loadFromDisk(Schema.java:132)
at org.apache.cassandra.schema.Schema.loadFromDisk(Schema.java:121)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:285)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:759)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:893)
我发现这个问题将 Cassandra 3.11.8 升级到 4.1.0 在启动时加载模式时返回“AssertionError:null”,建议删除 COMPACT STORAGE。
系统键空间中只有一个 COMPACT STORAGE:
DESCRIBE TABLE system.hints
CREATE TABLE system.hints (
target_id uuid,
hint_id timeuuid,
message_version int,
mutation blob,
PRIMARY KEY (target_id, hint_id, message_version)
) WITH COMPACT STORAGE
AND CLUSTERING ORDER BY (hint_id ASC, message_version ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = '*DEPRECATED* hints awaiting delivery'
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'enabled': 'false', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.0
AND default_time_to_live = 0
AND gc_grace_seconds = 0
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 3600000
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
不幸的是我不能放弃它:
cqlsh> ALTER TABLE system.hints DROP COMPACT STORAGE;
Unauthorized: Error from server: code=2100 [Unauthorized] message="system keyspace is not user-modifiable."
我甚至无法将节点降级回 3.11.13:
ERROR [main] 2024-06-20 08:38:07,157 CassandraDaemon.java:803 - Detected unreadable sstables /var/lib/cassandra/data/system/local/nb-244-big-Statistics.db,/var/lib/cassandra/data/system/local/nb-244-big-Data.db,/var/lib/cassandra/data/system/local/nb-244-big-Summary.db,/var/
lib/cassandra/data/system/local/nb-244-big-CompressionInfo.db,/var/lib/cassandra/data/system/local/nb-244-big-Index.db,/var/lib/cassandra/data/system/local/nb-244-big-Filter.db, please check NEWS.txt and ensure that you have upgraded through all required intermediate version
s, running upgradesstables
在我的其他 cassandra 集群中,升级顺利,但表 system.hints 不存在。
有人知道如何摆脱这种情况吗?
在查看了堆栈跟踪之后,我认为该问题与表无关
system.hints
。TableMetadata$CompactTableMetadata.getCompactValueColumn()
当它尝试检索具有的表中的列时,会引发异常COMPACT STORAGE
。我怀疑错误是由于另一个紧凑表已更新为具有常规 CQL 列(与紧凑/Thrift 列相反),这是无效的。紧凑(Thrift)表不能添加 CQL 列,因此不再允许在语句中添加该列
ALTER TABLE
(CASSANDRA-14564)。您需要再次检查除 之外的紧凑表的集群模式
system.hints
。不幸的是,除了在 C* 3.11 中删除然后重新创建表之外,我不知道还有其他解决方案。附注:一旦节点运行了较新版本的 Cassandra,您就无法降级节点上的二进制文件,因为它将生成新格式的 SSTables,而旧版本无法读取该格式。干杯!