Skip to content

feat(db): warn at mount when TimescaleDB extension is missing#45

Merged
mfreed merged 1 commit into
mainfrom
feat/timescaledb-check
May 25, 2026
Merged

feat(db): warn at mount when TimescaleDB extension is missing#45
mfreed merged 1 commit into
mainfrom
feat/timescaledb-check

Conversation

@mfreed
Copy link
Copy Markdown
Member

@mfreed mfreed commented May 25, 2026

History features (.history/, .log/, .savepoint/, .undo/) require TimescaleDB. The .build/ handler already refuses ',history' builds with a clear FSError when the extension is absent (fs/build.go:79-92), so users can't accidentally trigger raw SQL errors from CREATE TABLE WITH (tsdb.hypertable, ...).

What was missing: proactive notice at mount time. A user on vanilla PostgreSQL had no signal until they tried to opt into history.

This commit adds:

  • Client.WarnIfTimescaleDBMissing(ctx): probes pg_extension and logs a single Warn-level line with an actionable hint when the extension is absent. Non-blocking; probe errors are swallowed rather than gating startup.
  • Wired into all three mount entry points (fuse/mount_ops.go, fuse/fs.go, nfs/mount_darwin.go) immediately after the DB client is created.
  • Two unit tests on the existing .build/ guard: absent ->
    FSError{ErrInvalidPath} with a hint mentioning TimescaleDB and CREATE EXTENSION; present -> guard falls through (no TimescaleDB-shaped error).

Surface coverage:

  • Source-table CRUD: works on vanilla Postgres (no TimescaleDB).
  • ',history' build: blocked at build-time with hint.
  • .history/, .log/, .savepoint/, .undo/: unreachable unless the build succeeded, so the build-time guard is the only gate.
  • Mount itself: never blocked; the warning is a heads-up.

History features (.history/, .log/, .savepoint/, .undo/) require
TimescaleDB. The .build/<app> handler already refuses ',history'
builds with a clear FSError when the extension is absent
(fs/build.go:79-92), so users can't accidentally trigger raw SQL
errors from CREATE TABLE WITH (tsdb.hypertable, ...).

What was missing: proactive notice at mount time. A user on vanilla
PostgreSQL had no signal until they tried to opt into history.

This commit adds:
- Client.WarnIfTimescaleDBMissing(ctx): probes pg_extension and logs
  a single Warn-level line with an actionable hint when the
  extension is absent. Non-blocking; probe errors are swallowed
  rather than gating startup.
- Wired into all three mount entry points (fuse/mount_ops.go,
  fuse/fs.go, nfs/mount_darwin.go) immediately after the DB client
  is created.
- Two unit tests on the existing .build/<app> guard: absent ->
  FSError{ErrInvalidPath} with a hint mentioning TimescaleDB and
  CREATE EXTENSION; present -> guard falls through (no
  TimescaleDB-shaped error).

Surface coverage:
- Source-table CRUD: works on vanilla Postgres (no TimescaleDB).
- ',history' build: blocked at build-time with hint.
- .history/, .log/, .savepoint/, .undo/: unreachable unless the
  build succeeded, so the build-time guard is the only gate.
- Mount itself: never blocked; the warning is a heads-up.
@mfreed mfreed merged commit 4bca75b into main May 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant