void DatasetTableTailer::refreshProjectIds(const NdbDictionary::Dictionary* database, NdbTransaction* transaction, UISet dataset_ids, ProjectDatasetINodeCache* cache) { const NdbDictionary::Index * index= getIndex(database, TABLE.mTableName, _dataset_cols[0]); vector<NdbIndexScanOperation*> indexScanOps; UIRowMap rows; for (UISet::iterator it = dataset_ids.begin(); it != dataset_ids.end(); ++it) { NdbIndexScanOperation* op = getNdbIndexScanOperation(transaction, index); op->readTuples(NdbOperation::LM_CommittedRead); op->equal(_dataset_cols[DS_INODE_ID].c_str(), *it); NdbRecAttr* id_col = getNdbOperationValue(op, _dataset_cols[DS_INODE_ID]); NdbRecAttr* proj_id_col = getNdbOperationValue(op, _dataset_cols[DS_PROJ_ID]); NdbRecAttr* shared_col = getNdbOperationValue(op, _dataset_cols[DS_SHARED]); rows[*it].push_back(id_col); rows[*it].push_back(proj_id_col); rows[*it].push_back(shared_col); indexScanOps.push_back(op); } executeTransaction(transaction, NdbTransaction::NoCommit); int i = 0; for (UIRowMap::iterator it = rows.begin(); it != rows.end(); ++it, i++) { stringstream projs; int res=0; while (indexScanOps[i]->nextResult(true) == 0) { if (it->first != it->second[0]->int32_value()) { LOG_ERROR("Dataset [" << it->first << "] doesn't exists"); continue; } bool originalDs = it->second[2]->int8_value() == 0; if(!originalDs){ continue; } int projectId = it->second[1]->int32_value(); if(res == 0){ cache->addDatasetToProject(it->first, projectId); } projs << projectId << ","; res++; } if(res > 1){ LOG_FATAL("Got " << res << " rows of the original Dataset [" << it->first << "] in projects [" << projs.str() << "], only one was expected"); } } }