Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

pg_backup_and_purge: Allow adjusting the backup concurrency.

Alex Vandiverb8a6de95d2df
diff --git a/docs/production/deployment.md b/docs/production/deployment.md
index 37b5f2ba68e..044e187b7ca 100644
--- a/docs/production/deployment.md
+++ b/docs/production/deployment.md
@@ -844,6 +844,13 @@ replicas](#postgresql-warm-standby). This is generally only set if you have
multiple warm standby replicas, in order to avoid taking multiple backups, one
per replica.
+#### `backups_disk_concurrency`
+
+Number of concurrent disk reads to use when taking backups. Defaults to 1; you
+may wish to increase this if you are taking backups on a replica, so can afford
+to affect other disk I/O, and have an SSD which is good at parallel random
+reads.
+
#### `ssl_ca_file`
Set to the path to the PEM-encoded certificate authority used to
diff --git a/puppet/zulip/files/postgresql/pg_backup_and_purge b/puppet/zulip/files/postgresql/pg_backup_and_purge
index d35cc77fd8f..6d1b87c5025 100755
--- a/puppet/zulip/files/postgresql/pg_backup_and_purge
+++ b/puppet/zulip/files/postgresql/pg_backup_and_purge
@@ -52,7 +52,11 @@ if len(pg_data_paths) != 1:
print(f"PostgreSQL installation is not unique: {pg_data_paths}")
sys.exit(1)
pg_data_path = pg_data_paths[0]
-subprocess.check_call(["env-wal-g", "backup-push", pg_data_path])
+
+disk_concurrency = get_config("postgresql", "backups_disk_concurrency", "1")
+env = os.environ.copy()
+env["WALG_UPLOAD_DISK_CONCURRENCY"] = disk_concurrency
+subprocess.check_call(["env-wal-g", "backup-push", pg_data_path], env=env)
now = datetime.now(tz=timezone.utc)
with open("/var/lib/nagios_state/last_postgresql_backup", "w") as f: