forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8b938d3
committed
Refactor more code logic to update the control file
ce6afc6 has begun the refactoring work by plugging pg_rewind into acentral routine to update the control file, and left around two extracopies, with one in xlog.c for the backend and one in pg_resetwal.c. Byadding an extra option to the central routine in controldata_utils.c tocontrol if a flush of the control file needs to be done, it is provingto be straight-forward to make xlog.c and pg_resetwal.c use the centralcode path at the condition of moving the wait event tracking there.Hence, this allows to have only one central code path to update thecontrol file, shaving the code from the duplicates.This refactoring actually fixes a problem in pg_resetwal. Previously,the control file was first removed before being recreated. So if acrash happened between the moment the file was removed and the momentthe file was created, then it would have been possible to not have acontrol file anymore in the database folder.Author: Fabien CoelhoReviewed-by: Michael PaquierDiscussion:https://postgr.es/m/alpine.DEB.2.21.1903170935210.2506@lancre1 parenta7eadaa commit8b938d3
File tree
5 files changed
+55
-116
lines changed- src
- backend/access/transam
- bin
- pg_resetwal
- pg_rewind
- common
- include/common
5 files changed
+55
-116
lines changedLines changed: 6 additions & 42 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
| |||
4754 | 4755 |
| |
4755 | 4756 |
| |
4756 | 4757 |
| |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
4757 | 4762 |
| |
4758 | 4763 |
| |
4759 | 4764 |
| |
4760 |
| - | |
4761 |
| - | |
4762 |
| - | |
4763 |
| - | |
4764 |
| - | |
4765 |
| - | |
4766 |
| - | |
4767 |
| - | |
4768 |
| - | |
4769 |
| - | |
4770 |
| - | |
4771 |
| - | |
4772 |
| - | |
4773 |
| - | |
4774 |
| - | |
4775 |
| - | |
4776 |
| - | |
4777 |
| - | |
4778 |
| - | |
4779 |
| - | |
4780 |
| - | |
4781 |
| - | |
4782 |
| - | |
4783 |
| - | |
4784 |
| - | |
4785 |
| - | |
4786 |
| - | |
4787 |
| - | |
4788 |
| - | |
4789 |
| - | |
4790 |
| - | |
4791 |
| - | |
4792 |
| - | |
4793 |
| - | |
4794 |
| - | |
4795 |
| - | |
4796 |
| - | |
4797 |
| - | |
4798 |
| - | |
4799 |
| - | |
4800 |
| - | |
4801 |
| - | |
| 4765 | + | |
4802 | 4766 |
| |
4803 | 4767 |
| |
4804 | 4768 |
| |
|
Lines changed: 3 additions & 61 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 |
| - | |
53 |
| - | |
| 52 | + | |
54 | 53 |
| |
55 | 54 |
| |
56 | 55 |
| |
| |||
918 | 917 |
| |
919 | 918 |
| |
920 | 919 |
| |
921 |
| - | |
922 |
| - | |
923 |
| - | |
924 |
| - | |
925 |
| - | |
926 |
| - | |
927 |
| - | |
928 |
| - | |
929 |
| - | |
930 |
| - | |
931 |
| - | |
932 |
| - | |
933 | 920 |
| |
934 | 921 |
| |
935 | 922 |
| |
| |||
961 | 948 |
| |
962 | 949 |
| |
963 | 950 |
| |
964 |
| - | |
965 |
| - | |
966 |
| - | |
967 |
| - | |
968 |
| - | |
969 |
| - | |
970 |
| - | |
971 |
| - | |
972 |
| - | |
973 |
| - | |
974 |
| - | |
975 |
| - | |
976 |
| - | |
977 |
| - | |
978 |
| - | |
979 |
| - | |
980 |
| - | |
981 |
| - | |
982 |
| - | |
983 |
| - | |
984 |
| - | |
985 |
| - | |
986 |
| - | |
987 |
| - | |
988 |
| - | |
989 |
| - | |
990 |
| - | |
991 |
| - | |
992 |
| - | |
993 |
| - | |
994 |
| - | |
995 |
| - | |
996 |
| - | |
997 |
| - | |
998 |
| - | |
999 |
| - | |
1000 |
| - | |
1001 |
| - | |
1002 |
| - | |
1003 |
| - | |
1004 |
| - | |
1005 |
| - | |
1006 |
| - | |
1007 |
| - | |
1008 |
| - | |
1009 |
| - | |
1010 |
| - | |
| 951 | + | |
| 952 | + | |
1011 | 953 |
| |
1012 | 954 |
| |
1013 | 955 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
377 | 377 |
| |
378 | 378 |
| |
379 | 379 |
| |
380 |
| - | |
| 380 | + | |
381 | 381 |
| |
382 | 382 |
| |
383 | 383 |
| |
|
Lines changed: 42 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
| 32 | + | |
32 | 33 |
| |
| 34 | + | |
33 | 35 |
| |
34 | 36 |
| |
35 | 37 |
| |
| |||
144 | 146 |
| |
145 | 147 |
| |
146 | 148 |
| |
147 |
| - | |
148 |
| - | |
149 |
| - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
150 | 153 |
| |
151 | 154 |
| |
152 | 155 |
| |
153 |
| - | |
| 156 | + | |
154 | 157 |
| |
155 | 158 |
| |
156 | 159 |
| |
| |||
182 | 185 |
| |
183 | 186 |
| |
184 | 187 |
| |
185 |
| - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
186 | 194 |
| |
187 | 195 |
| |
188 | 196 |
| |
| |||
198 | 206 |
| |
199 | 207 |
| |
200 | 208 |
| |
| 209 | + | |
| 210 | + | |
| 211 | + | |
201 | 212 |
| |
202 | 213 |
| |
203 | 214 |
| |
| |||
215 | 226 |
| |
216 | 227 |
| |
217 | 228 |
| |
| 229 | + | |
| 230 | + | |
| 231 | + | |
218 | 232 |
| |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
219 | 255 |
| |
220 |
| - | |
221 | 256 |
| |
222 | 257 |
| |
223 | 258 |
| |
224 | 259 |
| |
225 | 260 |
| |
226 |
| - | |
227 |
| - | |
228 | 261 |
| |
229 | 262 |
| |
230 | 263 |
| |
231 |
| - | |
232 | 264 |
| |
| 265 | + | |
233 | 266 |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
17 |
| - | |
| 16 | + | |
| 17 | + | |
18 | 18 |
| |
19 |
| - | |
| 19 | + | |
20 | 20 |
| |
21 | 21 |
|
0 commit comments
Comments
(0)