Skip to content

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdah committed Dec 18, 2015
2 parents 2223dd6 + 3e5bc73 commit 04d9325
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release notes
=============

2.2.1
-----

**Release date** 2015-12-18

- Make sure we aren't downscaling if disabled in the config (`#279 <https://github.com/sebdah/dynamic-dynamodb/pull/279>`). Thanks for the pull request `Sazpaimon <https://github.com/Sazpaimon>`

2.2.0
-----

Expand Down
37 changes: 37 additions & 0 deletions dynamic_dynamodb/aws/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,23 @@ def update_table_provisioning(
current_reads = int(get_provisioned_table_read_units(table_name))
current_writes = int(get_provisioned_table_write_units(table_name))

# Make sure we aren't scaling down if we turned off downscaling
if (not get_table_option(key_name, 'enable_reads_down_scaling') or
not get_table_option(key_name, 'enable_writes_down_scaling')):
if (not get_table_option(key_name, 'enable_reads_down_scaling') and
current_reads > reads):
reads = current_reads
if (not get_table_option(key_name, 'enable_writes_down_scaling') and
current_writes > writes):
writes = current_writes

# Return if we do not need to scale at all
if reads == current_reads and writes == current_writes:
logger.info(
'{0} - No need to scale up reads nor writes'.format(
table_name))
return

if retry_with_only_increase:
# Ensure that we are only doing increases
if current_reads > reads:
Expand Down Expand Up @@ -424,6 +441,26 @@ def update_gsi_provisioning(
current_reads = int(get_provisioned_gsi_read_units(table_name, gsi_name))
current_writes = int(get_provisioned_gsi_write_units(table_name, gsi_name))

# Make sure we aren't scaling down if we turned off downscaling
if (not get_gsi_option(table_key, gsi_key, 'enable_reads_down_scaling') or
not get_gsi_option(
table_key, gsi_key, 'enable_writes_down_scaling')):
if (not get_gsi_option(
table_key, gsi_key, 'enable_reads_down_scaling') and
current_reads > reads):
reads = current_reads
if (not get_gsi_option(
table_key, gsi_key, 'enable_writes_down_scaling') and
current_writes > writes):
writes = current_writes

# Return if we do not need to scale at all
if reads == current_reads and writes == current_writes:
logger.info(
'{0} - No need to scale up reads nor writes'.format(
table_name))
return

if retry_with_only_increase:
# Ensure that we are only doing increases
if current_reads > reads:
Expand Down
2 changes: 1 addition & 1 deletion dynamic_dynamodb/dynamic-dynamodb.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[general]
version: 2.2.0
version: 2.2.1

0 comments on commit 04d9325

Please sign in to comment.