)]}'
{"marconi/queues/storage/mongodb/messages.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"448a9234fdb62ef6b9513be6e236ac144f827561","unresolved":false,"context_lines":[{"line_number":649,"context_line":"                # NOTE(kgriffs): Read from primary in case the message"},{"line_number":650,"context_line":"                # was just barely claimed, and claim hasn\u0027t made it to"},{"line_number":651,"context_line":"                # the secondary."},{"line_number":652,"context_line":"                pref \u003d pymongo.read_preferences.ReadPreference.PRIMARY"},{"line_number":653,"context_line":"                message \u003d collection.find_one(query, read_preference\u003dpref)"},{"line_number":654,"context_line":""},{"line_number":655,"context_line":"                if message[\u0027c\u0027][\u0027id\u0027] !\u003d cid:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F94uU%3D","line":652,"updated":"2013-12-04 21:21:43.000000000","message":"This assumes that mongodb was deployed with replicasets. It is not recommended to send primary or primaryPreferred when talking to a sharding environment. Sharding increases reads and writes capacity dynamically and by distributing them across the shards.\n\nIt shouldn\u0027t be of harmful but it is not recommended. I personally prefer not making any assumption about the backend deployment. What happens if we talk to a shard? Would we face the same issue we\u0027re facing without this read preference?","commit_id":"9ccce28148eebd7e5d0532f3c07e35eeec770add"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"be838d8be8fbbf7db56d9fb6986ebe80fe85504e","unresolved":false,"context_lines":[{"line_number":649,"context_line":"                # NOTE(kgriffs): Read from primary in case the message"},{"line_number":650,"context_line":"                # was just barely claimed, and claim hasn\u0027t made it to"},{"line_number":651,"context_line":"                # the secondary."},{"line_number":652,"context_line":"                pref \u003d pymongo.read_preferences.ReadPreference.PRIMARY"},{"line_number":653,"context_line":"                message \u003d collection.find_one(query, read_preference\u003dpref)"},{"line_number":654,"context_line":""},{"line_number":655,"context_line":"                if message[\u0027c\u0027][\u0027id\u0027] !\u003d cid:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F94l4%3D","line":652,"in_reply_to":"AAAATn%2F94nQ%3D","updated":"2013-12-04 21:53:04.000000000","message":"Awesome. Fair enough. We can change this later if it turns out not being so good for mongodb sharded deployments.","commit_id":"9ccce28148eebd7e5d0532f3c07e35eeec770add"},{"author":{"_account_id":6427,"name":"Kurt Griffiths","email":"kurt.griffiths@rackspace.com","username":"kgriffs"},"change_message_id":"1f697f425a8de2c13b37529b11da0dee39a6466d","unresolved":false,"context_lines":[{"line_number":649,"context_line":"                # NOTE(kgriffs): Read from primary in case the message"},{"line_number":650,"context_line":"                # was just barely claimed, and claim hasn\u0027t made it to"},{"line_number":651,"context_line":"                # the secondary."},{"line_number":652,"context_line":"                pref \u003d pymongo.read_preferences.ReadPreference.PRIMARY"},{"line_number":653,"context_line":"                message \u003d collection.find_one(query, read_preference\u003dpref)"},{"line_number":654,"context_line":""},{"line_number":655,"context_line":"                if message[\u0027c\u0027][\u0027id\u0027] !\u003d cid:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F94nQ%3D","line":652,"in_reply_to":"AAAATn%2F94uU%3D","updated":"2013-12-04 21:49:20.000000000","message":"I tested this when not running with a replica set and it was fine (single mongod). \n\nRegarding what happens in a sharding environment, it should just go out to the primary for the shard that the key is mapped to. Not a big deal, IMO, unless maybe it ends up having to query multiple shards (scatter-gather), causing a geometric increase in system load. Even in this case however, I don\u0027t think it will be a problem in practice, because it should be rare that the cid supplied doesn\u0027t match the one expected (L648).\n\nFWIW, we would not have this race condition in the first place if we were able to do this check in the delete call rather than in code; deletes always go to the primary anyway.\n\nIn our testing at Rackspace, we found it wasn\u0027t actually too hard to trigger this condition. Esp. for single-tenant deployments, when you don\u0027t have the natural latency introduced by noisy neighbors which would otherwise slow down a client\u0027s requests.","commit_id":"9ccce28148eebd7e5d0532f3c07e35eeec770add"}]}
