mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
Update README, we don't do post-recovery cleanup actions anymore.
transam/README explained how B-tree incomplete splits were tracked and fixed after recovery, as an example of handling complex actions that need multiple WAL records, but that's not how it works anymore. Explain the new paradigm.
This commit is contained in:
@ -575,16 +575,21 @@ while holding AccessExclusiveLock on the relation.
|
|||||||
|
|
||||||
Due to all these constraints, complex changes (such as a multilevel index
|
Due to all these constraints, complex changes (such as a multilevel index
|
||||||
insertion) normally need to be described by a series of atomic-action WAL
|
insertion) normally need to be described by a series of atomic-action WAL
|
||||||
records. What do you do if the intermediate states are not self-consistent?
|
records. The intermediate states must be self-consistent, so that if the
|
||||||
The answer is that the WAL replay logic has to be able to fix things up.
|
replay is interrupted between any two actions, the system is fully
|
||||||
In btree indexes, for example, a page split requires insertion of a new key in
|
functional. In btree indexes, for example, a page split requires a new page
|
||||||
the parent btree level, but for locking reasons this has to be reflected by
|
to be allocated, and an insertion of a new key in the parent btree level,
|
||||||
two separate WAL records. The replay code has to remember "unfinished" split
|
but for locking reasons this has to be reflected by two separate WAL
|
||||||
operations, and match them up to subsequent insertions in the parent level.
|
records. Replaying the first record, to allocate the new page and move
|
||||||
If no matching insert has been found by the time the WAL replay ends, the
|
tuples to it, sets a flag on the page to indicate that the key has not been
|
||||||
replay code has to do the insertion on its own to restore the index to
|
inserted to the parent yet. Replaying the second record clears the flag.
|
||||||
consistency. Such insertions occur after WAL is operational, so they can
|
This intermediate state is never seen by other backends during normal
|
||||||
and should write WAL records for the additional generated actions.
|
operation, because the lock on the child page is held across the two
|
||||||
|
actions, but will be seen if the operation is interrupted before writing
|
||||||
|
the second WAL record. The search algorithm works with the intermediate
|
||||||
|
state as normal, but if an insertion encounters a page with the
|
||||||
|
incomplete-split flag set, it will finish the interrupted split by
|
||||||
|
inserting the key to the parent, before proceeding.
|
||||||
|
|
||||||
Writing Hints
|
Writing Hints
|
||||||
-------------
|
-------------
|
||||||
|
Reference in New Issue
Block a user