From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH cluster/qemu-server/container 1/1] add purge_rrd_data sub
Date: Wed, 13 Nov 2024 14:18:51 +0100 [thread overview]
Message-ID: <1731503012.c1v1nlc32y.astroid@yuna.none> (raw)
In-Reply-To: <20241104183225.1192830-3-me@bennetgallein.de>
On November 4, 2024 7:32 pm, Bennet Gallein wrote:
> Signed-off-by: Bennet Gallein <me@bennetgallein.de>
> ---
> src/PVE/RRD.pm | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/src/PVE/RRD.pm b/src/PVE/RRD.pm
> index 5d4abc9..636226c 100644
> --- a/src/PVE/RRD.pm
> +++ b/src/PVE/RRD.pm
> @@ -6,6 +6,26 @@ use RRDs;
>
> use PVE::Tools;
>
> +sub purge_rrd_data {
> + my ($rrdname) = @_;
> +
> + my $rrddir = "/var/lib/rrdcached/db";
> +
> + my $rrd = "$rrddir/$rrdname";
> +
> + my @args = ();
> + my $socket = "/var/run/rrdcached.sock";
> + push @args, "--daemon" => "unix:$socket" if -S $socket;
> +
> + # flush cached RRDs
> + RRDs::flushcached($rrd, @args);
isn't this racy - if another RRD update happens between this
> +
> + my $err = RRDs::error;
> + die "RRD error flushing pre-purge: $err\n" if $err;
> +
> + unlink($rrd) or die("ERROR deleting RRD file");
and this?
I think this would need to be broadcasted as well (and handled in
pmxcfs? that would also allow discarding broadcasts with earlier
timestamps), else RRD data on other nodes in a cluster is still around
(see PVE/Service/pvestatd.pm in pve-manager , and src/pmxcfs/status.c
here in pve-cluster)..
> +}
> +
> sub create_rrd_data {
> my ($rrdname, $timeframe, $cf) = @_;
>
> --
> 2.39.5
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-11-13 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 18:32 [pve-devel] [PATCH cluster/qemu-server/container 0/1] fix: #5266 - RRD cleanup when pruning Bennet Gallein
2024-11-04 18:32 ` [pve-devel] [PATCH cluster/qemu-server/container 1/1] add prune_rrd_data to destroy with purge Bennet Gallein
2024-11-04 18:32 ` [pve-devel] [PATCH cluster/qemu-server/container 1/1] add purge_rrd_data sub Bennet Gallein
2024-11-13 13:18 ` Fabian Grünbichler [this message]
2024-11-04 18:32 ` [pve-devel] [PATCH cluster/qemu-server/container 1/1] integrate prune_rrd_data function to destroy with prune Bennet Gallein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1731503012.c1v1nlc32y.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox