void build_scanner(ObIterator &iter, ObScanner &scanner, char *buffer, const int64_t buf_len, int64_t &pos) { ObCellInfo *ci = NULL; while(OB_SUCCESS == iter.next_cell()) { if (OB_SUCCESS == iter.get_cell(&ci) && NULL != ci) { scanner.add_cell(*ci); } } scanner.serialize(buffer, buf_len, pos); }
int ObGetScanProxy::fill_compact_data(ObIterator& iterator,ObScanner& scanner) { int ret = OB_SUCCESS; ObCellInfo* cell = NULL; bool is_row_changed = false; while (OB_SUCCESS == (ret = iterator.next_cell())) { ret = iterator.get_cell(&cell,&is_row_changed); if (OB_SUCCESS != ret || NULL == cell) { TBSYS_LOG(WARN, "failed to get cell, cell=%p, err=%d", cell, ret); } else { ret = scanner.add_cell(*cell, false, is_row_changed); if (OB_SIZE_OVERFLOW == ret) { //TODO TBSYS_LOG(INFO, "ObScanner size full, cannot add any cell."); scanner.rollback(); ret = OB_SUCCESS; break; } else if (OB_SUCCESS != ret) { TBSYS_LOG(WARN, "failed to add cell to scanner, ret=%d", ret); } } if (OB_SUCCESS != ret) { break; } } if (OB_ITER_END == ret) { ret = OB_SUCCESS; } else if (OB_SUCCESS != ret) { TBSYS_LOG(WARN, "retor occurs while iterating, ret=%d", ret); } return ret; }