synchro_exec.php
Purpose
This service is used for data synchronization.
Invoke this service to trigger the synchronization of a given list of data sources.
This service can be used when performing data synchronization with an ETL:
-
The ETL load/updates the source data in table `Synchro…` for each DataSource
-
The ETL invokes synchro_exec.php to make the synchronization effective
Processing replicas
For the given DataSource, it parses all replicas, and processes them:
-
Update iTop objects mapped to replicas no more present in the source and needed to be obsolete because it's time.
-
Update iTop objects mapped to replicas which have changed since last synchro.
-
Then processes new replicas not yet mapped: it searches an iTop matching object using reconciliation keys
-
There is no matching iTop object and creation is allowed, then it creates an iTop object and record its id in
dest_id
-
There is a matching iTop object and update is allowed, then it maps and updates the already existing iTop object
-
Processing fields
In the Replica Table
-
a NULL value has the meaning Ignore this column so don't update that field in the destination object.
-
an empty string means empty the destination object field (force a reset of a value),
Limitations
for some type of fields, for example Enum, Integer, Decimal, the
above rules cannot be used, because the column definition does not
allow the empty string value.
-
The limitation can come from a synchro_import limitation or a SQL table limitation
-
🚧 The field table SQL definition is mirrored from the iTop corresponding + NULL always allowed</note>
Example
php -q /var/www/itop/synchro/synchro_exec.php --auth_user=john --auth_pwd=trust,no1 --data_sources=1
Arguments
Argument | Description | Defaut value |
---|---|---|
param_file | Parameters file - see Parameters file | - |
auth_user | User login - CLI mode only | - |
auth_pwd | User password - CLI mode only | - |
data_sources | Coma separated list of data sources to be synchronized | Mandatory! |
max_chunk_size | integer: the maximum number of replicas to process in one pass. A separate PHP process will be spawned for processing each chunk of max_chunk_size replicas. This option can be handy if the synchronization uses a huge amount of memory and you suspect memory leaks in the synchro processing. | Optional |
simulate | If set to 1 the whole synchro process will be
enclosed inside a transaction and never committed, but the report
of the actions it should have actually performed is produced. This
parameter is NOT compatible with the
max_chunk_size parameter. |
Optional |
Output
Normal execution
Normal execution: Replicas: 123 Replicas touched since last synchro: 12 Objects deleted: 2 Objects deletion errors: 0 Objects obsoleted: 1 Objects obsolescence errors: 0 Objects created: 3 Objects creation errors: 1 Objects updated: 4 Objects update errors: 0 Objects reconciled (updated): 5 Objects reconciled (unchanged): 1 Objects reconciliation errors: 1 Replica disappeared, no action taken: 3
Error
In this example, the argument data_sources is set to “432”, which does not correspond to an existing data source.
ERROR: The data source (id=432) does not exist.
Allowed users
Administrators will always be allowed to execute this page.
Non administrators will be
allowed if they are marked as being owner of the data source.
History
Available since 1.1
3_1_0/advancedtopics/synchro_exec.txt · Last modified:
2023/07/21 10:19 by 127.0.0.1