According to DynamoDB API, we expect that every index in table should have unique key schema. However now we can create table with indexes with the same schema:
2014-04-17 10:58:32,967 Request: POST http://127.0.0.1:8480/v1/default_tenant/data/tables
2014-04-17 10:58:32,967 Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2014-04-17 10:58:32,967 Request Body: {"local_secondary_indexes": [{"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "attr_name"}], "index_name": "index_name1", "projection": {"projection_type": "ALL"}}, {"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "attr_name"}], "index_name": "index_name2", "projection": {"projection_type": "ALL"}}], "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "subject"}], "table_name": "testtempest327066401", "attribute_definitions": [{"attribute_type": "S", "attribute_name": "forum"}, {"attribute_type": "S", "attribute_name": "subject"}, {"attribute_type": "S", "attribute_name": "attr_name"}]}
2014-04-17 10:58:33,970 Response Status: 200
2014-04-17 10:58:33,970 Response Headers: {'date': 'Thu, 17 Apr 2014 10:58:33 GMT', 'content-length': '1168', 'content-type': 'application/json'}
2014-04-17 10:58:33,971 Response Body: {"table_description": {"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "subject"}], "creation_date_time": 0, "links": [{"href": "http://127.0.0.1:8480/v1/default_tenant/data/tables/testtempest327066401", "rel": "self"}, {"href": "http://127.0.0.1:8480/v1/default_tenant/data/tables/testtempest327066401", "rel": "bookmark"}], "local_secondary_indexes": [{"index_size_bytes": 0, "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "attr_name"}], "index_name": "index_name1", "projection": {"projection_type": "ALL"}, "item_count": 0}, {"index_size_bytes": 0, "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "attr_name"}], "index_name": "index_name2", "projection": {"projection_type": "ALL"}, "item_count": 0}], "table_name": "testtempest327066401", "table_size_bytes": 0, "table_status": "ACTIVE", "attribute_definitions": [{"attribute_type": "S", "attribute_name": "attr_name"}, {"attribute_type": "S", "attribute_name": "forum"}, {"attribute_type": "S", "attribute_name": "subject"}], "item_count": 0}}
Reviewed: https:/ /review. openstack. org/149600 /git.openstack. org/cgit/ stackforge/ magnetodb/ commit/ ?id=9bc0bcabfdf 31c772fb9fc8197 8ae97f3d03b9d9
Committed: https:/
Submitter: Jenkins
Branch: master
commit 9bc0bcabfdf31c7 72fb9fc81978ae9 7f3d03b9d9
Author: Vivek Dhayaal <email address hidden>
Date: Fri Jan 23 17:21:12 2015 +0530
Fix key schema validation for table and LSIs
Table and its indices must have unique key schema
Closes-Bug: 1308964 a342b982b28d8e2 1c7bdd10c88
Change-Id: Ib5f25f183881b9