Open jpountz opened 7 months ago
Pinging @elastic/es-core-infra (Team:Core/Infra)
The point of noop native access is to be an errorless fallback. But it requires consumers actually check the returned value from native access functions. It seems like the 814 codec could more aggressively check whether Zstd is null? Also note that this was an exceptional case, since zstd is available on all supported platforms, this was just a simple bug that affected x86-64.
I'm supportive of getting rid of noop native access, but I don't think we should make it some hybrid fallback, it's supposed to be noops, not errors.
I'm not a fan of doing it at the call site. There are only two call sites of ZSTD right now but we envision having more of them in the future, and in my mind ZSTD is a required dependency of Elasticsearch, not an optional dependency. So I would rather have a central place that double checks that ZSTD support is available instead of requiring all call sites to do so.
Getting rid of noop native access would work for me. I guess that another approach could consist of having a bootstrap check that makes sure that ZSTD support is available (and newBuffer
).
I'm rephrasing this issue to better align it with the problem rather than a possible solution.
A bootstrap check would be in line with other native access checks we have. We are lenient on the loading, but then fail in a bootstrap check.
Description
Because
NoopNativeAccess
returnsnull
forgetZstd
andnewBuffer
, #107289 manifested to Elasticsearch operators in a confusing way, e.g.It would have been better ifNoopNativeAccess#getZstd
andNoopNativeAccess#newBuffer
had thrown an exception with a meaningful error message.Even though it's a bug that we hit this case, as all supported platforms should have ZSTD bindings, it would be nice for this case to fail with a proper error message instead of a cryptic
NullPointerException
.A related question is whether we should delay this error until ZSTD gets used for the first time, or whether we should have more proactive checks, e.g. at node startup time.