Disk and history protection
History grows until the disk is full, unless something stops it. For each running project, YTCC watches the disks the history depends on, raises alarms as they fill, frees space in a fixed order and, as a last step, stops recording. The live system does not depend on the disk: drivers, screens, commands and active alarms keep working when the disk is full. Only the recording of history is affected.
For retention by days and size per archive table, see How history is recorded.
What is watched
Every 30 seconds YTCC measures these disks:
- the disk of the YTCC folder, for example
C:\YTCC; - the disk of the PostgreSQL data folder;
- the disks of the folders listed in Watch paths in Historian settings.
The fullest of them decides the level. The values are also published as system signals, for example
System.Historian.DiskUsedPct, System.Historian.DiskFreeGB and System.Historian.DiskLevel (0 normal to 3 critical),
so you can show them on a screen. See System, alarm and session signals.
Levels
A level is reached only when both conditions are true: the used percentage is at or above its limit, and the free space is below an absolute limit. The absolute limits are 2.5, 1.5 and 1 times Min free (GB).
| Level | Default | Alarm | Effect |
|---|---|---|---|
| Warning | 80 % used and less than 50 GB free | Medium | None |
| High | 90 % used and less than 30 GB free | High | None |
| Critical | 95 % used and less than 20 GB free | Critical | Recording of values pauses; events, alarms and commands are still recorded |
Because of the second condition, a large disk with plenty of free space does not raise alarms only because its percentage is high. On a small disk the percentage decides. A level goes up as soon as it is reached; it goes down only when the used percentage is 2 points below the limit, so that the alarm does not come and go.
The percentages are Disk warn (%), Disk high (%) and Disk crit (%) in Historian settings. See Archive tables and assignments.
When free space runs out
The minimum free space is the smaller of Min free (%) of the disk and Min free (GB); by default 10 % and 20 GB. On a small disk the percentage applies, on a large disk the 20 GB. When the free space falls below it, YTCC frees space in this order until enough is free:
- It deletes the oldest days of the value tables. The last Protect days of each table are kept.
- It deletes log files older than 10 days from the
logsfolder, and backup files in thebackupsfolder except the 7 newest. - It deletes the oldest days of the event tables, again keeping the protected days.
- It stops recording values.
- If the disk is completely full, it also stops recording events.
Each step is written to the event list. System signals System.Historian.ValuesPaused and
System.Historian.EventsPaused show whether recording is stopped.
The cleanup deletes project backups in C:\YTCC\backups except the 7 newest. Keep copies of your backups on another
disk or computer. See Backup and restore.
Reserve file
YTCC keeps a file of Reserve file (GB) size, 2 GB by default, as reserve.bin in the YTCC folder. It creates the
file while that disk is less than 90 % used. When the disk reaches 99 % used, YTCC deletes the file, which gives the
system room to work, and raises a critical alarm. The alarm clears and the file is created again when the disk is below
90 % used. With Reserve file (GB) set to 0, no file is created.
When the history database cannot be reached
If the history database or a history writer is not available, values and events wait in a buffer on the server and are written when it is back:
| Buffer | Holds | Size |
|---|---|---|
| Values | All signal values, in the data\nats folder of the YTCC folder | 10 % of the total size of that disk, at least 256 MiB and at most 5 GiB; at most one day |
| Events | Alarms, commands, operator actions and system events | 1 GiB |
When a buffer is full, the oldest data is dropped. How long an outage the value buffer bridges depends on how many values per second the project produces: roughly the buffer size divided by the data written per second, at most one day.
Each archive table has its own writer. A writer that falls behind raises a lag alarm for its table: medium when half of the buffer is waiting, high at 80 %. It clears when less than 30 % is waiting. When data was dropped before it was written, a gap alarm (high) for the table says how many values were lost and for about which time span; the same is written to the event list. That part of the history is missing and cannot be filled in later. The gap alarm clears after 10 minutes without new loss. A writer that starts after a stop reports the gap at start.
Alarms
The disk and history alarms are system alarms of the project:
| Situation | Priority |
|---|---|
| Disk at the warning level | Medium |
| Disk at the high level | High |
| Disk at the critical level; recording of values stopped | Critical |
| Disk full; reserve file deleted | Critical |
| An archive table above 80 % of its size limit | Medium |
| Days of an archive table deleted because of its size limit | High |
| History recording switched off with History enabled | Medium |
| A writer falls behind | Medium, then high |
| Values were lost before they were written | High |
See System alarms for all system alarms.