Commit Graph

58 Commits

Author SHA1 Message Date
Guo Xiang Tan
5da7c2a4ad FIX: Restorer wasn't rolling back if restore fails.
* This only applies to backup file taken with
  pg_dump 10.3+ and pg_dump 9.5.12+.
2018-04-06 09:43:32 +08:00
Guo Xiang Tan
142571bba0 Remove use of rescue nil.
* `rescue nil` is a really bad pattern to use in our code base.
  We should rescue errors that we expect the code to throw and
  not rescue everything because we're unsure of what errors the
  code would throw. This would reduce the amount of pain we face
  when debugging why something isn't working as expexted. I've
  been bitten countless of times by errors being swallowed as a
  result during debugging sessions.
2018-04-02 13:52:51 +08:00
Michael Brown
63a1e9b60a backup restorer: tidy pg_dump schema portability logic, add test 2018-03-20 10:32:39 +08:00
Guo Xiang Tan
da8e15f954 FIX: Restorer was not extracting the patch version in dump file. 2018-03-16 11:09:56 +08:00
Michael Brown
90291318eb restorer: clarify logging 2018-03-15 12:14:08 -04:00
Guo Xiang Tan
5ef75c9c61 Improve grep pattern in restorer. 2018-03-09 15:48:12 +08:00
Guo Xiang Tan
766b41d9f4 Fix version check in restorer. 2018-03-09 15:01:10 +08:00
Guo Xiang Tan
8fd47314d9 FIX: Restore process for dump taken with pg_dump 10.3+.
* Since we can no longer restore into a different schema,
  we will move tables in the public schema into the backup schema
  first before restoring the dump file which goes into the public
  schema. The downside to this approach is that we will increase
  the downtime experienced during the restore process. Downtime
  would equal the duration of restoring the dump file.
2018-03-09 13:24:58 +08:00
Guo Xiang Tan
a89f3160a5 Add new config to ensure backup/restore connects to PG directly.
* In `pg_dump` 10.3+ and 9.5.12+, in
  it does a `SELECT pg_catalog.set_config('search_path', '', false)`
  which changes the state of the current connection. This is known
  to be problematic with Pgbouncer which reuses connections. As such,
  we'll always try to connect directly to PG directly during
  the backup/restore process.
