Commit b05fe7b
committed
Review logical replication tablesync code
Most importantly, remove optimization in LogicalRepSyncTableStart that
skips the normal walrcv_startstreaming/endstreaming dance. The
optimization is not critically important for production uses anyway,
since it only fires in cases with no activity, and saves an
uninteresting amount of work even then. Critically, it obscures bugs by
hiding the interesting code path from test cases.
Also: in GetSubscriptionRelState, remove pointless relation open; access
pg_subscription_rel->srsubstate with GETSTRUCT as is typical rather than
SysCacheGetAttr; remove unused 'missing_ok' argument.
In wait_for_relation_state_change, use explicit catalog snapshot
invalidation rather than obscurely (and expensively) through
GetLatestSnapshot.
In various places: sprinkle comments more liberally and rewrite a number
of them. Other cosmetic code improvements.
No backpatch, since no bug is being fixed here.
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Petr Jelínek <petr.jelinek@2ndquadrant.com>
Discussion: https://postgr.es/m/20201010190637.GA5774@alvherre.pgsql1 parent c5b097f commit b05fe7b
File tree
5 files changed
+131
-178
lines changed- src
- backend
- catalog
- replication/logical
- include/catalog
5 files changed
+131
-178
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
| 334 | + | |
336 | 335 | | |
337 | | - | |
338 | 336 | | |
339 | 337 | | |
340 | 338 | | |
341 | 339 | | |
342 | 340 | | |
343 | | - | |
344 | | - | |
345 | 341 | | |
346 | 342 | | |
347 | 343 | | |
348 | 344 | | |
349 | 345 | | |
350 | 346 | | |
351 | 347 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 348 | + | |
| 349 | + | |
361 | 350 | | |
362 | 351 | | |
363 | 352 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
368 | 356 | | |
369 | 357 | | |
370 | 358 | | |
| |||
374 | 362 | | |
375 | 363 | | |
376 | 364 | | |
377 | | - | |
378 | 365 | | |
379 | 366 | | |
380 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
441 | | - | |
| 440 | + | |
442 | 441 | | |
443 | 442 | | |
444 | 443 | | |
| |||
0 commit comments