summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 814f21f)
raw | patch | inline | side by side (parent: 814f21f)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Fri, 16 Sep 2016 02:58:44 +0000 (08:58 +0600) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Fri, 16 Sep 2016 04:46:26 +0000 (10:46 +0600) |
src/collectd-perl.pod | patch | blob | history | |
src/perl.c | patch | blob | history |
diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod
index f1913b8e908742dddc3a805a951aef8a05d39f6d..9af3c0c9af759f4c76d3dc410c21b83799b90b69 100644 (file)
--- a/src/collectd-perl.pod
+++ b/src/collectd-perl.pod
command line option or B<use lib Dir> in the source code. Please note that it
only has effect on plugins loaded after this option.
+=item B<RegisterLegacyFlush> I<true|false>
+
+The C<Perl plugin> used to register one flush callback (called B<"perl">) and
+call all Perl-based flush handlers when this callback was called. Newer versions
+of the plugin wrap the Perl flush handlers and register them directly with the
+daemon I<in addition> to the legacy B<"perl"> callback. This allows to call
+specific Perl flush handlers, but has the downside that flushing I<all> plugins
+now calls the Perl flush handlers twice (once directly and once via the legacy
+callback). Unfortunately, removing the B<"perl"> callback would break backwards
+compatibility.
+
+This option allows you to disable the legacy B<"perl"> flush callback if you care
+about the double call and don't call the B<"perl"> callback in your setup.
+
=back
=head1 WRITING YOUR OWN PLUGINS
diff --git a/src/perl.c b/src/perl.c
index 3f430bd1a941a33189f1bdec746dfc8d81b41760..4a11d6c127c505c2e4b9852aed2f31baac05cc3c 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
* private variables
*/
-static int flush_callback_registered = 0;
+static _Bool register_legacy_flush = 1;
/* if perl_threads != NULL perl_threads->head must
* point to the "base" thread */
@@ -1699,8 +1699,8 @@ static void _plugin_register_generic_userdata (pTHX, int type, const char *desc)
ret = plugin_register_notification(pluginname, perl_notify, &userdata);
}
else if (PLUGIN_FLUSH == type) {
- if (0 == flush_callback_registered) { /* For collectd-5.6 only, #1731 */
- flush_callback_registered++;
+ if (1 == register_legacy_flush) { /* For collectd-5.7 only, #1731 */
+ register_legacy_flush = 0;
ret = plugin_register_flush("perl", perl_flush, /* user_data = */ NULL);
}
current_status = perl_config_includedir (aTHX_ c);
else if (0 == strcasecmp (c->key, "Plugin"))
current_status = perl_config_plugin (aTHX_ c);
- else if (0 == strcasecmp (c->key, "DisableOldFlush"))
- flush_callback_registered++;
+ else if (0 == strcasecmp (c->key, "RegisterLegacyFlush"))
+ cf_util_get_boolean (c, ®ister_legacy_flush);
else
{
log_warn ("Ignoring unknown config key \"%s\".", c->key);