-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for vitess' hashing algorithm #20971
Comments
I have prepared a set of POC/Draft PRs implementing this feature. Please take a look. In order PRs need to be merged: |
there are lots of vindexes defined in Vitess, see Predefined Vindexes. Should we support all of them? |
@zz-jason The most important ones are "Functional Unique" vindex types, as those can be used as primary vindexes. From what I see, most of them are already supported in one way or another in TiDB:
|
seems the following is also a workaround instead of introducing a vitess specific function:
|
The hash vindex is generally the one used to assign shards to rows. Other vindexes are for global indexes ("lookup vindexes") and geo partitioning and other things. We don't need to support those. |
I would be very wary of supporting DES. It is officially retired https://www.cryptomathic.com/news-events/blog/3des-is-officially-being-retired and is being removed from MySQL. |
Since there isn’t a perfect solution to this case, supporting a |
We'll take a look shortly. |
Feature Request
Is your feature request related to a problem? Please describe:
As a part of the migration from Vitess to TiDB we need to have a safe way to replicate the changes across two databases and safely go back in case of a disaster. For this process to work and be scalable, it is imperative to be able to efficiently calculate which shard on Vitess' side the data belongs into - so that we can synchronize the data and/or move it back.
Vitess shards data explicitly - provided a column it's value is transformed (using different hashing algorithms), and the hashed value is used to determine which shard to put data into. One of the algorithms for hashing, that Vitess names simply "hash", is uses DES encryption in ECB mode (no iv) with a null-key.
Describe the feature you'd like:
A function in TiDB that is able to replicate described above vitess hashing algorithm:
vitess_hash(int|number|string): string
.Describe alternatives you've considered:
des_encrypt
function instead. However, mysql does not support ECB mode, therefore the syntax and/or behaviour of thisdes_encrypt
would be different from what is in MySQL specification. Given that DES in general is deprecated - there's no reason to overcomplicate this, and we would rather implement a vitess-specific function instead.Teachability, Documentation, Adoption, Migration Strategy:
Any company that decides to do a live or semi-live migration from Vitess to TiDB (or vice-versa) would find this function extremely useful.
The text was updated successfully, but these errors were encountered: