Quality Assurance in PostgreSQL Anastasia Lubennikova Aleksander Alekseev
Agenda ● Development ● Testing ● Benchmarking ● Tools ● Other Topics
What is PostgreSQL? ● Open source object-relational database system ● Over 20 years of development ● Hundreds of developers around the world ● Several major vendors
What’s so Special About PostgreSQL? ● Pure C ● Complicated project ● Cross-platform (Windows, Linux, MacOS, Solaris, *BSD, AIX, HP-UX, ...) ● High code quality ● Great documentation ● Major releases every year
Development Process ● Git, C, Autotools, Perl ● Mailing Lists ○ pgsql-hackers@ ○ pgsql-committers@ ○ pgsql-bugs@ ○ etc ● Conferences ○ pgcon.org ○ pgconf.us ○ pgconf.ru ○ … and many more!
Yes, Mailing Lists
Submitting a Patch ● Optional: Proposal and discussion ● Optional: PoC ● Patch is added to commitfest ● While(not ready): ○ Code review ○ Testing ○ Discussion ○ More discussion ○ Rewrite a patch ● Either: ○ Patch is accepted ○ Patch is moved to the next commitfest ○ Patch is returned with a feedback
What to test? ● Modular* tests ○ Indexes ○ Replication ○ Types ○ WAL / Recovery ● Integration/system tests ○ How various features work together? ○ Upgrade, Backup/Restore, etc ● Performance ○ Previous versions ○ Other implementations ● Documentation (SGML) ● Alpha and beta tests
How to test? ● Code review ● Regular SQL input / output tests ○ Can’t test utilities, concurrency, etc.. ○ Must be deterministic ● TAP/Perl tests ○ SSL ○ Replication and recovery ● pgTAP framework ● Testgres - python framework
SQL tests ● Can only test SQL-level stuff ● Must be deterministic ● Should be executed to see the exact output
Benchmarks ● Industry standard benchmarks ○ TPC-H ○ TPC-E ○ TPC-B ● Pgbench
Basic Tools ● gcc / clang / ... ● gdb / lldb ● vim + :set spell spelllang=en_us,ru_ru ● Asserts ● wal_consistency_checking = 'all' ● log_level = DEBUG ● amcheck (property based tests) ● sqlsmith (fuzzing) ● valgrind
Perf: perf top
Perf: flamegraphs
HeapTrack + Massif Visualizer
lcov [ 1 / 2]
lcov [ 2 / 2 ]
Clang Static Analyzer
Books
Links ● https://www.postgresql.org/ ● http://postgres-edu.blogspot.ru/search/label/Hacking%20PostgreSQL ● https://github.com/afiskon/pgscripts ● https://habr.ru/p/308442/ + related articles
Thank you for your attention! ● https://postgrespro.com/ (We are hiring! ;) ● a.lubennikova@postgrespro.ru ● a.alekseev@postgrespro.ru

Quality Assurance in PostgreSQL

  • 1.
    Quality Assurance in PostgreSQL AnastasiaLubennikova Aleksander Alekseev
  • 2.
    Agenda ● Development ● Testing ●Benchmarking ● Tools ● Other Topics
  • 3.
    What is PostgreSQL? ●Open source object-relational database system ● Over 20 years of development ● Hundreds of developers around the world ● Several major vendors
  • 5.
    What’s so SpecialAbout PostgreSQL? ● Pure C ● Complicated project ● Cross-platform (Windows, Linux, MacOS, Solaris, *BSD, AIX, HP-UX, ...) ● High code quality ● Great documentation ● Major releases every year
  • 6.
    Development Process ● Git,C, Autotools, Perl ● Mailing Lists ○ pgsql-hackers@ ○ pgsql-committers@ ○ pgsql-bugs@ ○ etc ● Conferences ○ pgcon.org ○ pgconf.us ○ pgconf.ru ○ … and many more!
  • 7.
  • 11.
    Submitting a Patch ●Optional: Proposal and discussion ● Optional: PoC ● Patch is added to commitfest ● While(not ready): ○ Code review ○ Testing ○ Discussion ○ More discussion ○ Rewrite a patch ● Either: ○ Patch is accepted ○ Patch is moved to the next commitfest ○ Patch is returned with a feedback
  • 13.
    What to test? ●Modular* tests ○ Indexes ○ Replication ○ Types ○ WAL / Recovery ● Integration/system tests ○ How various features work together? ○ Upgrade, Backup/Restore, etc ● Performance ○ Previous versions ○ Other implementations ● Documentation (SGML) ● Alpha and beta tests
  • 14.
    How to test? ●Code review ● Regular SQL input / output tests ○ Can’t test utilities, concurrency, etc.. ○ Must be deterministic ● TAP/Perl tests ○ SSL ○ Replication and recovery ● pgTAP framework ● Testgres - python framework
  • 15.
    SQL tests ● Canonly test SQL-level stuff ● Must be deterministic ● Should be executed to see the exact output
  • 16.
    Benchmarks ● Industry standardbenchmarks ○ TPC-H ○ TPC-E ○ TPC-B ● Pgbench
  • 17.
    Basic Tools ● gcc/ clang / ... ● gdb / lldb ● vim + :set spell spelllang=en_us,ru_ru ● Asserts ● wal_consistency_checking = 'all' ● log_level = DEBUG ● amcheck (property based tests) ● sqlsmith (fuzzing) ● valgrind
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
    lcov [ 2/ 2 ]
  • 23.
  • 24.
  • 25.
    Links ● https://www.postgresql.org/ ● http://postgres-edu.blogspot.ru/search/label/Hacking%20PostgreSQL ●https://github.com/afiskon/pgscripts ● https://habr.ru/p/308442/ + related articles
  • 26.
    Thank you foryour attention! ● https://postgrespro.com/ (We are hiring! ;) ● a.lubennikova@postgrespro.ru ● a.alekseev@postgrespro.ru