Skip to content

Commit 68dd201

Browse files
committed
Use percent throughput as absolute rate if in On Demand mode
1 parent 45e30e1 commit 68dd201

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

config/config.properties

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Properties file for violation detection tool configuration.
22

3-
# Path of AWS credentials file. For security reason, we do not ask for
3+
# Path of AWS credentials file. For security reason, we do not ask for
44
# access key or range key directly.
55
awsCredentialsFile = ./config/credentials
66

@@ -20,7 +20,7 @@ gsiHashKeyName = gsiHashKeyName
2020
# Valid values: N, S, B
2121
gsiHashKeyType = gsiHashKeyType
2222

23-
# GSI range key name.
23+
# GSI range key name.
2424
# Use this option only if GSI range key will be checked.
2525
# Remove trailing spaces if they are not part of the name
2626
gsiRangeKeyName = gsiRangeKeyName
@@ -30,7 +30,7 @@ gsiRangeKeyName = gsiRangeKeyName
3030
# Valid values: N, S, B
3131
gsiRangeKeyType = gsiRangeKeyType
3232

33-
# 'true' to record violation details to output file. 'false' to only provide
33+
# 'true' to record violation details to output file. 'false' to only provide
3434
# the number of violations.
3535
# Valid: 'true' or 'false'.
3636
# Default value: 'true'.
@@ -42,43 +42,44 @@ recordDetails = true
4242
# Default value: 'false'
4343
recordGsiValueInViolationRecord = false
4444

45-
# Output path of detection output file. Supports both local directory
45+
# Output path of detection output file. Supports both local directory
4646
# and S3 path with filename ending with '.csv'
4747
# Example:
4848
# Local file: //local/path/myoutput.csv
4949
# S3 path: s3://bucket/myoutput.csv
5050
# Default value: ./violation_detection.csv
5151
detectionOutputPath = ./gsi_violation_check.csv
5252

53-
# Number of segments indicates the number of threads that will be created for parallel scan.
54-
# If = 1, sequential scan will be used; If > 1, parallel scan will be used.
53+
# Number of segments indicates the number of threads that will be created for parallel scan.
54+
# If = 1, sequential scan will be used; If > 1, parallel scan will be used.
5555
# Valid: 1 ~ 4096.
5656
# Default value: 1.
5757
numOfSegments = 1
5858

59-
# Number of violations to be scanned. Scan will stop when given number of
60-
# violations are found.
59+
# Number of violations to be scanned. Scan will stop when given number of
60+
# violations are found.
6161
# This is optional. Default value will be used when commented.
62-
# Default value: -1, will scan the entire table.
62+
# Default value: -1, will scan the entire table.
6363
numOfViolations = -1
6464

6565
# Number of records to be scanned. Scan will stop when given number of items
6666
# are scanned.
6767
# This is optional. Default value will be used when commented.
68-
# Default value: -1, will scan the entire table.
68+
# Default value: -1, will scan the entire table.
6969
numOfRecords = -1
7070

7171
# Percentage of provisioned read/write IOPS of the table that scan/update
7272
# (delete) operations will use during detection/correction.
7373
# This is optional. Default value will be used when commented.
74-
# Valid: 1 ~ 100, integer.
74+
# NOTE: If On Demand mode is used, then this number is taken as the IOPS rate to use.
75+
# Valid: 1 ~ 100, integer.
7576
# Default value: 25.
7677
readWriteIOPSPercent = 25
7778

7879
# Input file path for violation correction
7980
correctionInputPath = ./gsi_violation_check.csv
8081

81-
# Output file path for violation correction in update mode.
82+
# Output file path for violation correction in update mode.
8283
# It is generated only if there are update errors.
8384
# Supports both local directory and S3 path with filename ending with '.csv'.
8485
# Example:

src/main/java/com/amazonaws/services/dynamodbv2/online/index/TableHelper.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/**
3131
* Get table information.
32-
*
32+
*
3333
*/
3434
public class TableHelper {
3535

@@ -148,10 +148,12 @@ public boolean isGsiExists(String gsiName) {
148148
}
149149

150150
public long getReadCapacityUnits() {
151-
return tableDescription.getProvisionedThroughput().getReadCapacityUnits();
151+
Long readCapacityUnits = tableDescription.getProvisionedThroughput().getReadCapacityUnits();
152+
return readCapacityUnits != 0 ? readCapacityUnits : 100;
152153
}
153154

154155
public long getWriteCapacityUnits() {
155-
return tableDescription.getProvisionedThroughput().getWriteCapacityUnits();
156+
Long writeCapacityUnits = tableDescription.getProvisionedThroughput().getWriteCapacityUnits();
157+
return writeCapacityUnits != 0 ? writeCapacityUnits : 100;
156158
}
157159
}

0 commit comments

Comments
 (0)