Skip to content

Make it possible to switch between builtin tarantool decimal support and standalone version coming with dec crate

Dmitry Rodionov requested to merge dkr/use-tnt-decnumber into master

Summary

  • Revert "feat(decimal): don't use tarantool symbols for decimal support"

This reverts commit b0bf461f.

The need for this change arised from certification. libdecnumber version from dec crate duplicates one vendored in tarantool and requires passing additional verification (svace). libdecnumber from tarantool is several times smaller due to only partial usage of libdecnumber's features (no decDouble and decQuad for example).

Moreover using one version of the library in the project reduces likelihood of breakage due to unsynchronized patches and stuff like that (not to say that libdecnumber versions are already not exactly the same due to different set of patches being applied).

  • Make it possible to choose which decimal impl to use via feature

New feature standalone_decimal introduces possibility to choose between libdecnumber vendored in tarantool and one supplied in rust dec crate.

This is only needed to avoid changes in sbroad unit tests which do not run under tarantool but need to use decimal. Sbroad doesnt use tarantool to run unit tests because there is no harness that can bridge them with cargo test. In picodata we sort of have one, so this could've solved the issue but since everything lives in different repositories it is hugely inconvenient to solve such problems now. So I see this solution as temporary one and expect that standalone_decimal feature can be entirely dropped in more or less recent future.

Whats wrong with standalone decimal? Why not use it?

The issue here is that with standalone_decimal we'd have two independent copies of libdecnumber with different set of applied patches and some number of wrappers on top of version vendored in tarantool. Keeping those in sync doesnt seem worth it and moreover version that comes with rust dec crate includes more code from original libdecnumber which causes additional errors in stat analysis we need to pass.

Note: since tarantool's decimal API is only exported in our fork it means that without standalone decimal on vanilla there wont be any decimal support.

It should be ok because motivation for standalone decimal was to use it in sbroad tests.

Ref: https://git.picodata.io/picodata/picodata/picodata/-/work_items/582

Ensure that

  • New code is covered by tests
  • API is documented
  • Changelog is up to date
  • Version is bumped in the appropriate Cargo.toml files
Edited by Dmitry Rodionov

Merge request reports