For some reason, I want to rewrite the fdb GetKeyValuesReply before SS send back reply. The code modified in storageserver.actor.cpp:getKeyValuesQ
with fdb 7.1.44:
if (!r.data.empty() && /*some conditions*/) {
GetKeyValuesReply new_r;
new_r.arena.dependsOn(r.arena);
new_r.penalty = r.penalty;
new_r.more = r.more;
new_r.version = r.version;
new_r.cached = r.cached;
new_r.error = r.error;
for (int i = 0; i < r.data.size(); i++) {
if (filterOut(r.data[i].key, r.data[i].value) && (i != 0 && i != r.data.size() -1)) {
// filter out the data item except first and last item.
continue;
}
new_r.data.push_back(new_r.arena, r.data[i]);
}
req.reply.send(new_r);
} else {
req.reply.send(r);
}
when I compile & run above code, it always cause core dump.
Is there something wrong that I didn’t recognize about arena or send func?