forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit00d9dcf
committed
pg_dump: Fix gzip compression of empty data
The pg_dump Compressor API has three basic callbacks - Allocate, Writeand End. The gzip implementation (sincee996073) wrongly assumed theWrite function would always be called, and deferred the initializationof the internal compression system until the first such call. But whenthere's no data to compress (e.g. for empty LO), this would result innot finalizing the compression state (because it was not actuallyinitialized), producing invalid dump.Fixed by initializing the internal compression system in the Allocatecall, whenever the caller provides the Write. For decompression thestate is not needed, so we leave the private_data member unpopulated.Introduces a pg_dump TAP test compressing an empty large object.This also rearranges the functions to their original order, to makediffs against older code simpler to understand. Finally, replace anunreachable pg_fatal() with a simple assert check.Reported-by: Justin PryzbyAuthor: Justin Pryzby, Georgios KokolatosReviewed-by: Georgios Kokolatos, Tomas Vondrahttps://postgr.es/m/20230228235834.GC30529%40telsasoft.com1 parent1671f99 commit00d9dcf
2 files changed
+100
-59
lines changedLines changed: 77 additions & 59 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
36 | 101 |
| |
37 |
| - | |
| 102 | + | |
38 | 103 |
| |
39 | 104 |
| |
40 | 105 |
| |
| |||
78 | 143 |
| |
79 | 144 |
| |
80 | 145 |
| |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
102 | 149 |
| |
103 | 150 |
| |
104 | 151 |
| |
105 | 152 |
| |
106 | 153 |
| |
107 | 154 |
| |
108 | 155 |
| |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 | 156 |
| |
141 | 157 |
| |
142 | 158 |
| |
143 |
| - | |
| 159 | + | |
144 | 160 |
| |
145 | 161 |
| |
146 | 162 |
| |
| |||
214 | 230 |
| |
215 | 231 |
| |
216 | 232 |
| |
217 |
| - | |
218 |
| - | |
219 | 233 |
| |
220 | 234 |
| |
221 | 235 |
| |
222 | 236 |
| |
223 | 237 |
| |
224 | 238 |
| |
225 |
| - | |
226 |
| - | |
227 |
| - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
228 | 246 |
| |
229 | 247 |
| |
230 | 248 |
| |
|
Lines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1265 | 1265 |
| |
1266 | 1266 |
| |
1267 | 1267 |
| |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1268 | 1291 |
| |
1269 | 1292 |
| |
1270 | 1293 |
| |
|
0 commit comments
Comments
(0)