我们生产的Cluster Cassandra版本是:[cqlsh 5.0.1 |卡桑德拉3.11.3 | CQL规范3.4.4 |原生协议v4]
重新启动Cassandra节点后,Cassandra没有启动,并显示了以下错误:
INFO [main] 2018-08-22 15:30:04,082 CommitLogReader.java:105 - Skipping playback of empty log: CommitLog-6-1534951460541.log
DEBUG [main] 2018-08-22 15:30:04,082 CommitLogReader.java:273 - Reading /var/lib/cassandra/commitlog/CommitLog-6-1527416281330.log (CL version 6, messaging version 11, compression null)
INFO [Service Thread] 2018-08-22 15:30:06,501 GCInspector.java:284 - ParNew GC in 216ms. CMS Old Gen: 10906456 -> 31114600; Par Eden Space: 859045888 -> 0; Par Survivor Space: 29166056 -> 43187600
DEBUG [main] 2018-08-22 15:30:06,673 CommitLogReader.java:264 - Finished reading /var/lib/cassandra/commitlog/CommitLog-6-1527416281330.log
DEBUG [main] 2018-08-22 15:30:06,674 CommitLogReader.java:273 - Reading /var/lib/cassandra/commitlog/CommitLog-6-1527416281331.log (CL version 6, messaging version 11, compression null)
DEBUG [main] 2018-08-22 15:30:08,009 CommitLogReader.java:264 - Finished reading /var/lib/cassandra/commitlog/CommitLog-6-1527416281331.log
DEBUG [main] 2018-08-22 15:30:08,009 CommitLogReader.java:273 - Reading /var/lib/cassandra/commitlog/CommitLog-6-1527416281332.log (CL version 6, messaging version 11, compression null)
ERROR [main] 2018-08-22 15:30:08,610 JVMStabilityInspector.java:102 - Exiting due to error while processing commit log during initialization.
org.apache.cassandra.db.commitlog.CommitLogReadHandler$CommitLogReadException: Unexpected error deserializing mutation; saved to /tmp/mutation1296995018372874453dat. This may be caused by replaying a mutation against a table with the same name but incompatible schema. Exception follows: java.io.IOError: java.io.EOFException: EOF after 45 bytes out of 33554712
at org.apache.cassandra.db.commitlog.CommitLogReader.readMutation(CommitLogReader.java:471) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.db.commitlog.CommitLogReader.readSection(CommitLogReader.java:404) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.db.commitlog.CommitLogReader.readCommitLogSegment(CommitLogReader.java:251) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.db.commitlog.CommitLogReader.readAllFiles(CommitLogReader.java:132) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.db.commitlog.CommitLogReplayer.replayFiles(CommitLogReplayer.java:137) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.db.commitlog.CommitLog.recoverFiles(CommitLog.java:177) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.db.commitlog.CommitLog.recoverSegmentsOnDisk(CommitLog.java:158) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:324) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:602) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:691) [apache-cassandra-3.11.3.jar:3.11.3]
移出CommitLogs(这会导致数据丢失)之后,Cassandra确实启动了,但是对某些表的查询失败,并显示
ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
和system.log:
WARN [ReadStage-2] 2018-08-26 11:04:34,091 AbstractLocalAwareExecutorService.java:167 - Uncaught exception on thread Thread[ReadStage-2,10,main]: {}
java.lang.RuntimeException: org.apache.cassandra.io.sstable.CorruptSSTableException: Corrupted: /var/lib/cassandra/data/policy/rule-83f10050a91f11e890846d2c86545d91/mc-52-big-Data.db
at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2601) ~[apache-cassandra-3.11.3.jar:3.11.3]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_171]
at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) ~[apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:134) [apache-cassandra-3.11.3.jar:3.11.3]
at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109) [apache-cassandra-3.11.3.jar:3.11.3]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
经过调查,我很确定可以通过以下步骤重现该错误:
DROP KEYSPACE IF EXISTS my_ks;
CREATE KEYSPACE my_ks WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
CREATE TYPE my_ks.my_type(column1 text);
CREATE TABLE my_ks.my_table (
id uuid primary key,
mt my_type
);
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
INSERT INTO my_ks.my_table(id, mt) VALUES(uuid(), {column1 : 'value1'});
ALTER TABLE my_ks.my_table DROP mt;
以下步骤重现了CorruptSSTableException,但未重现CommitLogReadHandler $ CommitLogReadException。
顺便说一句,在Cassandra 3.11.1上,使用上述步骤未再现该错误。
答案 0 :(得分:2)
在Cassandra 4.0中,将禁止删除(冻结)非冻结的用户定义类型列。引发的错误是
import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.svm import LinearSVC
categories = [
'alt.atheism',
'talk.religion.misc',
'comp.graphics',
'sci.space']
dataset = fetch_20newsgroups(subset='all', categories=categories,
shuffle=True, random_state=42)
vectorizer = CountVectorizer()
# Just to replace classes from integers to their actual labels,
# you can use anything as you like in y
y = []
mapping_dict = dict(enumerate(dataset.target_names))
for i in dataset.target:
y.append(mapping_dict[i])
# Learn the words from data
X = vectorizer.fit_transform(dataset.data)
clf = LinearSVC(random_state=42)
clf.fit(X, y)
plot_coefficients(clf, vectorizer.get_feature_names())
我在后备箱上进行了测试。不幸的是,这对于早期版本(<4.0)尚不可用。
在您的udt列中使用InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot drop non-frozen column mt of user type my_type"
应该可以解决此问题(我在3.11.3中进行了测试)(但是无法更改列的类型)。
frozen
为此问题也打开了CASSANDRA-14673。