mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-26 11:30:36 +00:00
Add missing validation of the AttributeDefinitions parameter of the CreateTable operation in Alternator. This validation isn't needed for correctness or safety - the invalid entries would have been ignored anyway. But this patch is useful for user-experience - the user should be notified when the request is malformed instead of ignoring the error. The fix itself is simple (a new validate_attribute_definitions() function, calling it in the right place), but much of the contents of this patch is a fairly large set of tests covering all the interesting cases of how AttributeDefinitions can be broken. Particularly interesting is the case where the same AttributeName appears more than once, e.g., attempting to give two different types to the same key attribute - which is not allowed. One of the new tests remains xfail even after this patch - it checks the case that a user attempts to add a GSI to an existing table where another GSI defined the key's type differently. This test can't succeed until we allow adding GSIs to existing tables (Refs #11567). Fixes #13870. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #14556