public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>,
	"Proxmox Backup Server development discussion"
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [RFC proxmox-backup] index writers: remove dead code
Date: Thu, 30 Oct 2025 12:04:53 +0100	[thread overview]
Message-ID: <3b99c8ff-ab31-4125-a8e3-ecfdce742fe0@proxmox.com> (raw)
In-Reply-To: <1761822027.sm41v71zmk.astroid@yuna.none>

On 10/30/25 12:01 PM, Fabian Grünbichler wrote:
> On October 30, 2025 11:46 am, Christian Ebner wrote:
>> On 10/30/25 11:25 AM, Fabian Grünbichler wrote:
>>> On October 29, 2025 9:04 am, Christian Ebner wrote:
>>>> Thanks for the cleanup, two questions inline.
>>>>
>>>> On 10/27/25 2:55 PM, Fabian Grünbichler wrote:
>>>>> the current code base doesn't use the index writers for inserting chunks into a
>>>>> chunk store, and it probably shouldn't given the intricate requirements around
>>>>> interacting with S3.
>>>>>
>>>>> all of thise code seems to be dead code, remove it to make reasoning about
>>>>> chunk insertion code paths easier.
>>>>>
>>>>> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>>>>> ---
>>>>> stumbled upon this while thinking about S3 synchronization issues..
>>>>> AFAICT this is leftover from the very initial phase of PBS development
>>>>>
>>>>>     pbs-datastore/src/dynamic_index.rs | 142 -----------------------------
>>>>>     pbs-datastore/src/fixed_index.rs   |  38 --------
>>>>>     2 files changed, 180 deletions(-)
>>>>>
>>>>> diff --git a/pbs-datastore/src/dynamic_index.rs b/pbs-datastore/src/dynamic_index.rs
>>>>> index ff6c36782..624df0119 100644
>>>>> --- a/pbs-datastore/src/dynamic_index.rs
>>>>> +++ b/pbs-datastore/src/dynamic_index.rs
>>>>> @@ -16,13 +16,10 @@ use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation};
>>>>>     
>>>>>     use pbs_tools::lru_cache::LruCache;
>>>>>     
>>>>> -use crate::chunk_stat::ChunkStat;
>>>>>     use crate::chunk_store::ChunkStore;
>>>>> -use crate::data_blob::{DataBlob, DataChunkBuilder};
>>>>>     use crate::file_formats;
>>>>>     use crate::index::{ChunkReadInfo, IndexFile};
>>>>>     use crate::read_chunk::ReadChunk;
>>>>> -use crate::{Chunker, ChunkerImpl};
>>>>>     
>>>>>     /// Header format definition for dynamic index files (`.dixd`)
>>>>>     #[repr(C)]
>>>>> @@ -275,7 +272,6 @@ impl IndexFile for DynamicIndexReader {
>>>>>     
>>>>>     /// Create dynamic index files (`.dixd`)
>>>>>     pub struct DynamicIndexWriter {
>>>>> -    store: Arc<ChunkStore>,
>>>>>         writer: BufWriter<File>,
>>>>>         closed: bool,
>>>>>         filename: PathBuf,
>>>>> @@ -321,7 +317,6 @@ impl DynamicIndexWriter {
>>>>>             let csum = Some(openssl::sha::Sha256::new());
>>>>>     
>>>>>             Ok(Self {
>>>>> -            store,
>>>>
>>>> question: not sure if it is fine to drop the chunk store here? The chunk
>>>> store holds the process locker, which should outlive the writer ...
>>>
>>> technically true, but
>>>
>>> the writer can already outlive the lock, this is only protected by how
>>> we are calling things, no matter whether a reference to the chunk store
>>> is stored inside the writer or not. the actual lock guard (which
>>> releases the lock when dropped) is what counts, and that is stored in
>>> the backup writer env, not in the index writer here.. (the env also
>>> contains a reference to the chunk store via the reference to the
>>> datastore).
>>>
>>> or am I missing something?
>>
>> No, this was exactly my question here... Thanks for clarification, with
>> that information this now looks good to me.
>>
>> Consider:
>>
>> Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
> 
> I think we could consider moving the path handling outside of the writer
> to get rid of all the chunk store references here, if we wanted to?

Yeah, was pondering for a bit about that as well, but then did not 
mention it as like this it limits the creation of the index file to be 
within a valid datastore location. Which should protect against ever 
creating strange paths for index files.


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

      reply	other threads:[~2025-10-30 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 13:52 Fabian Grünbichler
2025-10-29  8:04 ` Christian Ebner
2025-10-30 10:25   ` Fabian Grünbichler
2025-10-30 10:46     ` Christian Ebner
2025-10-30 11:01       ` Fabian Grünbichler
2025-10-30 11:04         ` Christian Ebner [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=3b99c8ff-ab31-4125-a8e3-ecfdce742fe0@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=f.gruenbichler@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