Commit 4e64912
committed
Fix multistage processing
The multi-stage processing in the flex output has some problems when
updating data, for instance when relations are deleted after their
member ways use their tags.
This commit reorganizes how the multi-stage processing is done to
address these problems.
1. The way "marking" of objects is done is now different. Instead of
doing this in the process_* Lua functions a new Lua function
"select_relation_members()" is introduced. This will be called not only
for all new relations but also for deleted relations, or when a relation
changed, for the old relation. This is needed so that we also mark and
then re-create way entries in the database that used to depend on a
parent relations tags, but don't do that any more. This function
must return the way ids that need to be re-processed in stage 2.
2. We remove the Lua mark() function. Instead the return value of
"select_relation_members()" is used to mark way ids. Marking of nodes
and relations isn't supported. It was never possible to mark nodes
anyway. And there is no use case I am aware of currently that needs
marking relations. Both can be reintroduced later when we have a
better idea how to handle them. For the time being we concentrate on
the important use case where member ways of relations are handled
specially.
3. This introduces a new processing stage 1c:
* stage 1a: Read input file and process all objects in it.
* stage 1b: Process dependent objects of objects from 1a (ie
changed nodes trigger changes in ways with those nodes, changes
in all objects potentially trigger changes in parent relations).
* stage 1c: Process dependent relations of objects marked during
stage 1a/1b (this one is new).
* stage 2: Reprocess objects marked in stage 1a or 1b.
4. New Lua helper function osm2pgsql.way_member_ids() that returns
the ids of all way members of the specified relation. This is often
needed in "select_relation_members()". If you need more complex
processing, for instance to use the member roles to decide which
ways need stage 2 processing, you can still write your own loop.
This commit reduces the number of processes used in the
TestPgsqlUpdateParallel regression test from 16 to 15. This is needed so
we don't hit the default limit of 100 for the number of database
connections. This is probably something we should look into, but not
here and now.1 parent 858bebd commit 4e64912
File tree
13 files changed
+735
-145
lines changed- docs
- flex-config
- src
- tests
- data
13 files changed
+735
-145
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
248 | 261 | | |
249 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
250 | 281 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
258 | 295 | | |
259 | 296 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
264 | 311 | | |
265 | 312 | | |
266 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 48 | | |
52 | 49 | | |
53 | | - | |
| 50 | + | |
| 51 | + | |
54 | 52 | | |
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
58 | | - | |
59 | | - | |
| 56 | + | |
| 57 | + | |
60 | 58 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
71 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
72 | 88 | | |
73 | 89 | | |
74 | | - | |
75 | | - | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | | - | |
| 93 | + | |
79 | 94 | | |
80 | 95 | | |
81 | 96 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 97 | + | |
| 98 | + | |
87 | 99 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 100 | + | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
584 | | - | |
585 | 583 | | |
586 | 584 | | |
587 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
223 | 227 | | |
224 | 228 | | |
225 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
226 | 242 | | |
227 | 243 | | |
228 | 244 | | |
| |||
371 | 387 | | |
372 | 388 | | |
373 | 389 | | |
374 | | - | |
| 390 | + | |
375 | 391 | | |
376 | | - | |
377 | | - | |
378 | | - | |
| 392 | + | |
| 393 | + | |
379 | 394 | | |
| 395 | + | |
| 396 | + | |
380 | 397 | | |
381 | 398 | | |
382 | 399 | | |
383 | 400 | | |
384 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
385 | 415 | | |
386 | 416 | | |
387 | | - | |
| 417 | + | |
388 | 418 | | |
389 | 419 | | |
390 | | - | |
| 420 | + | |
391 | 421 | | |
392 | 422 | | |
393 | 423 | | |
394 | | - | |
| 424 | + | |
395 | 425 | | |
396 | 426 | | |
397 | 427 | | |
| |||
432 | 462 | | |
433 | 463 | | |
434 | 464 | | |
435 | | - | |
| 465 | + | |
436 | 466 | | |
437 | 467 | | |
438 | | - | |
| 468 | + | |
439 | 469 | | |
440 | | - | |
| 470 | + | |
441 | 471 | | |
0 commit comments