ExportXMLWordPrintable

    • Sprint candidates

      Primary keys migration with compression fails. The script looks for the compression policy by the old name "Compression%", but tsdb now calls it "Columnstore Policy". AsĀ  a result, the new history tables end up without hypertables and compression.

      Steps to reproduce:

      1. Enable tsdb:
        echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix
        cat /usr/share/zabbix-sql-scripts/postgresql/timescaledb.sql | sudo -u zabbix psql zabbix
        
      1. Start zabbix server and run housekeeper: zabbix_server -R housekeeper_execute
      2. Stop zabbix server and run the migration as described in the documentation:
        sudo -u zabbix psql zabbix < /usr/share/zabbix-sql-scripts/postgresql/history_pk_prepare.sql
        cat /usr/share/zabbix-sql-scripts/postgresql/tsdb_history_pk_upgrade_with_compression/history_pk.sql | sudo -u zabbix psql zabbix
        

      Actual result:

      ERROR:  need to specify one of "compress_after" or "compress_created_before"
      CONTEXT:  SQL statement "SELECT add_compression_policy('history', (
                  SELECT extract(epoch FROM (config::json->>'compress_after')::interval)
                  FROM timescaledb_information.jobs
                  WHERE application_name LIKE 'Compression%%' AND hypertable_schema='public'
                      AND hypertable_name='history_old'
                  )::integer
              )"
      

      The new history table stays a regular table, not a hypertable, no compression policy, no data.

      Expected result:
      History is a hypertable with the migrated data and the same compression policy as history_old.

      Suggested fix:
      In database/postgresql/timescaledb/option-patches/with-compression/history_pk.sql:58 (same line in history_pk_uint.sql, history_pk_str.sql, history_pk_text.sql; line 62 in history_pk_log.sql), replace the job lookup condition with:

      WHERE (application_name LIKE 'Columnstore Policy%%' OR application_name LIKE 'Compression%%') AND hypertable_schema='public'
      

            Assignee:
            Mihails Prihodko
            Reporter:
            Rostislavs Belovs
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: