tarantool / vshard

The new generation of sharding based on virtual buckets
Other
98 stars 29 forks source link

Expose current `identification_mode` #460

Closed DifferentialOrange closed 3 months ago

DifferentialOrange commented 6 months ago

https://github.com/tarantool/vshard/issues/426 had introduced two vshard.storage.info() modes: with names as map keys and with uuids as map keys. There are some cases when .info() is processed automatically (for example, in tarantool/crud). To support new info layout in these cases, we need to know current identification_mode. And now there is no public API to discover it.

Several workarounds are available.

  1. Do not use keys at all, iterate through map and compare instance/replicaset .uuid/.name fields to search.
  2. Try to guess current mode by substituting both instance/replicaset uuid and name.
  3. Use private vshard.storage.internal.current_cfg variable to extract current configuration.

The first one is both non-optimal and inconvenient, the second uses some questionable assumptions (for example, what we should do if we had found both?), the third one may easily break since it is non-public API.