Skip to content

Fix bug where partial secondary index may override hash-only index

Compare
Choose a tag to compare
@darrenklein darrenklein released this 15 Jul 20:54

This patch fixes a bug related to the adapter's choice of optimal index when querying. In previous versions, a query on single indexed field could result in a query being executed against a partial secondary index, which had the potential for data to be left out of a query's return.

For example, if a user table has two indexes, first_name (a hash-only index) and first_name_last_name (a composite index), queries on the first_name field could end up using the composite index, where the hash-only index would have been sufficient. Furthermore, if the data model allowed last_name as an optional field, the incorrectly chosen query could result in missing data, as it would fail to return any records where the range key would have a nil value.

Queries should now reliably choose the optimal index.