Skip to content

Increase write capacity with --overwrite #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/dynamo-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ DynamoRestore.prototype._checkTableExists = function(error, data) {
// Table exists, should we overwrite it??
if (this.options.overwrite) {
this.emit('warning', util.format('WARN: table [%s] will be overwritten.', this.options.table));
params = {
TableName: this.options.table,
ProvisionedThroughput: {
ReadCapacityUnits: this.options.readcapacity,
WriteCapacityUnits: this.options.concurrency
}
};
dynamodb.updateTable(params, (function(error, data) {
if (error || !data) {
return this.emit('error', 'Fatal Error. Failed to update table. ' + error);
}
}).bind(this));
setTimeout(dynamodb.describeTable.bind(dynamodb, { TableName: this.options.table }, this._checkTableReady.bind(this)), 1000);
Copy link
Contributor

@sdesalas sdesalas Apr 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I would have moved the dynamodb.describeTable() call inside .updateTable() callback but it should work the same either way. 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it's working, would also work the same way. Do you want me to change?

Copy link
Contributor

@sdesalas sdesalas Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I think its fine dude. All good. 👍

Only downer might be that the repo owner has somehow lost access, and I dont have write access to merge these changes myself.

} else {
this.emit('error', 'Fatal Error. The destination table already exists! Exiting process..');
Expand Down Expand Up @@ -307,7 +319,7 @@ DynamoRestore.prototype._sendBatch = function() {
this.emit('warning', 'Failed to upload same batch too many times, removing from queue.. \n' + JSON.stringify(batch));
}
} else {
this.emit('warning', 'Error processing batch, putting back in the queue.');
this.emit('warning', 'Error processing batch, putting back in the queue: ' + error);
batch.attempts++;
this.batches.push(batch);
}
Expand Down