Hello Luca,
I had some success getting PostgreSQL 9.4 to build on FreeBSD 10.1-p2
RELEASE with DTrace. The probes look fully functional, and fun to work
with, though I haven't had time to get incredibly deep into using
them.This is what worked for me, after much digging around.
I was building and running PostgreSQL and dtrace directly on my
workstation, not in a jail. I'm not sure what additional hoops would
need to hopped through off-hand to run dtrace on FreeBSD in a jail.
Initially, I got compile errors, but I tracked those down and realized
that I needed to load the dtrace kernel modules, which I had expected to
be loaded automatically, but weren't. Otherwise, you get cryptic compile
errors.
I had to load the dtrace kernel modules with:
kldload dtraceall (and enable it in /boot/loader.conf with
dtraceall_load="YES", if you want it to hang around)
Add the following lines to your /etc/make.conf (because detailed
backtraces are helpful)
STRIP=
CFLAGS+=-fno-omit-frame-pointer
Once that's loaded, change the permissions to 0666 on /dev/dtrace/helper
(and add that to /etc/devfs.conf with "perm /dev/dtrace/helper 0666" if
you want it to persist)
Though be aware that there are security implications for that, since
other users could make a ton of probes and exhaust kernel memory.
Alternately, you could add pgsql to wheel, since root and wheel are the
owner and group for that devfs node.
Also be sure to not use devel/libelf from ports, because that doesn't
seem to play nice with dtrace, and keeps probes from registering.
After doing all that, I could get dtrace to build, link, and register
userland probes with the database/postgresql94-server and
database/postgresql94-client, and successfully count transaction times
in a dtrace script.
One final note, the freebsd-dtrace@xxxxxxxxxxx list, is very helpful
with esoteric DTrace issues.
I hope this all helps. =)
Regards,
Lacey
On Tue, Dec 16, 2014 at 4:06 PM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
If you want to push on this I think you'll need to find a BSD dtrace
expert. You shouldn't need to show him/her much except the above
dtrace invocation and the probes.d file.
I've filled a bug report and I'll report back here if I get any update
on the matter.
In the meantime I've tried 9.4 beta and the same issue arises.
Luca
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general