Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit67bab53

Browse files
committed
Fix parallel worker tracking of new catalog relfilenumbers.
Reunite RestorePendingSyncs() with RestoreRelationMap(). IfRelationInitPhysicalAddr() ran after RestoreRelationMap() but beforeRestorePendingSyncs(), the relcache entry could cause RelationNeedsWAL()to return true erroneously. Trouble required commands of the currenttransaction to include REINDEX or CLUSTER of a system catalog. Theparallel leader correctly derived RelationNeedsWAL()==false from the newrelfilenumber, but the worker saw RelationNeedsWAL()==true. WorkerMarkBufferDirtyHint() then wrote unwanted WAL. Recovery of thatunwanted WAL could lose tuples like the system could before commitc6b9204 introduced this tracking.RestorePendingSyncs() and RestoreRelationMap() were adjacent till commit126ec0b, so no back-patch for now.Reviewed by Tom Lane.Discussion:https://postgr.es/m/20241019232815.c6.nmisch@google.com
1 parente947224 commit67bab53

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

‎src/backend/access/transam/parallel.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,17 +1421,18 @@ ParallelWorkerMain(Datum main_arg)
14211421
StartParallelWorkerTransaction(tstatespace);
14221422

14231423
/*
1424-
* Restorerelmapper and reindex state early, since these affect catalog
1425-
*access. Ideally we'd do this evenbefore calling InitPostgres, but
1426-
*that has order-of-initializationproblems, and also the relmapper would
1427-
*get confused during theCommitTransactionCommand call above.
1424+
* Restorestate that affects catalog access. Ideally we'd do this even
1425+
* before calling InitPostgres, but that has order-of-initialization
1426+
* problems, and also the relmapper would get confused during the
1427+
* CommitTransactionCommand call above.
14281428
*/
1429+
pendingsyncsspace=shm_toc_lookup(toc,PARALLEL_KEY_PENDING_SYNCS,
1430+
false);
1431+
RestorePendingSyncs(pendingsyncsspace);
14291432
relmapperspace=shm_toc_lookup(toc,PARALLEL_KEY_RELMAPPER_STATE, false);
14301433
RestoreRelationMap(relmapperspace);
14311434
reindexspace=shm_toc_lookup(toc,PARALLEL_KEY_REINDEX_STATE, false);
14321435
RestoreReindexState(reindexspace);
1433-
1434-
/* Restore combo CID state. */
14351436
combocidspace=shm_toc_lookup(toc,PARALLEL_KEY_COMBO_CID, false);
14361437
RestoreComboCIDState(combocidspace);
14371438

@@ -1488,11 +1489,6 @@ ParallelWorkerMain(Datum main_arg)
14881489
SetTempNamespaceState(fps->temp_namespace_id,
14891490
fps->temp_toast_namespace_id);
14901491

1491-
/* Restore pending syncs. */
1492-
pendingsyncsspace=shm_toc_lookup(toc,PARALLEL_KEY_PENDING_SYNCS,
1493-
false);
1494-
RestorePendingSyncs(pendingsyncsspace);
1495-
14961492
/* Restore uncommitted enums. */
14971493
uncommittedenumsspace=shm_toc_lookup(toc,PARALLEL_KEY_UNCOMMITTEDENUMS,
14981494
false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp