[3.0] Says so when the table being described is unlogged - #9655
Open
albertlast wants to merge 1 commit into
Open
albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
A table that is not written to the write-ahead log is made that way, and sessions, log_online and log_floodcontrol all are. table_sql() described them as ordinary tables, so anything rebuilding one from that SQL gave it a durability it was never meant to pay for, and the write cost that goes with it. Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PostgreSQL::table_sql()always writesCREATE TABLE, so the SQL it produces doesnot rebuild an unlogged table as one.
SMF makes three tables unlogged, in
Sources/Maintenance/Migration/v2_1/PostgreSqlUnlogged.php("UNLOGGED Table PG 9.1+"), via
ALTER TABLE {db_prefix}{raw:table} SET UNLOGGED:They are unlogged deliberately. None of them holds anything worth surviving a crash,
and keeping them out of the write-ahead log is the whole point of that migration.
Rebuilding one from
table_sql()output gives it back a durability it was nevermeant to pay for, and nothing afterwards says the change happened.
This reads
pg_class.relpersistencefor the table and putsUNLOGGEDinto theCREATEwhen it is'u'.table_sql()is presently only reachable through the deprecateddb_table_sqlalias in
Subs-Compat.php, so nothing in the current tree exercises it — which isalso why this went unnoticed. I found it because I have local work that calls it to
record a table's shape before an upgrade migrates it: the three tables above came
back logged, and only a
relpersistencecheck tells you so.Verified against PostgreSQL 17 in the Docker environment, on a forum upgraded from
2.1.7, by comparing
pg_class.relpersistencefor every table before and after arebuild driven by this output.
Issues References (Fixes|Related|Closes)