[syslog-ng] [PATCH] afmongodb: Support system-installed libmongo-client at configure time.
Gergely Nagy
algernon at balabit.hu
Wed May 25 20:53:36 CEST 2011
Gergely Nagy <algernon at balabit.hu> writes:
> Modify configure.in to recognise a suitable version (>= 0.1.0) of the
> libmongo-client library, and use it instead of the internal version if
> requested so.
Also, please update the internal libmongo-client to v0.1.0, released a
couple of hours ago. (It is tagged v0.1.0 in the upstream git tree at
git://github.com/algernon/libmongo-client.git)
The new version is API compatible (but not ABI compatible) with the
current internal version, at least when considering the functions that
the mongodb driver uses, so no other changes are neccessary.
If the internal version needs to be statically linked by default, then a
configure.gnu file should be added, similar to how it's done with
lib/ivykis (the same file should work, actually).
Compared to the current internal version, tons of fixes and enhancements
went into the library. Though, most of those do not affect syslog-ng, as
it uses very little of the library (so far, but I have plans to add a
lot of neat stuff to the mongodb destination that depend on the new
library version).
Notable improvements that affect the current mongodb destination driver:
* IPv6 and hostname support. Previously, the library - and in turn, the
mongodb destination - only recognised dotted-decimal IPv4 addresses.
* Endianness fixes. Parts of the Mongo wire protocol were sent in host
endianness instead of little-endian (the request ID, in particular).
* Use sendmsg() to send packets over the wire, which allows us to ignore
SIGPIPE easily (and make the call return an error instead of raising a
signal) on systems where MSG_NOSIGNAL is supported.
* Faster and better memory allocations: instead of going to great
lengths to ensure that memory allocations succeed, leave it up to glib
to handle OOM cases and abort. This gets rid of a lot of if branches
on fast paths.
In certain cases, allocations were adjusted to reserve the proper
amount of memory as soon as possible, so arrays won't have to grow
later on.
* Better test suite!
68% code coverage without tests that require a working mongodb setup,
and over 95% when the full test suite is ran.
This new version has also been tested on a number of platforms
(including, but not limited to recent Linux platforms (debian stable &
unstable), FreeBSD 8, Solaris (OpenSolaris and OpenIndiana), Debian
GNU/kFreeBSD, different architectures (amd64, x86, ppc, armel)) and
the test suite passed flawlessly on all of them.
Gotchas:
* The new library requires glib 2.12+ (compared to syslog-ng's 2.10),
because of using some base64 functions introduced in that
version. Though, that's only used in an example program, so with a
little bit of hackery (disabling said program, and lowering the
requirement) this can be worked around.
--
|8]
More information about the syslog-ng
mailing list