Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+50
-50
@@ -84,7 +84,7 @@ bool HandlerBaseDownload::init()
|
||||
if (!m_scmDtc->enableServiceInformation() ||
|
||||
!m_scmDtc->enableGroupInformation())
|
||||
{
|
||||
ERROR_LOG() << "Enabling SCM Data-Topics failed.";
|
||||
ERROR_LOG(m_logger) << "Enabling SCM Data-Topics failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ bool HandlerBaseDownload::init()
|
||||
if (!m_scmFtc->enableRestartGroup() ||
|
||||
!m_scmFtc->enableStopGroup())
|
||||
{
|
||||
ERROR_LOG() << "Enabling SCM Function-Topics failed.";
|
||||
ERROR_LOG(m_logger) << "Enabling SCM Function-Topics failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG() << "HandlerBaseDownload initialised!";
|
||||
INFO_LOG(m_logger) << "HandlerBaseDownload initialised!";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -559,7 +559,7 @@ void HandlerBaseDownload::receiveFlmData()
|
||||
" FROM ") + tableName + where + where2);
|
||||
|
||||
|
||||
ERROR_LOG() << "FUCK FUCK WE ARE HERE!" << " snapshid id is= " << snapshotFolderId << " also my statement: " << stmt;
|
||||
ERROR_LOG(m_logger) << "FUCK FUCK WE ARE HERE!" << " snapshid id is= " << snapshotFolderId << " also my statement: " << stmt;
|
||||
std::unique_ptr<NSqlQuery> query = std::unique_ptr<NSqlQuery>(new NSqlQuery(remoteDbIfc->database(), m_logger));
|
||||
query->prepare(stmt);
|
||||
QVector<Database::FlmFileContent> dataVec;
|
||||
@@ -591,10 +591,10 @@ void HandlerBaseDownload::receiveFlmData()
|
||||
data.fileTypeId == FileManagement::FileType::Png)
|
||||
&& data.folderId != snapshotFolderId)
|
||||
{
|
||||
DEBUG_LOG() << "skip";
|
||||
DEBUG_LOG(m_logger) << "skip";
|
||||
continue;
|
||||
}
|
||||
// ERROR_LOG() << "ADD " << data.name;
|
||||
// ERROR_LOG(m_logger) << "ADD " << data.name;
|
||||
|
||||
dataVec.append(data);
|
||||
}
|
||||
@@ -602,7 +602,7 @@ void HandlerBaseDownload::receiveFlmData()
|
||||
|
||||
if (!dataVec.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Data vec has sisze: " << dataVec.size();
|
||||
ERROR_LOG(m_logger) << "Data vec has sisze: " << dataVec.size();
|
||||
storeToDataVecMap(DbDataType::FlmFileContent, std::vector<Database::FlmFileContent>(dataVec.begin(), dataVec.end()));
|
||||
m_remoteDbRetryCounter = 0;
|
||||
}
|
||||
@@ -682,10 +682,10 @@ QSqlDatabase HandlerBaseDownload::openDb(const QString &databaseName, bool remot
|
||||
s->databaseDriver(),
|
||||
remote ? m_hostname : s->databaseHostname(),
|
||||
remote ? Settings::remoteDbName() : databaseName);
|
||||
DEBUG_LOG() << "Trying to open database " << s->databaseHostname() << ":" << databaseName;
|
||||
DEBUG_LOG(m_logger) << "Trying to open database " << s->databaseHostname() << ":" << databaseName;
|
||||
if (!dbConnection.isOpen())
|
||||
{
|
||||
ERROR_LOG() << "Error opening database " << s->databaseHostname() << ":" << databaseName;
|
||||
ERROR_LOG(m_logger) << "Error opening database " << s->databaseHostname() << ":" << databaseName;
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
}
|
||||
@@ -725,11 +725,11 @@ void HandlerBaseDownload::updateBaseDownloadReply()
|
||||
|
||||
void HandlerBaseDownload::onStartBaseDownloadRequest(const rti::core::SampleIdentity &cookie, const StartBaseDownloadRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "Got Request, check for old one : " << request.hostname();
|
||||
DEBUG_LOG(m_logger) << "Got Request, check for old one : " << request.hostname();
|
||||
|
||||
if (request.timeStamp() < (QDateTime::currentMSecsSinceEpoch() - 10 * 1000)) //(5Sekunden)
|
||||
{
|
||||
DEBUG_LOG() << "old call? ignore! ";
|
||||
DEBUG_LOG(m_logger) << "old call? ignore! ";
|
||||
m_reply.progress(0);
|
||||
m_reply.errorString(std::string());
|
||||
m_reply.currentStep(std::string());
|
||||
@@ -937,7 +937,7 @@ void HandlerBaseDownload::switchState()
|
||||
break;
|
||||
default:
|
||||
{
|
||||
ERROR_LOG() << "State " << m_currentState << " is not handled properly.";
|
||||
ERROR_LOG(m_logger) << "State " << m_currentState << " is not handled properly.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -970,7 +970,7 @@ void HandlerBaseDownload::dropOldDatabase()
|
||||
const int revId = val.midRef(idx + 1).toInt(&bOk);
|
||||
if (!bOk)
|
||||
continue;
|
||||
DEBUG_LOG() << val << ", " << revId << ", " << curId;
|
||||
DEBUG_LOG(m_logger) << val << ", " << revId << ", " << curId;
|
||||
if (revId < curId - 1 || revId >= curId)
|
||||
m_databasesToDrop += val;
|
||||
}
|
||||
@@ -1017,14 +1017,14 @@ void HandlerBaseDownload::onCopyDbFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForAsmFinished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all ASM base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all ASM base data arrived.";
|
||||
|
||||
if (m_dataVecMap.contains(AsmTrainingArea) &&
|
||||
m_dataVecMap.contains(AsmLocation) &&
|
||||
m_dataVecMap.contains(AsmAsset) &&
|
||||
m_dataVecMap.contains(AsmTechnicalArea))
|
||||
{
|
||||
INFO_LOG() << "All ASM base data arrived.";
|
||||
INFO_LOG(m_logger) << "All ASM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1032,12 +1032,12 @@ void HandlerBaseDownload::checkForAsmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForExmFinished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all EXM base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all EXM base data arrived.";
|
||||
if (m_dataVecMap.contains(ExmExercise) &&
|
||||
m_dataVecMap.contains(ExmExercisePhase) &&
|
||||
m_dataVecMap.contains(ExmExerciseStateChange))
|
||||
{
|
||||
INFO_LOG() << "All EXM base data arrived.";
|
||||
INFO_LOG(m_logger) << "All EXM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1045,7 +1045,7 @@ void HandlerBaseDownload::checkForExmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForIsmFinished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all ISM base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all ISM base data arrived.";
|
||||
if (m_dataVecMap.contains(IsmAsset) &&
|
||||
m_dataVecMap.contains(IsmMainStructureElement) &&
|
||||
m_dataVecMap.contains(IsmStructureElement) &&
|
||||
@@ -1054,7 +1054,7 @@ void HandlerBaseDownload::checkForIsmFinished()
|
||||
m_dataVecMap.contains(IsmMountingPointSchedule) &&
|
||||
m_dataVecMap.contains(IsmMountingPointPlan))
|
||||
{
|
||||
INFO_LOG() << "All ISM base data arrived.";
|
||||
INFO_LOG(m_logger) << "All ISM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1062,22 +1062,22 @@ void HandlerBaseDownload::checkForIsmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForPpmEx0Finished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all PPM Ex0 base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all PPM Ex0 base data arrived.";
|
||||
if (m_dataVecMap.contains(PpmEquipmentType) &&
|
||||
m_dataVecMap.contains(PpmType))
|
||||
{
|
||||
INFO_LOG() << "All PPM Ex0 base data arrived.";
|
||||
INFO_LOG(m_logger) << "All PPM Ex0 base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void HandlerBaseDownload::checkForPpmExNFinished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all PPM ExN base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all PPM ExN base data arrived.";
|
||||
if (m_dataVecMap.contains(PpmParty) &&
|
||||
m_dataVecMap.contains(PpmParticipant))
|
||||
{
|
||||
INFO_LOG() << "All PPM ExN base data arrived.";
|
||||
INFO_LOG(m_logger) << "All PPM ExN base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1085,7 +1085,7 @@ void HandlerBaseDownload::checkForPpmExNFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForOpmFinished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all OPM base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all OPM base data arrived.";
|
||||
if (m_dataVecMap.contains(OpmGroup) &&
|
||||
m_dataVecMap.contains(OpmGroupGroup) &&
|
||||
m_dataVecMap.contains(OpmOperator) &&
|
||||
@@ -1095,7 +1095,7 @@ void HandlerBaseDownload::checkForOpmFinished()
|
||||
m_dataVecMap.contains(OpmAclAllow) &&
|
||||
m_dataVecMap.contains(OpmAclDeny))
|
||||
{
|
||||
INFO_LOG() << "All OPM base data arrived.";
|
||||
INFO_LOG(m_logger) << "All OPM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1103,11 +1103,11 @@ void HandlerBaseDownload::checkForOpmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForFlmFinished()
|
||||
{
|
||||
DEBUG_LOG() << "Checking if all FLM base data arrived.";
|
||||
DEBUG_LOG(m_logger) << "Checking if all FLM base data arrived.";
|
||||
if (m_dataVecMap.contains(FlmFolder) &&
|
||||
m_dataVecMap.contains(FlmFileContent))
|
||||
{
|
||||
INFO_LOG() << "All FLM base data arrived.";
|
||||
INFO_LOG(m_logger) << "All FLM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1442,13 +1442,13 @@ void HandlerBaseDownload::insertPpmExNDbData(bool live)
|
||||
participantData.push_back(newEntry);
|
||||
partyToUnit.insert(party.id, newEntry.id);
|
||||
|
||||
TRACE_LOG() << "Adding: " << newEntry.name << " to participantData.";
|
||||
TRACE_LOG(m_logger) << "Adding: " << newEntry.name << " to participantData.";
|
||||
}
|
||||
// insert pseudo-units
|
||||
ppmDbHandler->db()->upsert(participantData);
|
||||
#endif
|
||||
}
|
||||
DEBUG_LOG() << "Now add participants: " << getDbDataVec<ParticipantManagement::Database::PpmParticipant>(PpmParticipant).size();
|
||||
DEBUG_LOG(m_logger) << "Now add participants: " << getDbDataVec<ParticipantManagement::Database::PpmParticipant>(PpmParticipant).size();
|
||||
for (const auto &participant : getDbDataVec<ParticipantManagement::Database::PpmParticipant>(PpmParticipant))
|
||||
{
|
||||
if (participant.partyId == 0)
|
||||
@@ -1464,7 +1464,7 @@ void HandlerBaseDownload::insertPpmExNDbData(bool live)
|
||||
newParticipant.superiorId = partyToUnit.value(participant.partyId);
|
||||
newParticipant.hierarchyNumber = participant.id;
|
||||
#endif
|
||||
DEBUG_LOG() << "XXXXXXXX Adding Participant: " << newParticipant.id << " typeId: " << newParticipant.typeId << " typeClass: " << typeClass << " supperioer " << newParticipant.superiorId;
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXX Adding Participant: " << newParticipant.id << " typeId: " << newParticipant.typeId << " typeClass: " << typeClass << " supperioer " << newParticipant.superiorId;
|
||||
|
||||
newParticipants.push_back(std::move(newParticipant));
|
||||
}
|
||||
@@ -1587,7 +1587,7 @@ inline void resetVector(QPair<bool, QVector<T>> &dbVector)
|
||||
void HandlerBaseDownload::cleanup(const Core::FtReplyState &replyState, const std::string &errStr)
|
||||
{
|
||||
if (errStr.size() > 0)
|
||||
ERROR_LOG() << "Base Download ended with error: " << errStr;
|
||||
ERROR_LOG(m_logger) << "Base Download ended with error: " << errStr;
|
||||
|
||||
// cleanup db data
|
||||
qDeleteAll(m_dataVecMap);
|
||||
@@ -1649,7 +1649,7 @@ void HandlerBaseDownload::copyFromOldDatabase()
|
||||
const QString schemaName = QLatin1String("ex_") + QString::number(m_exerciseId);
|
||||
if (m_exTblGen->existsSchema(schemaName, dbIn))
|
||||
{
|
||||
DEBUG_LOG() << "### Copying old files from schema " << schemaName;
|
||||
DEBUG_LOG(m_logger) << "### Copying old files from schema " << schemaName;
|
||||
{
|
||||
// own transaction when old ex_N schema does not exist.
|
||||
DBTransaction trans(m_dbConnection);
|
||||
@@ -1721,7 +1721,7 @@ void HandlerBaseDownload::copyFromOldDatabase()
|
||||
for (const QString &table : std::as_const(tableList))
|
||||
{
|
||||
if (!copyTable(dbIn, m_dbConnection, table))
|
||||
ERROR_LOG() << "Failed to copy table " << table;
|
||||
ERROR_LOG(m_logger) << "Failed to copy table " << table;
|
||||
checkAliveTimer();
|
||||
}
|
||||
trans.commit();
|
||||
@@ -2187,7 +2187,7 @@ void HandlerBaseDownload::onStopGroupReply(const Core::FunctionReplyObject &repl
|
||||
return;
|
||||
}
|
||||
if (!m_stopGroupIds.remove(reply.id()))
|
||||
WARNING_LOG() << "Got unknown reply id for stop group request: " << reply.id();
|
||||
WARNING_LOG(m_logger) << "Got unknown reply id for stop group request: " << reply.id();
|
||||
|
||||
if (!m_stopGroupIds.isEmpty())
|
||||
return;
|
||||
@@ -2214,7 +2214,7 @@ void HandlerBaseDownload::restartCoreGroup()
|
||||
// we are also restarted... so answer here directly with 'finished'
|
||||
stateFinished();
|
||||
if (request.type() != Core::ServiceGroupType::Core)
|
||||
WARNING_LOG() << "Could not find core group to restart...";
|
||||
WARNING_LOG(m_logger) << "Could not find core group to restart...";
|
||||
|
||||
const auto restartCb = [this, request]()
|
||||
{
|
||||
@@ -2231,7 +2231,7 @@ void HandlerBaseDownload::onRestartGroupReply(const Core::FunctionReplyObject &r
|
||||
return;
|
||||
}
|
||||
// we won't get here since we're restarted too
|
||||
ERROR_LOG() << "onRestartGroupReply?";
|
||||
ERROR_LOG(m_logger) << "onRestartGroupReply?";
|
||||
stateFinished();
|
||||
}
|
||||
|
||||
@@ -2266,11 +2266,11 @@ bool HandlerBaseDownload::copyTable(const QSqlDatabase &dbIn, const QSqlDatabase
|
||||
NSqlQuery qIn(dbIn);
|
||||
NSqlQuery qOut(dbOut);
|
||||
|
||||
DEBUG_LOG() << "Copying " << tableName << " started";
|
||||
DEBUG_LOG(m_logger) << "Copying " << tableName << " started";
|
||||
const QSqlRecord record = dbIn.record(tableName);
|
||||
if (record.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Empty record for " << tableName;
|
||||
ERROR_LOG(m_logger) << "Empty record for " << tableName;
|
||||
return false;
|
||||
}
|
||||
QStringList selectTableColumns;
|
||||
@@ -2291,18 +2291,18 @@ bool HandlerBaseDownload::copyTable(const QSqlDatabase &dbIn, const QSqlDatabase
|
||||
selectTableColumns.join(QStringLiteral(", ")),
|
||||
insertTablePlaceholder.join(QStringLiteral(", "))));
|
||||
|
||||
DEBUG_LOG() << selectTableCommand;
|
||||
DEBUG_LOG() << insertTableCommand;
|
||||
DEBUG_LOG(m_logger) << selectTableCommand;
|
||||
DEBUG_LOG(m_logger) << insertTableCommand;
|
||||
|
||||
if (!qOut.prepare(insertTableCommand))
|
||||
{
|
||||
ERROR_LOG() << "qOut prepare failed... " << qOut.lastError().text();
|
||||
ERROR_LOG(m_logger) << "qOut prepare failed... " << qOut.lastError().text();
|
||||
return false;
|
||||
}
|
||||
if (!qIn.exec(selectTableCommand))
|
||||
{
|
||||
ERROR_LOG() << "qIn select failed... " << qIn.lastError().text();
|
||||
DEBUG_LOG() << "FAILED statement: " << selectTableCommand;
|
||||
ERROR_LOG(m_logger) << "qIn select failed... " << qIn.lastError().text();
|
||||
DEBUG_LOG(m_logger) << "FAILED statement: " << selectTableCommand;
|
||||
qIn.finish();
|
||||
return false;
|
||||
}
|
||||
@@ -2312,17 +2312,17 @@ bool HandlerBaseDownload::copyTable(const QSqlDatabase &dbIn, const QSqlDatabase
|
||||
qOut.bindValue(insertTablePlaceholder.at(i), qIn.value(i));
|
||||
if (!qOut.exec())
|
||||
{
|
||||
ERROR_LOG() << "qOut insert failed.. " << qOut.lastError().text();
|
||||
DEBUG_LOG() << "FAILED statement: " << insertTableCommand;
|
||||
ERROR_LOG(m_logger) << "qOut insert failed.. " << qOut.lastError().text();
|
||||
DEBUG_LOG(m_logger) << "FAILED statement: " << insertTableCommand;
|
||||
qOut.finish();
|
||||
return false;
|
||||
}
|
||||
checkAliveTimer();
|
||||
}
|
||||
DEBUG_LOG() << "Copying " << tableName << " finished";
|
||||
DEBUG_LOG(m_logger) << "Copying " << tableName << " finished";
|
||||
|
||||
if (!fixUpSequence(dbOut, tableName))
|
||||
WARNING_LOG() << "Failed to update sequence for table " << tableName;
|
||||
WARNING_LOG(m_logger) << "Failed to update sequence for table " << tableName;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2344,14 +2344,14 @@ bool HandlerBaseDownload::fixUpSequence(const QSqlDatabase &dbOut, const QString
|
||||
keyField = QStringLiteral("id");
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Updating sequence " << seqName << " for table " << tableName;
|
||||
DEBUG_LOG(m_logger) << "Updating sequence " << seqName << " for table " << tableName;
|
||||
|
||||
const QString stmt(QStringLiteral("SELECT setval('%1', COALESCE((SELECT MAX(%2)+1 FROM %3), 1), false)").arg(seqName, keyField, tableName));
|
||||
|
||||
if (!qOut.exec(stmt))
|
||||
{
|
||||
ERROR_LOG() << "FAILED to update sequence for table " << tableName << " : " << qOut.lastError().text();
|
||||
DEBUG_LOG() << "FAILED statement: " << stmt;
|
||||
ERROR_LOG(m_logger) << "FAILED to update sequence for table " << tableName << " : " << qOut.lastError().text();
|
||||
DEBUG_LOG(m_logger) << "FAILED statement: " << stmt;
|
||||
qOut.finish();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user