Skip to content
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

DynamoDb: No result when trying to call DescribeTable on a table with a Global Secondary Index #50

Closed
wants to merge 1 commit into from

Conversation

IainCole
Copy link

I had an issue when calling DescribeTable on a table with a global secondary index.

I traced the issue to the way that the JSON is parsed in responses. I found two oddities:

The first is that the JsonUnmarshallerContext CurrentPath seems to reverse all but the last node (stack + currentField), whilst this doesn't actually make a difference to the code because it only cares about the last level it certainly confused me when I was trying to debug what was going on!

The second is that due to the fact that the DescribeTableResponseUnmarshaller doesn't currently handle the GlobalSecondaryIndexes node because it's new, everything after that point got ignored. I traced that to the way that ObjectEnd and ArrayEnd are handled; both ArrayEnd and ObjectEnd cause the stack to be popped twice, once to remove the Object/ArrayEnd token and once to remove the propertyName that it corresponds to.

This caused an issue because it resulted in the JsonUnmarshallerContext CurrentDepth property returning 1 even though there were more depth=2 properties to come at the point the Unmarshaller was at the Object/ArrayEnd token. This caused the TableDescriptionUnmarshaller to return before it was finished.

The fix may not be the best way around this but it seemed to work for my problem, basically I set a flag to pop the 2 items off the stack at the start of the next Read operation so that the path and depth are correct when the reader is at an ObjectEnd or ArrayEnd token.

This only happens if the particular Unmarshaller doesn't handle a specific property that's returned by the API, this is obviously an issue for any part of the SDK as it could happen any time that the API is updated and returns new properties.

Apologies for the whitespace (it's late) ?w=1 ftw

@IainCole
Copy link
Author

Looks like I had my issue in the minuscule gap between the API being updated and the SDK being updated, still, I think my changes still apply.

@wmatveyenko
Copy link

Hi @IainCole,
Unfortunately, we can't accept this pull request in it's current form. You appear to have changed the whitespace in you commit and the entire file is being marked as changed. If you still want to submit this change, please modify your pull request to conserve whitespace. I am going to mark this as closed, but please reopen it if you are going to resubmit your request.

@IainCole
Copy link
Author

Yeah also you have made significant changes to that part of the system since I created it. I might raise another issue for it because I still think there may be an underlying issue with the way the unmarshalling works as described in this PR, however I need to spend a bit of time proving it in a test case to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants