Skip to content

Alternator Streams: changing an existing stream's StreamViewType should be forbidden #6939

@nyh

Description

@nyh

The DynamoDB documentation https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html states that it may be used to "Enable or disable DynamoDB Streams on the table.". It doesn't say that it allows to change the parameters (namely StreamViewType - one of KEYS_ONLY, OLD_IMAGE, NEW_IMAGE or OLD_AND_NEW_IMAGES) on an already enabled stream. In fact, a simple test can confirm that doing this is not allowed:

# Test that it is, sadly, not allowed to use UpdateTable on a table which
# already has a stream enabled to change that stream's StreamViewType.
def test_streams_change_type(test_table_ss_keys_only):
    table, arn = test_table_ss_keys_only
    with pytest.raises(ClientError, match='ValidationException.*already'):
        table.update(StreamSpecification={'StreamEnabled': True, 'StreamViewType': 'OLD_IMAGE'});

See test_streams.py::test_streams_change_type

The error returned when trying to change the StreamViewType in this manner is a ValidationException: "Table already has an enabled stream: TableName: alternator_Test_1595928915636".

Currently Alternator allows such a change (and presumably, though I didn't test, performs it correctly). We can add a extra check to ensure that it doesn't.

This is a very low priority issue, because there is no real harm in supporting something extra, which DynamoDB doesn't support. The only problem we may have is if users come to rely on this feature and we will want to drop it in the future.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions