discourse/lib/backup_restore
Alan Guo Xiang Tan 30896b6d0e
PERF: Run primary and parallel DB setup concurrently in CI (#40319)
Reattempt of #40294, which was reverted in #40301 because two concurrent
processes raced on plugin symlink creation in
`Discourse::Utils.atomic_ln_s`. The first commit here fixes that race at
the source by serializing the check-and-replace with a file lock and
switching to `File.rename` (atomic on POSIX, doesn't follow symlinks at
the destination). A stress test of the previous implementation failed
15/16 workers under contention; the new implementation passes 5/5 stress
runs and 5/5 end-to-end CI-like runs locally with `LOAD_PLUGINS=1`.

The second commit is the parallelization itself: the two CI
database-setup steps run concurrently through GNU `parallel` instead of
one after the other. It also adds `Discourse.test_env_number` to align
the `TEST_ENV_NUMBER=""` interpretation across `FileStore::BaseStore`,
`Stylesheet::Manager`, `S3Helper`, and `BackupRestore::S3BackupStore`
with `config/boot.rb` — without this, the gem's first worker and the
primary process would race on `public/uploads/default/test_0/`.
2026-05-29 06:46:32 +08:00
..
backup_file_handler.rb FIX: Handle restore URLs ending with query params (#33384) 2025-07-07 18:43:31 +03:00
backup_store.rb FEATURE: Delete backups based on time window (#24296) 2023-12-13 13:00:27 -05:00
backuper.rb DEV: Add backuper.rb for autoload backwards compatibility 2026-01-22 23:03:23 +00:00
creator.rb DEV: Enable Rails/FilePath rubocop rule (#40097) 2026-05-19 19:07:54 +02:00
database_restorer.rb DEV: Enable Rails/FilePath rubocop rule (#40097) 2026-05-19 19:07:54 +02:00
factory.rb
local_backup_store.rb DEV: Enable Rails/FilePath rubocop rule (#40097) 2026-05-19 19:07:54 +02:00
logger.rb
meta_data_handler.rb
restorer.rb DEV: Fix assigned but unused variable Prism warnings (#39436) 2026-04-22 12:42:14 +02:00
s3_backup_store.rb PERF: Run primary and parallel DB setup concurrently in CI (#40319) 2026-05-29 06:46:32 +08:00
system_interface.rb DEV: Fix sidekiq requires in test env 2025-07-22 12:40:57 +02:00
uploads_restorer.rb DEV: Hand-pick Rails/WhereNot autofixes (#35117) 2025-10-03 13:29:22 +02:00