On Wed, 13 Jan 2021 at 13:18, Wang Yngwie <[email protected]> wrote:

> I have a big targets file, it's about 8M size and there are more than
> twenty thousand targetgroups. When Prometheus scans  sd_files, my updating
> program might writing that file simultaneously. In that case, the Discovery
> process may read part of the file or encounter an error. Is it possible and
> should I lock the targets file while updating it?


Don't try locking, instead build up the new file in a temporary file and
then rename() when you're done.

-- 
Brian Brazil
www.robustperception.io

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAHJKeLonkS4xQFzkAuqQ2UwPTq4-UaYqkZJTi85r%3DqEykBEJaA%40mail.gmail.com.

Reply via email to