public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Hannes Laimer" <h.laimer@proxmox.com>
To: "Proxmox Backup Server development discussion"
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] datastore: remove datastore from internal cache based on maintenance mode
Date: Fri, 01 Mar 2024 11:43:24 +0100	[thread overview]
Message-ID: <CZICNZXYAZPE.3RIRCIN2D1GAD@dev> (raw)
In-Reply-To: <CZHQC54Z023V.3EGPI7YN8JAQG@proxmox.com>

Thanks for the review, will send a v2

On Thu Feb 29, 2024 at 6:13 PM CET, Gabriel Goller wrote:
> Tested this thoroughly and it works as advertised!
>
> Just some small nits inline:
>
> >  impl MaintenanceMode {
> > +    /// Used for deciding weather the datastore is cleared from the internal cache after the last
>
> Small typo: weather -> whether
>
> > +            // remove datastore from cache iff last task finished
> > +            // and datastore is in a maintenance mode that says it should be
>
> Did something get cut off here? The sentence doesn't sound correct...
>

I see where you're coming from, if the maintanance mode says it should
be clear from cache, since the maintenance mode defines weather it
should be or not. But I'll phrase this better

> > +            let remove_from_cache = last_task
> > +                && pbs_config::datastore::config()
> > +                    .and_then(|(s, _)| s.lookup::<DataStoreConfig>("datastore", &self.name()))
>
> `self.name()` is enough here, we don't need `&self.name()`
>
> > +    pub fn update_datastore_cache() -> Result<(), Error> {
> > +        let (config, _digest) = pbs_config::datastore::config()?;
> > +        for (store, (_, _)) in &config.sections {
> > +            let datastore: DataStoreConfig = config.lookup("datastore", &store)?;
>
> `store` is already a &String, we don't need to write `&store`
>
> > +            if datastore
> > +                .get_maintenance_mode()
> > +                .map_or(false, |m| m.clear_from_cache())
> > +            {
> > +                let _ = DataStore::lookup_datastore(&store, Some(Operation::Lookup));
>
> Same here
>
> >                              match operation {
> >                                  Operation::Read => task.active_operations.read += count,
> >                                  Operation::Write => task.active_operations.write += count,
> >                                  Operation::Lookup => (), // no IO must happen there
> >                              };
> > +                            updated_active_operations = task.active_operations.clone();
>
> You can remove the `.clone()` call here
>
>
> Consider:
>
> Tested-by: Gabriel Goller <g.goller@proxmox.com>
> Reviewed-by: Gabriel Goller <g.goller@proxmox.com>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel





      reply	other threads:[~2024-03-01 10:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 10:33 Hannes Laimer
2024-02-29 17:13 ` Gabriel Goller
2024-03-01 10:43   ` Hannes Laimer [this message]

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=CZICNZXYAZPE.3RIRCIN2D1GAD@dev \
    --to=h.laimer@proxmox.com \
    --cc=pbs-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal