mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 09:00:35 +00:00
The purpose of an LSI (local secondary index) in Alternator is to allow a different sort key for the existing partitions, keeping the same division into partititions. So it doesn't make sense to create an LSI on a table that did not originally have a sort key (i.e., single-item partitions). DynamoDB indeed doesn't allow this case, and Alternator forgot to forbid it - so this patch adds the missing check to the CreateTable operation. This patch also adds a test case for this, test_lsi_wrong_no_sort_key, which failed before the patch and passes after it (and also passes on DynamoDB). Also, the existing test_lsi_wrong tests for bad LSI creation attempts by mistake used a base table without a sort key - so while they encountered an error as expected, it was not the right error! So we fix that test (and split it into two tests), adding the missing sort key and exposing the actual errors that the tests were meant to expose. That test passed before this patch and also afterwards - but at least after the patch it is actually testing what it was meant to be testing. Fixes #9018. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20210713123747.1012954-1-nyh@scylladb.com>
198 KiB
198 KiB