-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
Make debugging index creation dramatically easier #440
Conversation
Pull Request Test Coverage Report for Build 686
💛 - Coveralls |
Also happy to update any docs if you point me their way |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question
lib/Table.js
Outdated
@@ -40,6 +40,7 @@ const compareIndexes = function compareIndexes(local, remote) { | |||
let localIndex = (({ IndexName, KeySchema, Projection }) => ({ IndexName, KeySchema, Projection }))(localIndexes[i]); | |||
let remoteIndex = (({ IndexName, KeySchema, Projection }) => ({ IndexName, KeySchema, Projection }))(remoteIndexes[j]); | |||
|
|||
debug("\nindex being compared \nlocal:", localIndex, "\nremote: \n", remoteIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the thoughts about changing this to one of the following options? Not sure if this is a good idea, and I'm not sure what we are doing in cases like this in other areas.
Not sure if I'm the biggest fan of those \n
in the string. Especially since I'm not sure how it actually looks in the console because debug appends that string and other information to the beginning of every debug statement. So I'm not sure if it'd look really weird with those line breaks.
debug("index being compared, local:", localIndex, ", remote: ", remoteIndex)
debug("index being compared");
debug("local: ", localIndex);
debug("remote: ", remoteIndex);
Not sold on my ideas, or that you are doing it wrong. Maybe your way is the best. Just wondering what your thoughts are in terms of this.
If you could also look throughout the project and see if you can find other areas where we are doing \n
or one of my methods, that'd be awesome too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually prefer it your way. was just hacking it out to see if it worked when I wrote that lol. fixing it update
Thanks for this @williscool!! There is no documentation updated needed for this PR. I do need you to check all of the boxes under the Other than that and addressing my question in the review I think we should be good to merge this in pretty soon. Thanks again! |
Will get you this stuff ASAP. Thanks for looking at this! |
Currently Its not obvious how index's are managed created in dynamoose using ``` dynamoose.model(name, schema, {update: true}) ``` Will *delete the indexes that are currently on a table*. Which is a HUGE NO NO in production. Especially since they can take non trivial amounts of time to get back setup... which at best causes service degradation and at worse downtime This new change allows you to use ``` DEBUG=dynamoose:table* <how ever you start your server i.e. node server.js or yarn serve> ``` And see the difference in the console i.e. ``` dynamoose:table compareIndexes +0ms indexs for compare local: { IndexName: 'fb_id-index', KeySchema: [ { AttributeName: 'fb_id', KeyType: 'HASH' }, { AttributeName: 'fb-id', KeyType: 'RANGE' } ], Projection: { ProjectionType: 'ALL' } } remote: { IndexName: 'fb_id-index', KeySchema: [ { AttributeName: 'fb_id', KeyType: 'HASH' } ], Projection: { ProjectionType: 'ALL' } } indexs for compare local: { IndexName: 'phone_number-index', KeySchema: [ { AttributeName: 'phone_number', KeyType: 'HASH' }, { AttributeName: 'phone_number', KeyType: 'RANGE' } ], Projection: { ProjectionType: 'ALL' } } remote: { IndexName: 'phone_number-index', KeySchema: [ { AttributeName: 'phone_number', KeyType: 'HASH' } ], Projection: { ProjectionType: 'ALL' } } blah blah blah dynamoose:table devTickets indexes are not synchronized and update flag is set to false +1ms ``` MUUCH better way to deal with ``` Error: indexes are not synchronized and update flag is set to false ```
@fishcharlie updated things! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@williscool This looks good! I will get this merged in soon, and hopefully we will have a release coming up soon so that we can get it on NPM. We do have some bug fixes I'm hoping get fixed up soon so we can do a release. Thanks for your contribution!! |
❤️ |
Currently Its not obvious how index's are managed in dynamoose.
Creation using
as mentioned in #221
Will delete the indexes that are currently on a table. Which is a HUGE NO NO in production.
Especially since they can take non trivial amounts of time to get back setup... which at best causes service degradation and at worse downtime.
This new change allows you to use
And see the difference in the console i.e.
You can use this information to figure out what is different between the indexes on the table that exist versus the ones that you have setup in your dynamoose model.
And change accordingly
MUUCH better way to deal with
Than before
Type (select 1):
Is this a breaking change? (select 1):
Is this ready to be merged into Dynamoose? (select 1):
Are all the tests currently passing on this PR? (select 1):
Other:
npm test
from the root of the project directory to ensure all tests continue to pass