mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Synchro: need to order the replicas by id for the split algorithm to work fine
SVN:trunk[1734]
This commit is contained in:
@@ -1989,7 +1989,10 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
|
||||
$aOrderSpec = array();
|
||||
foreach ($aOrderBy as $sFieldAlias => $bAscending)
|
||||
{
|
||||
MyHelpers::CheckValueInArray('field name in ORDER BY spec', $sFieldAlias, self::GetAttributesList($oFilter->GetFirstJoinedClass()));
|
||||
if ($sFieldAlias != 'id')
|
||||
{
|
||||
MyHelpers::CheckValueInArray('field name in ORDER BY spec', $sFieldAlias, self::GetAttributesList($oFilter->GetFirstJoinedClass()));
|
||||
}
|
||||
if (!is_bool($bAscending))
|
||||
{
|
||||
throw new CoreException("Wrong direction in ORDER BY spec, found '$bAscending' and expecting a boolean value");
|
||||
|
||||
@@ -2361,7 +2361,15 @@ class SynchroExecution
|
||||
$aArguments['step_count'] = $iStepCount;
|
||||
$iStepCount++;
|
||||
|
||||
$this->m_oStatLog->AddTrace("Launching a separate process: step $iStepCount");
|
||||
|
||||
list ($iRes, $aOut) = utils::ExecITopScript('synchro/priv_sync_chunk.php', $aArguments);
|
||||
|
||||
$this->m_oStatLog->AddTrace("The script replied:");
|
||||
foreach ($aOut as $sOut)
|
||||
{
|
||||
$this->m_oStatLog->AddTrace(">>> $sOut");
|
||||
}
|
||||
|
||||
$sLastRes = strtolower(trim(end($aOut)));
|
||||
$bContinue = ($sLastRes == 'continue');
|
||||
@@ -2447,8 +2455,9 @@ class SynchroExecution
|
||||
|
||||
if ($iMaxReplica)
|
||||
{
|
||||
// Re-build the object set and set a LIMIT
|
||||
$oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array() /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos));
|
||||
// Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica
|
||||
// The replica have to be ordered by id
|
||||
$oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToObsolete), array('id'=>true) /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos));
|
||||
$oSetToProcess->SetLimit($iMaxReplica);
|
||||
}
|
||||
else
|
||||
@@ -2542,8 +2551,9 @@ class SynchroExecution
|
||||
|
||||
if ($iMaxReplica)
|
||||
{
|
||||
// Re-build the object set and set a LIMIT
|
||||
$oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToSync), array() /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos), $this->m_aExtDataSpec);
|
||||
// Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica
|
||||
// The replica have to be ordered by id
|
||||
$oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToSync), array('id'=>true) /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sLimitDate, 'curr_pos' => $iCurrPos), $this->m_aExtDataSpec);
|
||||
$oSetToProcess->SetLimit($iMaxReplica);
|
||||
}
|
||||
else
|
||||
@@ -2608,14 +2618,15 @@ class SynchroExecution
|
||||
{
|
||||
$this->m_oStatLog->AddTrace("Deletion date: $sDeletionDate");
|
||||
}
|
||||
$sSelectToDelete = "SELECT SynchroReplica WHERE id > :curr_pos AND sync_source_id = :source_id AND status IN ('obsolete') AND status_last_seen < :last_import";
|
||||
$sSelectToDelete = "SELECT SynchroReplica WHERE id > :curr_pos AND sync_source_id = :source_id AND status IN ('obsolete') AND status_last_seen < :last_import";
|
||||
$oSetScope = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToDelete), array() /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sDeletionDate, 'curr_pos' => $iCurrPos));
|
||||
$iCountScope = $oSetScope->Count();
|
||||
|
||||
if ($iMaxReplica)
|
||||
{
|
||||
// Re-build the object set and set a LIMIT
|
||||
$oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToDelete), array() /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sDeletionDate, 'curr_pos' => $iCurrPos));
|
||||
// Consider a given subset, starting from replica iCurrPos, limited to the count of iMaxReplica
|
||||
// The replica have to be ordered by id
|
||||
$oSetToProcess = new DBObjectSet(DBObjectSearch::FromOQL($sSelectToDelete), array('id'=>true) /* order by*/, array('source_id' => $this->m_oDataSource->GetKey(), 'last_import' => $sDeletionDate, 'curr_pos' => $iCurrPos));
|
||||
$oSetToProcess->SetLimit($iMaxReplica);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user