Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[BUG] drop_partitions_by_system_ttl fails on ts_kv_cloud_event child partitions #226

Copy link
Copy link

Description

@tjtnorton
Issue body actions

Describe the bug

On Edge, the timeseries TTL cleanup fails to drop expired telemetry partitions, so disk isn't reclaimed. It looks like the fix for #177 (#180) doesn't cover the cloud event child partitions.

#180 excluded ts_kv_cloud_event from drop_partitions_by_system_ttl, but only the parent table:

AND tablename != 'ts_kv_cloud_event'

The child partitions ts_kv_cloud_event_<epoch> still match LIKE 'ts_kv_%', so SPLIT_PART(partition, '_', 3)::integer hits 'cloud' and throws again:

ERROR: invalid input syntax for type integer: "cloud"
  Where: PL/pgSQL function drop_partitions_by_system_ttl(...) line 67

The cleanup transaction aborts, so no ts_kv_YYYY_MM partition is dropped and telemetry TTL stops reclaiming disk. The row-level DELETE fallback still runs, so it's silent until the disk fills.

Your Server Environment

  • own setup
    • Deployment type: docker-compose
    • ThingsBoard Edge Version: 4.3.1EDGE
    • PostgreSQL 16
    • Community Edition

To Reproduce
On an Edge with a telemetry TTL set and at least one ts_kv_cloud_event_<epoch> partition present:

CALL drop_partitions_by_system_ttl('MONTHS', 86400, 0);
-- ERROR: invalid input syntax for type integer: "cloud"

Suggested fix

In the three loops in schema-ts-psql.sql, change != 'ts_kv_cloud_event' to NOT LIKE 'ts_kv_cloud_event%'.

Additional context

Present in v4.3.1 through v4.3.1.3 and master.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.