Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (mariadb): Disable wsrep replication during restore to fix "Maximum writeset size exceeded" on Galera Cluster

Rostislav Dugincefedb6ddd66
diff --git a/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go b/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go
index 1897c382..df7e8945 100644
--- a/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go
+++ b/backend/internal/features/restores/usecases/mariadb/restore_backup_uc.go
@@ -70,6 +70,14 @@ func (uc *RestoreMariadbBackupUsecase) Execute(
"--verbose",
}
+ // Disable Galera Cluster replication for the restore session to prevent
+ // "Maximum writeset size exceeded" errors on large restores.
+ // wsrep_on is available in MariaDB 10.1+ (all builds with Galera support).
+ // On non-Galera instances the variable still exists but is a no-op.
+ if mdb.Version != tools.MariadbVersion55 {
+ args = append(args, "--init-command=SET SESSION wsrep_on=OFF")
+ }
+
if !config.GetEnv().IsCloud {
args = append(args, "--max-allowed-packet=1G")
}
@@ -379,6 +387,13 @@ func (uc *RestoreMariadbBackupUsecase) handleMariadbRestoreError(
)
}
+ if containsIgnoreCase(stderrStr, "writeset size exceeded") {
+ return fmt.Errorf(
+ "MariaDB Galera Cluster writeset size limit exceeded. Try increasing wsrep_max_ws_size on your cluster nodes. stderr: %s",
+ stderrStr,
+ )
+ }
+
return errors.New(errorMsg)
}