Menu

Three checks that look like they passed, but validated nothing
πŸ“°

Three checks that look like they passed, but validated nothing

DEV Community: postgresΒ·dafiliΒ·14 days ago
#5zo4BWoR
#devtopostgresql#devto#dev#exit#gzip
Reading 0:00
15s threshold

A backup job that dies halfway through a pipe can leave behind a file that reports success, passes its integrity check, and lists its contents correctly β€” while containing almost none of your data.

I did not want to take that on faith, so I killed a pg_dump on purpose and measured every check I could think of. Three of them passed. Two of those three are the ones people reach for precisely because they are supposed to catch this.

The rig

A throwaway cluster, built for the test and destroyed afterwards, so nothing touched a real database:

initdb -D /tmp/pgtest/data -U test --auth = trust -E UTF8 pg_ctl -D /tmp/pgtest/data -o "-p 55432 -k /tmp/pgtest" start

psql -d app -c "CREATE TABLE t(id serial primary key, payload text);" psql -d app -c "INSERT INTO t(payload) SELECT repeat(md5(g::text), 40) FROM generate_series(1,100000) g;"

Enter fullscreen mode

Exit fullscreen mode

That is 100,000 rows of roughly 1.3 KB of text each, dumping in about a quarter of a second.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.