Skip to content

Samba DC restore fails with empty TimescaleDB #7834

@DavidePrincipi

Description

@DavidePrincipi

During NS8 Samba module restore, the TimescaleDB container may fail while restoring the samba_audit database. The failure is caused by a race condition between CREATE EXTENSION timescaledb, background worker initialization, and the early execution of timescaledb_pre_restore(). As a result, internal TimescaleDB catalog objects are missing when pg_restore starts, causing the restore to abort. The issue is more reproducible when the database to restore is almost empty.

Steps to reproduce

  • Install NS8 and the Samba DC with VPN IP address
  • Generate a backup where the samba_audit database is empty or almost empty
  • Restore the backup on a new cluster or node
  • Observe the Samba module restore task failing at the TimescaleDB restore step

Expected behavior

The Samba module restore completes successfully, restoring (or recreating) the samba_audit database even when it contains little or no data.

Actual behavior

The restore aborts with errors like:

  • relation _timescaledb_catalog.chunk_index does not exist
  • function _timescaledb_functions.insert_blocker() does not exist

The failure occurs after timescaledb_pre_restore() terminates TimescaleDB background workers before internal catalogs are fully initialized.

Log excerpt:

Restore samba_audit data in TimescaleDB:

CREATE DATABASE
CREATE EXTENSION

2026-01-26 15:29:26.416 UTC [41] LOG:  TimescaleDB background worker launcher connected to shared catalogs

timescaledb_pre_restore
(1 row)

2026-01-26 15:29:26.861 UTC [52] FATAL:  terminating background worker "TimescaleDB Background Worker Scheduler" due to administrator command
2026-01-26 15:29:26.864 UTC [35] LOG:  background worker "TimescaleDB Background Worker Scheduler" (PID 52) exited with exit code 1

2026-01-26 15:29:26.889 UTC [54] ERROR:  relation "_timescaledb_catalog.chunk_index" does not exist
2026-01-26 15:29:26.889 UTC [54] STATEMENT:  COPY _timescaledb_catalog.chunk_index (...) FROM stdin;

2026-01-26 15:29:26.910 UTC [54] ERROR:  function _timescaledb_functions.insert_blocker() does not exist
2026-01-26 15:29:26.910 UTC [54] STATEMENT:  CREATE TRIGGER ts_insert_blocker ...

Components

  • NethServer Core 3.16
  • Samba DC 3.4.1

See also

Acknowledgements

Thanks to @nrauso

Metadata

Metadata

Assignees

Labels

testingPackages are available from testing repositories

Type

Projects

Status

Testing

Relationships

None yet

Development

No branches or pull requests

Issue actions