Re: new heapcheck contrib module
Robert Haas <robertmhaas@gmail.com>
On Tue, May 12, 2020 at 11:06 PM Peter Geoghegan <pg@bowt.ie> wrote: > try/catch seems like the way to do it. Not all amcheck errors come > from amcheck -- some are things that the backend code does, that are > known to appear in amcheck from time to time. I'm thinking in > particular of the > table_index_build_scan()/heapam_index_build_range_scan() errors, as > well as the errors from _bt_checkpage(). That would require the use of a subtransaction. > You've quasi-duplicated some sensitive code to do that much, which > seems excessive. But it's also not enough. I think this is a good summary of the problems in this area. On the one hand, I think it's hideous that we sanity check user input to death, but blindly trust the bytes on disk to the point of seg faulting if they're wrong. The idea that int4 + int4 has to have overflow checking because otherwise a user might be sad when they get a negative result from adding two negative numbers, while at the same time supposing that the same user will be unwilling to accept the performance hit to avoid crashing if they have a bad tuple, is quite suspect in my mind. The overflow checking is also expensive, but we do it because it's the right thing to do, and then we try to minimize the overhead. It is unclear to me why we shouldn't also take that approach with bytes that come from disk. In particular, using Assert() checks for such things instead of elog() is basically Assert(there is no such thing as a corrupted database). On the other hand, that problem is clearly way above this patch's pay grade. There's a lot of stuff all over the code base that would have to be changed to fix it. It can't be done as an incidental thing as part of this patch or any other. It's a massive effort unto itself. We need to somehow draw a clean line between what this patch does and what it does not do, such that the scope of this patch remains something achievable. Otherwise, we'll end up with nothing. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Add pg_amcheck, a CLI for contrib/amcheck.
- 9706092839db 14.0 landed
-
Refactor and generalize the ParallelSlot machinery.
- f71519e545a3 14.0 landed
-
Generalize parallel slot result handling.
- 418611c84d00 14.0 landed
-
Move some code from src/bin/scripts to src/fe_utils to permit reuse.
- e955bd4b6c2b 14.0 landed
-
Factor pattern-construction logic out of processSQLNamePattern.
- 2c8726c4b0a4 14.0 landed
-
Doc: clean up verify_heapam() documentation.
- 4c49d8fc15ee 14.0 landed
-
Fix more portability issues in new amcheck code.
- 321633e17b07 14.0 landed
-
Fix portability issues in new amcheck test.
- 860593ec3bd1 14.0 landed
-
Try to avoid a compiler warning about using fxid uninitialized.
- 8bb0c9770e80 14.0 landed
-
Extend amcheck to check heap pages.
- 866e24d47db1 14.0 landed
-
Adjust walsender usage of xlogreader, simplify APIs
- 850196b610d2 13.0 cited
-
Improve checking of child pages in contrib/amcheck.
- d114cc538715 13.0 cited
-
Sanitize line pointers within contrib/amcheck.
- a9ce839a3137 12.0 cited
-
Fix possible sorting error when aborting use of abbreviated keys.
- 008c4135ccf6 10.0 cited