2018-03-09 10:28:03 +08:00
Will Jordan
a41446a502 single quote password in restore command
> Followup to #3283. Quotes passwords passed to shell for backup restore.
2018-03-01 12:08:35 -08:00
Sam
88a4ec5f1b FIX: stop forking regular backup jobs 2017-12-21 09:00:48 +11:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Leo McArdle
d0b027d88d FEATURE: phase 1 of supporting multiple email addresses 2017-07-20 11:22:27 +09:00
Guo Xiang Tan
b70d4da858 FIX: Only invite admins when automatic backup fails. 2017-06-15 14:04:22 +08:00
Guo Xiang Tan
f6060bfbf6 Invite admins to automatic backups failure topic.
https://meta.discourse.org/t/if-automatic-backup-fails-there-should-be-a-warning/64461
2017-06-14 15:01:11 +09:00
Guo Xiang Tan
5ce8d7a8c5 Log all errors during clean up as well. 2017-06-14 11:03:50 +09:00
Jay Pfaffman
83110a1a81 FIX: allow tar to finish if files change during backup 2017-06-07 13:31:02 -07:00
Guo Xiang Tan
a4deb0e47d Fix typo. 2017-03-24 20:59:34 +08:00
Guo Xiang Tan
e7c972ac89 FIX: Don't use backticks that take in inputs. 2017-03-17 15:33:51 +08:00
Guo Xiang Tan
b49bf889f6 SECURITY: Disallow symlinks when restoring uploads. 2017-03-17 14:27:01 +08:00
Guo Xiang Tan
7139538286 Fix typo. 2016-09-21 16:04:41 +08:00
Guo Xiang Tan
0bf7519a8a FIX: tar --list against a .tar.gz file takes too long.
This resulted in requests being blocked for an extended amount
of time when initializing the restorer.
2016-09-16 17:11:14 +08:00
Guo Xiang Tan
68637f2164 FIX: Uploads being restored into the wrong directory for multisite. 2016-09-16 14:26:06 +08:00
Guo Xiang Tan
f63a797e39 SECUIRTY: Escape input made to system calls. 2016-09-16 11:58:14 +08:00
Guo Xiang Tan
8f36290c05 FIX: No need to list all the files. 2016-09-16 11:57:35 +08:00
Guo Xiang Tan
7e80810de1 FIX: Raise an error if metadata is not extracted correctly. 2016-08-25 17:20:32 +08:00
Guo Xiang Tan
3e4b02bbd4 FIX: Make sure constant reflects the right backup extenstion. 2016-08-24 10:28:23 +08:00
Guo Xiang Tan
8539f02b5e FIX: Backuper should return the full path. 2016-08-08 07:49:37 +08:00
Guo Xiang Tan
adc8336949 Make sure we track restore/backlog success logs as well. 2016-08-03 16:23:47 +08:00
Guo Xiang Tan
b860d1b254 FIX: Ensure uploads directory exists. 2016-08-03 16:23:47 +08:00
Guo Xiang Tan
0a942dbc73 FEATURE: Avoid creating an archive for database only backups. 2016-08-03 16:23:46 +08:00
Guo Xiang Tan
441b98579a FIX: Ensure that our restorer is backwards compatible. 2016-08-02 09:19:56 +08:00
Guo Xiang Tan
76e57ddef3 FIX: Log errors in ensure block of restorer. 2016-07-26 10:24:01 +08:00
Guo Xiang Tan
03aa13b2bb FEATURE: Work with compressed version of pg_dump during backup and restore. 2016-07-26 10:24:01 +08:00
Guo Xiang Tan
1adfa0a4b5 FEATURE: Add SiteSetting to disable readonly mode during backup. 2016-07-19 17:44:04 +08:00
Guo Xiang Tan
b981041f6f Make sure we log failures in ensure block. 2016-07-15 11:36:47 +08:00
Neil Lalonde
91e4af0d3d FIX: restore of a backup from an older Discourse version can create new tables in the wrong schema, leading to UndefinedTable errors 2016-07-12 16:26:45 -04:00
Arpit Jalan
166d753bd3 FIX: delete PostgreSQL dump before gzipping archive (#4323) 2016-07-12 14:23:26 +02:00
Arpit Jalan
ed53a24dbe FIX: backup was failing on large instances (#4319) 2016-07-11 08:36:20 +01:00
Régis Hanol
8c52508007 warn users it may take a while to un/zip backup 2016-05-23 09:33:29 +02:00
Régis Hanol
332a1ea87e FIX: add support for 'space' in backup's filename 2016-04-04 17:24:02 +02:00
Neil Lalonde
3939b9ec7d FIX: restore in development mode connects to the wrong database 2016-02-12 17:20:38 -05:00
Régis Hanol
02d9ec5bde oops, should not have been commited 2016-01-19 01:01:17 +01:00
Régis Hanol
3083657358 FEATURE: better email in support
FEATURE: new incoming_email model
FEATURE: infinite scrolling in emails admin
FEATURE: new 'emails:import' rake task
2016-01-19 00:57:55 +01:00
Jeff Atwood
4d8eb25148 let's explicitly use gzip level 5 here
see http://tukaani.org/lzma/benchmarks.html
2016-01-11 03:03:14 -08:00
Régis Hanol
a726f5efea FIX: ensure we always remove old backups 2015-09-21 10:52:03 +02:00
Régis Hanol
96c23d51a2 FIX: don't break the message bus when restoring a backup 2015-08-27 20:02:13 +02:00
Chris Jester-Young
15cfb73aef Fix module name for RestoreDisabledError and FilenameMissingError. 2015-06-11 02:42:01 -04:00
Sam
803feefd54 MessageBus handles readonly redis now, no need to wrap it 2015-05-04 12:21:00 +10:00
Robin Ward
5b3f99aa50 Don't blow up if Redis switches to READONLY 2015-04-24 14:37:16 -04:00