Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lazy detoast, working in PG 11beta3, 10, 9.6.
Introduce lazy detoasting, where if the value underlying a readable SQLXML instance is found not to be fully detoasted at the time of construction, it's allowed to stay that way until the contents are actually needed, as discussed in https://www.postgresql.org/message-id/1c64290b-b729-eeab-219e-1577a12e9b5a%40anastigmatix.net (and above and below in the same message thread), implementing the "just use the oldest one" snapshot selection strategy from https://www.postgresql.org/message-id/8ca78589-734b-f904-1cc5-007eeb5d4737%40anastigmatix.net The implementation passes the following test inspired by Andrew Gierth in https://www.postgresql.org/message-id/877eovbjc3.fsf%40news-spur.riddles.org.uk CREATE TABLE t(x xml); BEGIN READ WRITE, ISOLATION LEVEL READ COMMITTED; /* * In other session: INSERT INTO t(x) * SELECT table_to_xml('pg_operator', true, false, ''); */ SELECT javatest.echoxmlparameter(x, 0, 5) FROM t; -- 0 => stash x /* * In other session: DELETE FROM t; * VACUUM t; */ SELECT javatest.echoxmlparameter(null, 5, 5); -- null => unstash COMMIT; And, indeed, the same test is made to fail by commenting out the snapshot registrations/unregistrations in VarlenaWrapper.c, so they are performing the expected valuable service. Without them: ERROR: missing chunk number 0 for toast value 16716 in pg_toast_16708
- Loading branch information
Showing
4 changed files
with
311 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.