Skip to content

Bug: fix postgres backfill timeout#432

Merged
SimmerV merged 3 commits intoMeshAddicts:developfrom
SimmerV:bug-fix
Apr 11, 2026
Merged

Bug: fix postgres backfill timeout#432
SimmerV merged 3 commits intoMeshAddicts:developfrom
SimmerV:bug-fix

Conversation

@SimmerV
Copy link
Copy Markdown
Collaborator

@SimmerV SimmerV commented Apr 11, 2026

Summary

  • Schema migrations moved to independent try block: The ALTER TABLE migrations (including from_node_id/to_node_id columns on mqtt_messages) were inside the same try block as schema.sql execution. If schema.sql failed for any reason, the migrations never ran, leaving the table without required columns and causing column "from_node_id" does not exist errors on every MQTT write.
  • Backfill timeout fixes: The pool-level command_timeout=10 was overriding the SET statement_timeout = '120s' in the backfill method. Added explicit timeout=120 to all asyncpg calls in _backfill_mqtt_node_ids.
  • Partial index for backfill performance: Added idx_mqtt_messages_backfill partial index on mqtt_messages(id) WHERE from_node_id IS NULL so the backfill query uses an index scan instead of seq-scanning millions of rows.

@SimmerV SimmerV self-assigned this Apr 11, 2026
@SimmerV SimmerV added the bug Something isn't working label Apr 11, 2026
@SimmerV SimmerV merged commit 1be2811 into MeshAddicts:develop Apr 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant