This section describes how TDS manages the information stored inside the database. Even if these mechanisms provide a higher reliability, please note that we still suggest to make a daily dump of all MySQL databases and to keep at least a monthly dump for long term storage.
All these tasks are performed by the maintenance/purge.php script. Usuallay this script is automatically executed once per day (see CRON section).
These tables (acquisition tables, TRMC download tables,...) contains raw information that is usually not kept for long term. They are for example not used to draw graphics. Note that the content of the temporary table is not lost, but it is moved to another base to reduce the since of the size of the working base..
"Long term" tables
These are the measurement tables. These tables contain the usefull information
The working base, for example tetraedrecom1, is named base1 hereafter.
The archive base, for example tetraedrecom2, is named base2 hereafter. Its structure is totally to base1
The mirror base, for example tetraedrecom3, is named base3 hereafter. Its structure is totally to base1. If used, this base is lighter than base2 because its temporary tables are empty.
In this section, the concept of "new measures" applies to measures which have not been transfered yet. The adjective "new" is not related to the timestamp but to the transfer status
For temporary tables, the data are moved (copied then deleted) from base1 to base2. Only the data older that a specific limit are moved. The time limit is specified by $delay in __config.php. By configuring the proper value to $delete and $backup, it is possible to fine tune the behavior
The battery voltage works the same way but with its specific $delay_battery parameter.
In base2, that that are older than $delay_backup (respectively $delay_backup_battery) are deleted if $delete_backup is set.
TDS implements a battery voltage filter to keep only 1 value per day per device
Long term tables
All "new measures" are copied in base2 to create a backup. (base2 is thus also a kind of mirror but because this base can be very big, it would be better to use base3 as mirror)
Measures are then exported. Depending on the configuration, the export can be either to CSV files (in local or FTP directory) or to base3
In FILE_CSV mode, one or several files are created in the export directory as defined in __config.php.
In FTP mode, one or several files are created and transmitted per FTP as defined in __config.php.
In BASE3 mode, the data are copied to base3. This means that base3 can easily be used to implement a visualisation mirror server if necessary.
A cleaning task is also performed on base3 to clean old measurements. This tasks is controlled by $delete_base3_measure and $delay_base3_measure.