Race between datachecksum enablement and create table with the file_copy strategy
Hello
There's a small race window between enabling data checksums and
creating a new database with the file_copy strategy:
Create database checks for in progress data checksums before it
inserts a new row into pg_database. If the data checksum worker starts
in that window, it can miss the new database completely and skip
generating its checksums.
See the attached patch and test case using a new injection point.
Attachments:
0001-createdb-recheck-checksum-state-before-file_copy.patchapplication/octet-stream; name=0001-createdb-recheck-checksum-state-before-file_copy.patchDownload+100-1
On 21 Jul 2026, at 12:55, Zsolt Parragi <zsolt.parragi@percona.com> wrote:
There's a small race window between enabling data checksums and
creating a new database with the file_copy strategy:Create database checks for in progress data checksums before it
inserts a new row into pg_database. If the data checksum worker starts
in that window, it can miss the new database completely and skip
generating its checksums.
Thanks for the report and patch, I am currently out of the office but will check and apply on Sunday or Monday when back home.
./daniel
On 21 Jul 2026, at 20:36, Daniel Gustafsson <daniel@yesql.se>
.. will check and apply on Sunday or Monday when back home.
Unless beaten to it of course, if any other committer want to pick it up then feel free of course.
./daniel
On 21 Jul 2026, at 20:35, Daniel Gustafsson <daniel@yesql.se> wrote:
On 21 Jul 2026, at 12:55, Zsolt Parragi <zsolt.parragi@percona.com> wrote:
There's a small race window between enabling data checksums and
creating a new database with the file_copy strategy:Create database checks for in progress data checksums before it
inserts a new row into pg_database. If the data checksum worker starts
in that window, it can miss the new database completely and skip
generating its checksums.Thanks for the report and patch, I am currently out of the office but will check and apply on Sunday or Monday when back home.
I had a look at this today and came up with the attached v2. Apart from some
comment changes the main difference is that I placed the test in an already
existing testfile to reduce the number of initdb's required, and added a test
for the error message in the logfile.
--
Daniel Gustafsson
Attachments:
v2-0001-Recheck-checksum-state-before-file_copy-during-CR.patchapplication/octet-stream; name=v2-0001-Recheck-checksum-state-before-file_copy-during-CR.patch; x-unix-mode=0644Download+96-1
I had a look at this today and came up with the attached v2. Apart from some
comment changes the main difference is that I placed the test in an already
existing testfile to reduce the number of initdb's required, and added a test
for the error message in the logfile.
Looks better than my version, I always forget that I should also keep test execution time in mind.
On 27 Jul 2026, at 22:50, Zsolt Parragi <zsolt.parragi@percona.com> wrote:
I had a look at this today and came up with the attached v2. Apart from some
comment changes the main difference is that I placed the test in an already
existing testfile to reduce the number of initdb's required, and added a test
for the error message in the logfile.Looks better than my version, I always forget that I should also keep
test execution time in mind.
Pushed, along with your other patch. Thanks!
--
Daniel Gustafsson