streaming: Switch to use make_streaming_reader

Using make_streaming_reader for streaming on the sender side, it has
the following advantages:

- streaming, repair will not pollute the row cache on the sender side
  any more. Currently, we are risking evicting all the frequently-queried
  partitions from the cache when an operation like repair reads entire
  sstables and floods the row cache with swathes of cold data from they
  read from disk.

- less data will be sent becasue the reader will only return existing
  data before the point of the reader is created, plus bounded amount
  of writes which arrive later. This helps reducing the streaming time
  in the case new data is being inserted all the time while streaming is
  in progress. E.g., adding a new node while there is a lot of cql write
  workload.

Fixes #382
Fixes #1682
This commit is contained in:
Asias He
2016-09-23 06:26:37 +08:00
parent b505e34062
commit ac6198208b

View File

@@ -109,8 +109,7 @@ future<> do_send_mutations(auto si, auto fm, bool fragmented) {
future<> send_mutations(auto si) {
auto& cf = si->db.find_column_family(si->cf_id);
auto& priority = service::get_local_streaming_read_priority();
return do_with(cf.make_reader(cf.schema(), si->pr, query::full_slice, priority), [si] (auto& reader) {
return do_with(cf.make_streaming_reader(cf.schema(), si->pr), [si] (auto& reader) {
return repeat([si, &reader] () {
return reader().then([si] (auto smopt) {
if (smopt && si->db.column_family_exists(si->cf_id)) {