-
Notifications
You must be signed in to change notification settings - Fork 11
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
Python Sample unexpected output #33
Comments
I think you're right. I'm not sure when, if ever, the test printed something else... The DescribeEndpoints request just echos the "Host:" header used in the request. A comment in boto3_alternator.py explains (in a different place, but the comment is still relevant), that when boto3 thinks the target of the request is "dog.scylla.com" it will use this name in preparing the request signature, and since Alternator uses the "Host:" header to calculate this signature, so we NEED the "Host:" HTTP header to also be "dog.scylla.com". So this fake domain is what DescribeEndpoints prints. In the Go version of this wrapper, we actually documented that "the "fake domain" which doesn't really mean anything (except it will be used as the Host header, and be returned by the DescribeEndpoints request)," So I think that this test should be modified to not bother printing the result of DescribeEndpoints every time. To check if we get a different or same Scylla node in every request, perhaps there's some way we can enquire which node actually sent us the response or maybe just add a trace-level logging or something in the boto3_alternator.py wrapper that will print out its decision on every request. |
By the way note that if you use setup1() (as I think this test does by default) all the requests done by the same thread will go to the same node anyway. Maybe in addition to the two methods we already have setup1() and setup2(), it might be possible to find a way that doesn't need to use a "fake domain". In the new Java version of our wrapper, we used a new feature of the AWS Java SDK, "DynamoDbEndpointProvider", which lets us return a different endpoint every time in a clean way, without some "fake domain" being involved. Maybe the Python SDK also could do something similar - I see it also has endpoint_provider.py but I don't know how to configure it or override it. But I also don't know if will be worth the work - this issue describes mostly a confusing test, not a problem that hurts a real application. |
The
try1.py
andtry2.py
are supposed to display the output of different Alternator hosts, but the script only displays the dummy hostname valuesThe line that does this is:
print(dynamodb.meta.client.describe_endpoints()['Endpoints'][0]['Address'])
As per the description in the README it should print out different alternator IP addresses every time
The text was updated successfully, but these errors were encountered: