bool InsertExecutor::p_execute(const NValueArray ¶ms) { // // See p_execute_init above. If we are inserting a // replicated table into an export table with no partition column, // we only insert on one site. For all other sites we just // do nothing. // TableTuple inputTuple; const TupleSchema *inputSchema = m_inputTable->schema(); if (p_execute_init(inputSchema, m_tmpOutputTable, inputTuple)) { p_execute_finish(); return true; } // // An insert is quite simple really. We just loop through our m_inputTable // and insert any tuple that we find into our targetTable. It doesn't get any easier than that! // TableIterator iterator = m_inputTable->iterator(); while (iterator.next(inputTuple)) { p_execute_tuple(inputTuple); } p_execute_finish(); return true; }
bool InsertExecutor::p_execute(const NValueArray ¶ms) { // // See p_execute_init above. If we are inserting a // replicated table into an export table with no partition column, // we only insert on one site. For all other sites we just // do nothing. // TableTuple inputTuple; const TupleSchema *inputSchema = m_inputTable->schema(); { if (p_execute_init_internal(inputSchema, m_tmpOutputTable, inputTuple)) { ConditionalSynchronizedExecuteWithMpMemory possiblySynchronizedUseMpMemory( m_replicatedTableOperation, m_engine->isLowestSite(), &s_modifiedTuples, int64_t(-1)); if (possiblySynchronizedUseMpMemory.okToExecute()) { // // An insert is quite simple really. We just loop through our m_inputTable // and insert any tuple that we find into our targetTable. It doesn't get any easier than that! // TableIterator iterator = m_inputTable->iterator(); while (iterator.next(inputTuple)) { p_execute_tuple_internal(inputTuple); } s_modifiedTuples = m_modifiedTuples; } else { if (s_modifiedTuples == -1) { // An exception was thrown on the lowest site thread and we need to throw here as well so // all threads are in the same state char msg[1024]; snprintf(msg, 1024, "Replicated table insert threw an unknown exception on other thread for table %s", m_targetTable->name().c_str()); VOLT_DEBUG("%s", msg); throw SerializableEEException(VOLT_EE_EXCEPTION_TYPE_REPLICATED_TABLE, msg); } } } } p_execute_finish(); return true; }