我在使用Cassandra node.js驱动程序时遇到了一个奇怪的问题。当我尝试从某些分区中选择数据时,出现此错误。
Error: There was an problem while parsing streaming frame, opcode 8
at DriverInternalError.DriverError (C:\Temp\cassandra_test\node_modules\cassandra-driver\lib\errors.js:14:19)
at new DriverInternalError (C:\Temp\cassandra_test\node_modules\cassandra-driver\lib\errors.js:68:30)
at Parser._transform (C:\Temp\cassandra_test\node_modules\cassandra-driver\lib\streams.js:149:16)
at Parser.Transform._read (_stream_transform.js:167:10)
at Parser.Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:307:12)
at writeOrBuffer (_stream_writable.js:293:5)
at Parser.Writable.write (_stream_writable.js:220:11)
at Protocol.ondata (_stream_readable.js:556:20)
at emitOne (events.js:96:13)
name: 'DriverInternalError',
stack: 'Error: There was an problem while parsing streaming frame, opcode 8\n at DriverInternalError.DriverError (C:\\Temp\\cassandra_test\\node_modules\\cassandra-driver\\lib\\errors.js:14:19)\n at new DriverInternalError (C:\\Temp\\cassandra_test\\node_modules\\cassandra-driver\\lib\\errors.js:68:30)\n at Parser._transform (C:\\Temp\\cassandra_test\\node_modules\\cassandra-driver\\lib\\streams.js:149:16)\n at Parser.Transform._read (_stream_transform.js:167:10)\n at Parser.Transform._write (_stream_transform.js:155:12)\n at doWrite (_stream_writable.js:307:12)\n at writeOrBuffer (_stream_writable.js:293:5)\n at Parser.Writable.write (_stream_writable.js:220:11)\n at Protocol.ondata (_stream_readable.js:556:20)\n at emitOne (events.js:96:13)',
message: 'There was an problem while parsing streaming frame, opcode 8',
info: 'Represents a bug inside the driver or in a Cassandra host.',
这里确实有一些奇怪的行为。
较小的
fetchSize
不会发生这种情况。例如,我可以使用312或更大的读取大小来始终使它出错,但是每次使用311的读取大小都是可行的。它仅适用于某些分区键。到目前为止,它似乎正在影响最近添加的密钥。
在单个表中,
fetchSize
的断点是一致的。例如,我可以运行SELECT * FROM TableX WHERE myKey = value1
或SELECT * FROM TableX WHERE myKey = value2
,并且两者都会在fetchSize
为240时开始出错。但是对于TableY
,限制可能是284。我真的很茫然。我怀疑这与从单个分区返回太多行有关,但我能够从其他分区获取大量数据(例如,
fetchSize
为20000的大多数分区都可以正常工作)。重现此问题的简单代码是
var cassandra = require('cassandra-driver')
var client = new cassandra.Client({ contactPoints: ['node1', 'node2', 'node3'], keyspace: 'ks' });
var query = 'SELECT * FROM TableX WHERE myKey = :value';
client.eachRow(query, { value: 'someValue' }, { prepare: true, fetchSize: 500 }, function(n, row) {
console.log(row);
}, function(err) {
console.log(err)
});
最佳答案
正如与OP讨论的那样,它看起来像是驱动程序3.1.3版本中的错误:
更多信息:https://datastax-oss.atlassian.net/browse/NODEJS-310
现在,它已在v3.1.4 of the driver中修复。