拆分成多线程去访问元组后,只有当给全部数据访问的入口加锁,使并行的线程进行串行处理时数据才会正常,而当缩小临界区时,在访问时候将会出现问题。
本文记录遇到的问题。
-
- void JoinerGeneral::ExecuteInnerJoinPackRow(MIIterator *mii, Condition *cond, MINewContents *new_mind,
- DimensionVector *all_dims, std::vector<bool> *pack_desc_locked,
- int64_t *tuples_in_output, int64_t limit, bool count_only,
- bool *stop_execution,
- int64_t *rows_passed, int64_t *rows_omitted) {
- std::scoped_lock guard(mtx);
- int no_desc = (*cond).Size();
- int index = 0;
- while (mii->IsValid() && !*stop_execution) {
- if (mii->PackrowStarted()) {
- bool omit_this_packrow = false;
- for (int i = 0; (i <