Skip to content

SolidCable querying incorrect database #63

@joshleblanc

Description

@joshleblanc

This came up recently, and doesn't actually effect the running application. I don't see any errors in the rails logs, and the application doesn't seem to be effected. Basically, solid_cable is querying the primary database for column information, which is erroring, inflating our postgres log directory.

We've simply turned off postgres logs in the meantime.

Our database.yml is setup as follows:

production:
  primary:
    <<: *default
    url: <%= ENV['PROD_DATABASE_URL'] %>
  cache:
    <<: *default
    adapter: sqlite3
    database: storage/production_cache.sqlite3
    migrations_paths: db/cache_migrate
  cable:
    <<: *default
    adapter: sqlite3
    database: storage/production_cable.sqlite3
    migrations_paths: db/cable_migrate
  queue:
    <<: *default
    adapter: sqlite3
    database: storage/production_queue.sqlite3
    migrations_paths: db/queue_migrate

cable.yml is setup as follows

production:
  adapter: solid_cable
  connects_to:
    database:
      writing: cable
  polling_interval: 0.1.seconds
  message_retention: 1.day

In the postgres logs, the following is printed every ~10th of a second or so. This seems to correspond to the polling_interval.

2025-05-13 11:57:50.043 EDT [13740] ERROR:  relation "solid_cable_messages" does not exist at character 523
2025-05-13 11:57:50.043 EDT [13740] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       c.collname, col_description(a.attrelid, a.attnum) AS comment,
	       attidentity AS identity,
	       attgenerated as attgenerated
	  FROM pg_attribute a
	  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	  LEFT JOIN pg_type t ON a.atttypid = t.oid
	  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
	 WHERE a.attrelid = '"solid_cable_messages"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
	 ORDER BY a.attnum

The problem is that postgres shouldn't be receiving this query at all, this should be relegated to the sqlite3 file.

Perhaps related, but not related to this library, is this also occurs with solid_queue, except on it's recurring polling_interval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions