[rrd-developers] [PATCH] Avoid unnecessary string handling for UPDATE commands.

Tobias Oetiker tobi at oetiker.ch
Wed Oct 28 06:18:19 CET 2009


Hi Kevin,

Today kevin brintnall wrote:

>  - only copy as many bytes as necessary
>  - during journal replay, avoid unnecessary copy (string is discarded)
>
> Thank you Thorsten von Eicken <tve at rightscale.com>

you di have perfect timing :-) so it will be an 1.4.1 announement today. But I
guess the performance impact is well worth it. Thank you!

cheers
tobi


> ---
>  src/rrd_daemon.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
> index 0ca1818..1946003 100644
> --- a/src/rrd_daemon.c
> +++ b/src/rrd_daemon.c
> @@ -1312,7 +1312,8 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */
>    cache_item_t *ci;
>
>    /* save it for the journal later */
> -  strncpy(orig_buf, buffer, sizeof(orig_buf)-1);
> +  if (sock != NULL)
> +    strncpy(orig_buf, buffer, buffer_size);
>
>    status = buffer_get_field (&buffer, &buffer_size, &file);
>    if (status != 0)
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list