Commit a33e17f
committed
Rework internal command generation of pg_rewind
pg_rewind generates and executes internally up to two commands to work
on the target cluster, depending on the options given by its caller:
- postgres -C to retrieve the value of restore_command, when using
-c/--restore-target-wal.
- postgres --single to enforce recovery once and get the target cluster
in a clean shutdown state.
Both commands have been applying incorrect quoting rules, which could
lead to failures when for example using a target data directory with
unexpected characters like CRLFs. Those commands are now generated with
PQExpBuffer, making use of string_utils.h to quote those commands as
they should. We may extend those commands in the future with more
options, so this makes any upcoming additions easier.
This is arguably a bug fix, but nobody has complained about the existing
code being a problem either, so no backpatch is done.
Extracted from a larger patch by the same author.
Author: Gunnar "Nick" Bluth
Discussion: https://postgr.es/m/7c59265d-ac50-b0aa-ca1e-65e8bd27642a@pro-open.de1 parent 7a85073 commit a33e17f
1 file changed
+33
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
1016 | 1017 | | |
1017 | 1018 | | |
1018 | 1019 | | |
1019 | | - | |
1020 | 1020 | | |
| 1021 | + | |
1021 | 1022 | | |
1022 | 1023 | | |
1023 | 1024 | | |
| |||
1051 | 1052 | | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
| 1055 | + | |
1057 | 1056 | | |
1058 | | - | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1059 | 1068 | | |
1060 | 1069 | | |
1061 | 1070 | | |
| |||
1067 | 1076 | | |
1068 | 1077 | | |
1069 | 1078 | | |
| 1079 | + | |
| 1080 | + | |
1070 | 1081 | | |
1071 | 1082 | | |
1072 | 1083 | | |
| |||
1080 | 1091 | | |
1081 | 1092 | | |
1082 | 1093 | | |
1083 | | - | |
| 1094 | + | |
1084 | 1095 | | |
1085 | 1096 | | |
1086 | 1097 | | |
| |||
1119 | 1130 | | |
1120 | 1131 | | |
1121 | 1132 | | |
1122 | | - | |
1123 | | - | |
| 1133 | + | |
1124 | 1134 | | |
1125 | | - | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
1126 | 1147 | | |
1127 | 1148 | | |
1128 | | - | |
| 1149 | + | |
1129 | 1150 | | |
| 1151 | + | |
| 1152 | + | |
1130 | 1153 | | |
1131 | 1154 | | |
1132 | 1155 | | |
| |||
0 commit comments