Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Hacking PostgreSQL with Eclipse | PGConf EU 2017 | Metin Doslu

804 views

Published on

Hacking PostgreSQL, writing patches or creating extensions, might seem intimidating at first. The PostgreSQL codebase is huge and ever-evolving. In this talk, I will show how Eclipse, with the help of gdb, can make it a lot more accessible.

In this interactive talk, we will add the PostgreSQL project and set up gdb inside Eclipse. Then, we will walk step through the code using the debugger to reveal some of PostgreSQL internal data structures. We will show how to see the call stacks of errors and crashes, which saves a lot of headaches during development. Finally, we will show how to add a user-defined function that's written in C.

At the end of the talk, the audience will be more familiar with a simple but powerful environment to hack PostgreSQL.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Hacking PostgreSQL with Eclipse | PGConf EU 2017 | Metin Doslu

  1. 1. Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1
  2. 2. Motivation 2 Postgres can’t do everything You can extend it Eclipse makes it easy
  3. 3. Extensions 3 postGIS - Spatial and Geographic objects pg_cron - Run periodic jobs hll - HyperLogLog (approximate distinct count) citus - Scale across multiple machines
  4. 4. Personal Story 4 Distributed PostgreSQL PostgreSQL Extension
  5. 5. Why Eclipse? 5 Start Fast Easy Navigation Rich Features
  6. 6. Demo Outline 6 PostgreSQL Inside Eclipse Walking Around Deep Dive
  7. 7. Demo Outline 7 PostgreSQL Inside Eclipse Walking Around Deep Dive
  8. 8. Build PostgreSQL 8 ./configure CFLAGS=-"O0 -g" make -s -j4 sudo make install
  9. 9. Import PostgreSQL into Eclipse 9 File -> Import C/C++ -> Existing Code as Makefile Project Turn off scalability mode (optional)
  10. 10. Demo Outline 10 PostgreSQL Inside Eclipse Walking Around Deep Dive
  11. 11. Attach GDB 11 select pg_backend_pid(); Debug As -> Debug Configurations C/C++ Attach to Application
  12. 12. PostgreSQL Data Structures 12 Variables window p pprint(parse) printf "%s", pretty_format_node_dump(nodeToString(parse)) Preferences -> C/C++ -> Debug -> GDB -> Check “Show the GDB traces...”
  13. 13. Errors 13 errstart() in elog.c if (elevel >= ERROR)
  14. 14. Crashes 14 pg_crasher
  15. 15. Demo Outline 15 PostgreSQL Inside Eclipse Walking Around Deep Dive
  16. 16. Gatekeeper 16 watch
  17. 17. Demo Outline 17 PostgreSQL Inside Eclipse Walking Around Deep Dive
  18. 18. Summary 18 Postgres can’t do everything You can extend Eclipse makes it easy
  19. 19. Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 19

×