Skip to content

about AddPullCB size check #167

Open
@jasperzhong

Description

@jasperzhong

https://github.com/dmlc/ps-lite/blob/master/include/ps/kv_app.h#L689

template <typename Val>
template <typename C, typename D>
int KVWorker<Val>::AddPullCB(
    const SArray<Key>& keys, C* vals, D* lens, int cmd,
    const Callback& cb) {
  int ts = obj_->NewRequest(kServerGroup);
  AddCallback(ts, [this, ts, keys, vals, lens, cb]() mutable {
      ...
  
      if (vals->empty()) {
        vals->resize(total_val);
      } else {
        CHECK_EQ(vals->size(), total_val);    // here
      }
     ...
    });

  return ts;
}

IMO, vals is the buffer to store pull results. So it does not have to be equal to total_val. Greater size should also be allowed. So I propose changing to CHECK_GE(vals->size(), total_val);.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions