Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5162~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5162
Choose a head ref
  • 5 commits
  • 2 files changed
  • 3 contributors

Commits on Apr 3, 2025

  1. Fix autoprewarm neglect of tablespaces

    While prewarming blocks from a dump file, autoprewarm_database_main()
    mistakenly ignored tablespace when detecting the beginning of the next
    relation to prewarm. Because RelFileNumbers are only unique within a
    tablespace, autoprewarm could miss prewarming blocks from a
    relation with the same RelFileNumber in a different tablespace.
    
    Though this situation is likely rare in practice, it's best to make the
    code correct. Do so by explicitly checking for the RelFileNumber when
    detecting a new relation.
    
    Reported-by: Heikki Linnakangas <[email protected]>
    Discussion: https://postgr.es/m/97c36982-603b-494a-95f4-aaf2a12ac27e%40iki.fi
    melanieplageman authored and Commitfest Bot committed Apr 3, 2025
    Configuration menu
    Copy the full SHA
    da5ffbc View commit details
    Browse the repository at this point in the history
  2. Remove superfluous autoprewarm check

    autoprewarm_database_main() prewarms blocks from the same database. It
    is passed an array of sorted BlockInfoRecords and a start and stop index
    into the array. The range represented should include only blocks
    belonging to global objects or blocks from a single database. Remove an
    unnecessary check that the current block is from the same database and
    add an assert to ensure this invariant remains.
    melanieplageman authored and Commitfest Bot committed Apr 3, 2025
    Configuration menu
    Copy the full SHA
    a6c7f21 View commit details
    Browse the repository at this point in the history
  3. Refactor autoprewarm_database_main() in preparation for read stream

    Autoprewarm prewarms blocks from a dump file representing the contents
    of shared buffers at the time it was dumped. It uses a sorted array of
    BlockInfoRecords, each representing a block from one of the cluster's
    databases and tables.
    
    autoprewarm_database_main() prewarms all the blocks from a single
    database. It is optimized to ensure we don't try to open the same
    relation or fork over and over again if it has been dropped or is
    invalid. The main loop handled this by carefully setting various local
    variables to sentinel values when a run of blocks should be skipped.
    
    This method won't work with the read stream API. A read stream can only
    be created for a single relation and fork combination. The callback has
    to be able to advance the position in the array to allow for reading
    ahead additional blocks, however the callback cannot try to open another
    relation or close the current relation. So, the main loop in
    autoprewarm_database_main() must also advance the position in the array
    of BlockInfoRecords.
    
    To make it compatible with the read stream API, change
    autoprewarm_database_main() to explicitly fast-forward in the array past
    the blocks belonging to an invalid relation or fork.
    
    This commit only implements the new control flow -- it does not use the
    read stream API.
    
    Co-authored-by: Nazir Bilal Yavuz <[email protected]>
    Co-authored-by: Melanie Plageman <[email protected]>
    Reviewed-by: Heikki Linnakangas <[email protected]>
    Reviewed-by: Daniel Gustafsson <[email protected]>
    Discussion: https://postgr.es/m/flat/CAN55FZ3n8Gd%2BhajbL%3D5UkGzu_aHGRqnn%2BxktXq2fuds%3D1AOR6Q%40mail.gmail.com
    2 people authored and Commitfest Bot committed Apr 3, 2025
    Configuration menu
    Copy the full SHA
    98d3496 View commit details
    Browse the repository at this point in the history
  4. Use streaming read I/O in autoprewarm

    Make a read stream for each valid fork of each valid relation
    represented in the autoprewarm dump file and prewarm those blocks
    through the read stream API instead of by directly invoking
    ReadBuffer().
    
    Co-authored-by: Nazir Bilal Yavuz <[email protected]>
    Co-authored-by: Melanie Plageman <[email protected]>
    Reviewed-by: Heikki Linnakangas <[email protected]>
    Reviewed-by: Daniel Gustafsson <[email protected]>
    Reviewed-by: Andrey M. Borodin <[email protected]> (earlier versions)
    Reviewed-by: Kirill Reshke <[email protected]>  (earlier versions)
    Reviewed-by: Matheus Alcantara <[email protected]> (earlier versions)
    Discussion: https://postgr.es/m/flat/CAN55FZ3n8Gd%2BhajbL%3D5UkGzu_aHGRqnn%2BxktXq2fuds%3D1AOR6Q%40mail.gmail.com
    2 people authored and Commitfest Bot committed Apr 3, 2025
    Configuration menu
    Copy the full SHA
    15e22a2 View commit details
    Browse the repository at this point in the history
  5. [CF 5162] v14 - Use read streams in autoprewarm

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5162
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CAAKRu_Yk5c9O_9pvKN0CxkDD+oOX2iVNaDc57k_wJke+jOOyQQ@mail.gmail.com
    Author(s): Nazir Bilal Yavuz
    Commitfest Bot committed Apr 3, 2025
    Configuration menu
    Copy the full SHA
    9bbc10e View commit details
    Browse the repository at this point in the history
Loading