[pbs-devel] [PATCH proxmox-backup v2 3/4] datastore: data blob: increase compression throughput

Dominik Csapak d.csapak at proxmox.com
Fri Aug 2 14:38:59 CEST 2024


On 8/2/24 13:59, Thomas Lamprecht wrote:
> On 02/08/2024 12:47, Dominik Csapak wrote:
>> sadly AFAICS this is currently not possible
>>
>> i tried this and instead of error 70 i got:
>>
>> '18446744073709551546'
>>
>> reading your [2] link, it also states:
>>
>>> *  note 1 : this API shall be used with static linking only.
>>> *           dynamic linking is not yet officially supported.
> 
> That just sounds wrong... but oh well.
>   
>> so i don't thinks this works, unless we'd link statically?
>>
> 
> I mean, the library can obviously translated the error to some meaningful
> string. I mean that could be due to relying on internal compiled stuff that
> we cannot use, but while I think that is a solid guess, I'd still evaluate
> how it actually works to be sure.
>   
>> so how do we want go forward with this?
> 
> 
> If, after checking, this really seems to be unfeasible then lets go for
> the string comparison with a TODO/FIXME comment point out why it's done
> that way and that one might want to reevaluate if still required (in the
> future)


mhmm zstd just calls this:

---
fn map_error_code(code: usize) -> io::Error {
     let msg = zstd_safe::get_error_name(code);
     io::Error::new(io::ErrorKind::Other, msg.to_string())
}
---

which calls this:

---
pub fn get_error_name(code: usize) -> &'static str {
     unsafe {
         // Safety: assumes ZSTD returns a well-formed utf8 string.
         let name = zstd_sys::ZSTD_getErrorName(code);
         c_char_to_str(name)
     }
}
---

which is part of the zstd api and at the end it maps the error code like this:

---
ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; 
return (ERR_enum) (0-code); }
---

with that result, it maps the code to a string...

which matches what i get, since

2^64 - 70 = 18446744073709551546 [0]


but, i'm really not sure if we could rely in that since the function is in a 'error_private.c' which 
seems to me like it's an implementation detail only?


0: https://www.wolframalpha.com/input?i=2%5E64+-+70




More information about the pbs-devel mailing list