Migration scripts fail because /tmp is hardcoded

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: 7.4.11
    • Component/s: Server (S)
    • None
    • Environment:
      Zabbix Server: 7.4.11
      PostgreSQL: 17.10
      TimescaleDB: 2.26.4
      Debian 13
      Installation from official Zabbix packages
      Package: zabbix-sql-scripts 7.4.11

      The PostgreSQL + TimescaleDB primary key migration scripts use hardcoded paths in /tmp for intermediate CSV files.

      Example:

       

      {{\copy (select * from history_uint_old) TO '/tmp/history_uint.csv' CSV;
      ...
      \copy temp_history_uint FROM '/tmp/history_uint.csv' CSV;}}

      On Debian 13, /tmp is mounted as tmpfs by default.

      When the exported CSV becomes larger than available tmpfs space, the migration fails with:

       

      could not write COPY data: No space left on device

      PostgreSQL server logs do not report any storage error because the failure happens in the psql client while writing the CSV file.

      How to reproduce

      1. Install Zabbix 7.4.11 with PostgreSQL + TimescaleDB.
      2. Use a database where history_uint produces a CSV larger than available /tmp.
      3. Run:

       

      {{history_upgrade_prepare.sql
      history_upgrade_uint.sql}}

      1. The migration fails with "No space left on device".

      Workaround

      Replace every occurrence of:

       

      /tmp/

      with

       

      /var/tmp/

      (or any persistent filesystem with sufficient free space).

      After changing only the output path, the migration completes successfully without any other modification.

      Expected behavior

      Migration scripts should not hardcode /tmp.

      Possible improvements:

      • use /var/tmp
      • allow configurable export directory
      • use server-side COPY without intermediate files
      • or stream data without creating large temporary CSV files

      This issue affects modern Linux distributions where /tmp is implemented as tmpfs by default.

            Assignee:
            Aigars Kadikis
            Reporter:
            Vaclav Dusek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: