I'm using node.js for a project, and I have this certain structure in my code which is causing problems. I have an array dateArr
of sequential dates that contains 106 items. I have an array resultArr
to hold resulting data. My code structure is like this:
function grabData(value, index, dateArr) {
cassandra client execute query with value from dateArr {
if (!err) {
if (result has more than 0 rows) {
process the query data
push to resultArr
}
if (result is empty) {
push empty set to resultArr
}
}
}
}
dateArr.forEach(grabData);
I logged the size of resultArr
after each iteration and it appears that on some iterations nothing is being pushed to resultArr
. The code completes with only 66 items stored in resultArr
when 106 items should be stored because the I/O structure between dateArr
and resultArr
is 1 to 1.
答案 0 :(得分:0)
答案 1 :(得分:0)
找到根本原因:使用node.js查询Cassandra时存在硬限制。我试图完全执行的查询太大了。将dateArr
分成更小的块并使用那些较小的块查询解决了问题。