Skip to content

ZeroDivisionError if an on-demand table is picked up by table regex configuration #342

@dtrsan

Description

@dtrsan

It looks like on-demand tables have ProvisionedThroughputs always set to 0. If your table regex accidentally picks up on-demand table, Dynamic DynamoDB will throw ZeroDivisionError exceptions.

It blows up here after get_provisioned_table_read_units returns 0. It could happen for write units too and probably for GSI r/w units too.

dynamic-dynamodb - ERROR - float division by zero
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/dynamic_dynamodb/__init__.py", line 101, in main
execute()
File "/usr/lib/python2.7/site-packages/dynamic_dynamodb/__init__.py", line 134, in execute
table_num_consec_write_checks)
File "/usr/lib/python2.7/site-packages/dynamic_dynamodb/core/table.py", line 37, in ensure_provisioning
__ensure_provisioning_alarm(table_name, key_name)
File "/usr/lib/python2.7/site-packages/dynamic_dynamodb/core/table.py", line 961, in __ensure_provisioning_alarm
table_name, lookback_window_start, lookback_period)
File "/usr/lib/python2.7/site-packages/dynamic_dynamodb/statistics/table.py", line 49, in get_consumed_read_units_percent
float(table_read_units) * 100)
ZeroDivisionError: float division by zero

Maybe just to ignore on-demand tables and log a warning that a table is ignored instead of throwing ZeroDivisionError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions