hacking postgresql with · hacking postgresql with eclipse metin döşlü [email protected]...
TRANSCRIPT
![Page 2: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/2.jpg)
Motivation
2
Postgres can’t do everything
You can extend it
Eclipse makes it easy
![Page 3: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/3.jpg)
Extensions
3
postGIS - Spatial and Geographic objects
pg_cron - Run periodic jobs
hll - HyperLogLog (approximate distinct count)
citus - Scale across multiple machines
![Page 4: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/4.jpg)
Personal Story
4
Distributed PostgreSQL PostgreSQL Extension
![Page 5: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/5.jpg)
Why Eclipse?
5
Start Fast
Easy Navigation
Rich Features
![Page 6: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/6.jpg)
Demo Outline
6
PostgreSQL Inside Eclipse
Walking Around
Deep Dive
![Page 7: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/7.jpg)
Demo Outline
7
PostgreSQL Inside Eclipse
Walking Around
Deep Dive
![Page 8: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/8.jpg)
Build PostgreSQL
8
./configure CFLAGS=-"O0 -g"
make -s -j4
sudo make install
![Page 9: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/9.jpg)
Import PostgreSQL into Eclipse
9
File -> Import
C/C++ -> Existing Code as Makefile Project
Turn off scalability mode (optional)
![Page 10: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/10.jpg)
Demo Outline
10
PostgreSQL Inside Eclipse
Walking Around
Deep Dive
![Page 11: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/11.jpg)
Attach GDB
11
select pg_backend_pid();
Debug As -> Debug Configurations
C/C++ Attach to Application
![Page 12: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/12.jpg)
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...”
![Page 13: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/13.jpg)
Errors
13
errstart() in elog.c
if (elevel >= ERROR)
![Page 14: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/14.jpg)
Crashes
14
pg_crasher
![Page 15: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/15.jpg)
Demo Outline
15
PostgreSQL Inside Eclipse
Walking Around
Deep Dive
![Page 16: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/16.jpg)
Gatekeeper
16
watch
![Page 17: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/17.jpg)
Demo Outline
17
PostgreSQL Inside Eclipse
Walking Around
Deep Dive
![Page 18: Hacking PostgreSQL with · Hacking PostgreSQL with Eclipse Metin Döşlü metin@citusdata.com PGCONF.EU 2017 1](https://reader034.vdocument.in/reader034/viewer/2022042621/5f786fe1381f155605522384/html5/thumbnails/18.jpg)
Summary
18
Postgres can’t do everything
You can extend
Eclipse makes it easy