Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+20
-20
@@ -40,7 +40,7 @@ bool TemplateHandler::init()
|
||||
};
|
||||
if (!m_mainHandler->db()->select(cb))
|
||||
{
|
||||
ERROR_LOG() << "Error while reading template data from database";
|
||||
ERROR_LOG(m_logger) << "Error while reading template data from database";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ bool TemplateHandler::init()
|
||||
void TemplateHandler::onModifyTemplateDataRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ParticipantManagement::ModifyTemplateDataRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onModifyTemplateDataRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onModifyTemplateDataRequest: " << request;
|
||||
const auto ret = modifyTemplateDataRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_mainHandler->fts()->modifyTemplateDataReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
}
|
||||
removeTransaction.commit();
|
||||
|
||||
DEBUG_LOG() << "Starting validating ModifyTemplateDataRequest";
|
||||
DEBUG_LOG(m_logger) << "Starting validating ModifyTemplateDataRequest";
|
||||
if (templatesToBeCreatedOrModified.size() >= 1000) // concurrent validation for big requests
|
||||
{
|
||||
QVector<QFuture<Core::FunctionReplyObject>> futureVec;
|
||||
@@ -125,7 +125,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
{
|
||||
for (const ParticipantManagement::TemplateData ¤tTemplate : std::as_const(templatesToBeCreatedOrModified))
|
||||
{
|
||||
DEBUG_LOG() << "Validating template: " << currentTemplate;
|
||||
DEBUG_LOG(m_logger) << "Validating template: " << currentTemplate;
|
||||
auto ret = validateTemplateData(templatesToBeCreatedOrModified, modIdToTemplateId, currentTemplate);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
@@ -134,17 +134,17 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
|
||||
DBTransaction trans(m_mainHandler->db()->database());
|
||||
// only continue if there was no error detected
|
||||
DEBUG_LOG() << "ModifyTemplateDataRequest has valid data";
|
||||
DEBUG_LOG(m_logger) << "ModifyTemplateDataRequest has valid data";
|
||||
|
||||
// create new and update existing templates
|
||||
DEBUG_LOG() << "Creating new and updating existing templates ...";
|
||||
DEBUG_LOG(m_logger) << "Creating new and updating existing templates ...";
|
||||
|
||||
for (const TemplateData ¤tData : std::as_const(templatesToBeCreatedOrModified))
|
||||
{
|
||||
Template *templateToUpdate = m_templates.value(modIdToTemplateId.value(currentData.modId()));
|
||||
if (!templateToUpdate)
|
||||
{
|
||||
DEBUG_LOG() << "Creating new template: " << currentData;
|
||||
DEBUG_LOG(m_logger) << "Creating new template: " << currentData;
|
||||
const auto ret = createNewTemplate(currentData, modIdToTemplateId, templatesWithChanges);
|
||||
if (ret.error())
|
||||
return ret;
|
||||
@@ -155,13 +155,13 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
if (templateToUpdate->hasToBeChanged(currentData) &&
|
||||
!templatesWithChanges.contains(templateToUpdate))
|
||||
{
|
||||
DEBUG_LOG() << "Template changed: " << templateToUpdate->toDdsTemplateParticipant();
|
||||
DEBUG_LOG(m_logger) << "Template changed: " << templateToUpdate->toDdsTemplateParticipant();
|
||||
templatesWithChanges.append(templateToUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "New templates created and existing templates updated";
|
||||
DEBUG_LOG(m_logger) << "New templates created and existing templates updated";
|
||||
|
||||
// build hierarchy
|
||||
for (const TemplateData ¤tData : std::as_const(templatesToBeCreatedOrModified)) // first set superiorIds
|
||||
@@ -179,7 +179,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
|
||||
if (!currentTemplate->hasNewInferiorStructure(inferiorIdsForTemplate(currentTemplate->id())) ||
|
||||
templatesWithChanges.contains(currentTemplate))
|
||||
continue;
|
||||
DEBUG_LOG() << "Template got new inferiors: " << currentTemplate->toDdsTemplateParticipant();
|
||||
DEBUG_LOG(m_logger) << "Template got new inferiors: " << currentTemplate->toDdsTemplateParticipant();
|
||||
templatesWithChanges.append(currentTemplate);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ std::vector<int32_t> TemplateHandler::inferiorIdsForTemplate(int32_t superiorTem
|
||||
{
|
||||
if (currentTemplate->superiorId() == superiorTemplateId)
|
||||
{
|
||||
DEBUG_LOG() << "Building hierarchy, parentId: " << superiorTemplateId << " has child " << currentTemplate->id();
|
||||
DEBUG_LOG(m_logger) << "Building hierarchy, parentId: " << superiorTemplateId << " has child " << currentTemplate->id();
|
||||
result.push_back(currentTemplate->id());
|
||||
}
|
||||
}
|
||||
@@ -254,14 +254,14 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
{
|
||||
if (templateToValidate.templateId() != 0)
|
||||
{
|
||||
DEBUG_LOG() << "Checking template id";
|
||||
DEBUG_LOG(m_logger) << "Checking template id";
|
||||
Template *existingTemplate = m_templates.value(templateToValidate.templateId(), nullptr);
|
||||
if (existingTemplate == nullptr)
|
||||
return Core::FunctionReplyObject(tr_lts("dds",
|
||||
"Could not execute ModifyTemplateDataRequest, because an invalid template ID (%1) was given"))
|
||||
.arg(templateToValidate.templateId());
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
{
|
||||
QMutexLocker l(&m_mutex);
|
||||
modIdToTemplateId.insert(templateToValidate.modId(), existingTemplate->id()); /* register template to indicate that this template
|
||||
@@ -272,7 +272,7 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
// superior ids valid?
|
||||
if (templateToValidate.superiorModId() > 0)
|
||||
{
|
||||
DEBUG_LOG() << "checking superiorIds";
|
||||
DEBUG_LOG(m_logger) << "checking superiorIds";
|
||||
// superior exists?
|
||||
bool isExistingSuperiorId = false;
|
||||
for (const TemplateData &dat : dataVec)
|
||||
@@ -289,14 +289,14 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
.arg(templateToValidate.modId())
|
||||
.arg(templateToValidate.superiorModId());
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
if (templateToValidate.hierarchyNumber() <= 0)
|
||||
return Core::FunctionReplyObject(tr_lts("dds",
|
||||
"Could not execute ModifyTemplateDataRequest, because a data set has a superior but no hierarchyNumber set"));
|
||||
|
||||
// all hierarchy numbers with same superior unique?
|
||||
DEBUG_LOG() << "Checking hierarchyNumbers";
|
||||
DEBUG_LOG(m_logger) << "Checking hierarchyNumbers";
|
||||
for (const TemplateData &dat : dataVec)
|
||||
{
|
||||
// operator==() on optionals returns false if not set ...
|
||||
@@ -308,18 +308,18 @@ Core::FunctionReplyObject TemplateHandler::validateTemplateData(const QVector<Te
|
||||
.arg(dat.superiorModId())
|
||||
.arg(dat.hierarchyNumber());
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
}
|
||||
|
||||
// typeId valid?
|
||||
DEBUG_LOG() << "Checking typeId";
|
||||
DEBUG_LOG(m_logger) << "Checking typeId";
|
||||
if (m_mainHandler->typeHandler()->typeById(templateToValidate.typeId()) == nullptr)
|
||||
return Core::FunctionReplyObject(tr_lts("dds",
|
||||
"Could not execute ModifyTemplateDataRequest, because data set with modId %1 has invalid typeId %2"))
|
||||
.arg(templateToValidate.modId())
|
||||
.arg(templateToValidate.typeId());
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
return Core::FunctionReplyObject();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user