From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A2FD591571 for ; Thu, 4 Apr 2024 11:04:46 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7E9DC34D81 for ; Thu, 4 Apr 2024 11:04:16 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 4 Apr 2024 11:04:12 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 113FC42515 for ; Thu, 4 Apr 2024 11:04:12 +0200 (CEST) Message-ID: <045c938f-c18f-435c-aa58-c27cd3af65ac@proxmox.com> Date: Thu, 4 Apr 2024 11:04:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= , Proxmox Backup Server development discussion References: <20240328123707.336951-1-c.ebner@proxmox.com> <20240328123707.336951-7-c.ebner@proxmox.com> <1712136715.t3s03j6zyy.astroid@yuna.none> <1712219065.g0jbnhpieg.astroid@yuna.none> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: <1712219065.g0jbnhpieg.astroid@yuna.none> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH v3 pxar 06/58] encoder: move to stack based state tracking X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Apr 2024 09:04:46 -0000 On 4/4/24 10:48, Fabian Grünbichler wrote: > On April 3, 2024 1:01 pm, Christian Ebner wrote: >> On 4/3/24 11:54, Fabian Grünbichler wrote: >>> >>> should we still have some sort of checks here? e.g., when dropping an >>> encoder, how should self.finished and self.state look like? IIUC, then a >>> dropped encoder should have an empty state and be finished (i.e., >>> `close()` has been called on it). >>> >>> or is this simply not relevant anymore because we only create one and >>> then drop it at the end (but should we then have a similar mechanism for >>> EncoderState?) >> >> The encoder should now be consumed with the `close` call, which takes >> ownership of the encoder and drops it afterwards, so all the state >> checks should happen there. >> >> Previously, the encoder finish consumed the per-directory level encoder >> object, passing possible errors up to the parent implementation, which >> is not possible now since there is only one encoder instance. I did not >> want to panic here as the checks should be done in the close now, so the >> Drop implementation was removed. > > but now the equivalent is the EncoderState (which is per directory). > >> Not sure what to check in a Drop implementation the EncoderState. What >> did you have in mind for that? Note that errors get propagated to the >> parent state in the encoder finish calls now. > > well, basically that it is finished itself? i.e., in `finish` set a > flag, and in the Drop handler check that it is set. right now this is > the only place we `pop` the state from the state stack anyway, so it > should be okay, but who knows what future refactors bring. Okay, so will take any encoding errors stored in the state when finishing the directory in the `finish` calls and set a finished flag, and add a check in the `EncoderState`s `Drop` implementation if all the errors have been correctly passed along to the parent state (none present anymore) and the finished flag is set. Requires however to panic if that is not the case.